Skip to content

Subtree update of rust-analyzer #137523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4d386f7
Use correct working directory for non-workspace proc-macro execution
infiniteregrets Feb 12, 2025
9821bb0
move dev docs to manual
joshrotenberg Feb 15, 2025
501471a
Merge pull request #19157 from joshrotenberg/dev-guide-to-book
Veykril Feb 18, 2025
3457775
Revert "pass struct fields to chalk"
Veykril Feb 18, 2025
78b7390
Merge pull request #19173 from rust-lang/revert-19122-master
Veykril Feb 18, 2025
176d3ff
Fix dead link
BenjaminBrienen Feb 18, 2025
e6c1e6c
Merge pull request #19176 from BenjaminBrienen/patch-3
lnicola Feb 18, 2025
ebe8c48
Fix 19090
alibektas Feb 18, 2025
d09cabb
use fully qualified url for source path
joshrotenberg Feb 18, 2025
6100c2c
Add a check_assist_* overload and move tests under assists
alibektas Feb 18, 2025
1ed0471
Merge pull request #19179 from alibektas/19090_new
ChayimFriedman2 Feb 18, 2025
1ad2fa8
Merge pull request #19180 from joshrotenberg/fix-source-file-url
Veykril Feb 19, 2025
ceab754
fix: Binding wrong assoc ty when lowering trait ref bound
ShoyuVanilla Feb 19, 2025
851ef81
Explicitly compare `TypesMap` as ptrs
ShoyuVanilla Feb 19, 2025
4bc72f7
Update architecture.md
BenjaminBrienen Feb 20, 2025
d50c449
missed the L for the line number
joshrotenberg Feb 20, 2025
b53fc6e
Update configuration.md
BenjaminBrienen Feb 20, 2025
c55ad62
Merge pull request #19186 from joshrotenberg/fix-source-link-line-anchor
lnicola Feb 20, 2025
e14f407
Merge pull request #19187 from BenjaminBrienen/patch-4
lnicola Feb 20, 2025
36768cd
Merge pull request #19185 from BenjaminBrienen/patch-3
lnicola Feb 20, 2025
52e878c
Use ubuntu-latest workers for releases
lnicola Feb 20, 2025
98fc39f
Merge pull request #19188 from lnicola/ubuntu-latest
lnicola Feb 20, 2025
c0c0283
Merge pull request #19151 from infiniteregrets/infi/fix-proc-macro
Veykril Feb 20, 2025
f97bbd3
Update editor_features.md
BenjaminBrienen Feb 20, 2025
2ba41e8
Merge pull request #19190 from BenjaminBrienen/patch-4
lnicola Feb 20, 2025
b3a6168
Improve unset OUT_DIR error message
Veykril Feb 20, 2025
f9fb2db
Merge pull request #19189 from Veykril/push-qutznxznnwqn
Veykril Feb 20, 2025
67f408c
Update style.md
BenjaminBrienen Feb 20, 2025
010cba3
Merge pull request #19192 from BenjaminBrienen/patch-4
lnicola Feb 20, 2025
5aaf2f7
toc for other editors
joshrotenberg Feb 22, 2025
db04df0
Switch back to RUST_SRC_PATH
lnicola Feb 22, 2025
f629e3e
Merge pull request #19201 from joshrotenberg/other-editors-toc
lnicola Feb 22, 2025
01c3ba8
Merge pull request #19203 from lnicola/rust-src-path
lnicola Feb 22, 2025
da06b7c
Merge pull request #19182 from ShoyuVanilla/issue-19177
ChayimFriedman2 Feb 22, 2025
3b05e93
Fix parser inline tests codegen panics
niller-g Feb 23, 2025
563435e
Fix codegen of parser inline tests runner
niller-g Feb 23, 2025
8a493b1
Merge pull request #19209 from niller-g/master
Veykril Feb 23, 2025
a941de4
Remove `limit` crate in favor `usize`
Veykril Feb 20, 2025
286595e
Merge pull request #19191 from Veykril/push-yzzlosskwrxs
Veykril Feb 23, 2025
386d7a5
Preparing for merge from rust-lang/rust
lnicola Feb 24, 2025
36e41b5
Merge from rust-lang/rust
lnicola Feb 24, 2025
df39a77
Add rustc_hashes and bump the others
lnicola Feb 24, 2025
1375df2
Format code
lnicola Feb 24, 2025
a2bd5a5
Update assist docs
lnicola Feb 24, 2025
6d9b9c1
Merge pull request #19212 from lnicola/sync-from-rust
lnicola Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/tools/rust-analyzer/.github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-20.04
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64
container: rockylinux:8
- os: ubuntu-20.04
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: ubuntu-20.04
- os: ubuntu-latest
target: arm-unknown-linux-gnueabihf
code-target: linux-armhf
- os: macos-13
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Thank you for your interest in contributing to rust-analyzer! There are many way
and we appreciate all of them.

To get a quick overview of the crates and structure of the project take a look at the
[./docs/dev](./docs/dev) folder.
[Contributing](https://rust-analyzer.github.io/book/contributing) section of the manual.

If you have any questions please ask them in the [rust-analyzer zulip stream](
https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer) or if unsure where
Expand Down
51 changes: 30 additions & 21 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ dependencies = [
"intern",
"itertools",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"limit",
"mbe",
"ra-ap-rustc_abi",
"ra-ap-rustc_hashes",
"ra-ap-rustc_parse_format",
"rustc-hash 2.0.0",
"rustc_apfloat",
Expand Down Expand Up @@ -591,7 +591,6 @@ dependencies = [
"intern",
"itertools",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"limit",
"mbe",
"parser",
"rustc-hash 2.0.0",
Expand Down Expand Up @@ -626,11 +625,11 @@ dependencies = [
"intern",
"itertools",
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"limit",
"nohash-hasher",
"oorandom",
"project-model",
"ra-ap-rustc_abi",
"ra-ap-rustc_hashes",
"ra-ap-rustc_index",
"ra-ap-rustc_pattern_analysis",
"rustc-hash 2.0.0",
Expand Down Expand Up @@ -744,7 +743,6 @@ dependencies = [
"hir",
"indexmap",
"itertools",
"limit",
"line-index 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
"nohash-hasher",
Expand Down Expand Up @@ -943,10 +941,6 @@ dependencies = [
"redox_syscall",
]

[[package]]
name = "limit"
version = "0.0.0"

[[package]]
name = "line-index"
version = "0.1.2"
Expand Down Expand Up @@ -1279,7 +1273,6 @@ dependencies = [
"drop_bomb",
"edition",
"expect-test",
"limit",
"ra-ap-rustc_lexer",
"stdx",
"tracing",
Expand Down Expand Up @@ -1514,30 +1507,40 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_abi"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40c4e339b71a8f075a829b1acaf32f870a11b466d9b8623d50b0ce33e65af95"
checksum = "3829c3355d1681ffeaf1450ec71edcdace6820fe2e86469d8fc1ad45e2c96460"
dependencies = [
"bitflags 2.7.0",
"ra-ap-rustc_hashes",
"ra-ap-rustc_index",
"tracing",
]

[[package]]
name = "ra-ap-rustc_hashes"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bd4d6d4c434bec08e02370a4f64a4985312097215a62e82d0f757f3a98e502e"
dependencies = [
"rustc-stable-hash",
]

[[package]]
name = "ra-ap-rustc_index"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872072e2ba11d11147ebe9fde1608fe7f7d9b5c51dac524af28ee07c6dade468"
checksum = "bad6fc4bd7522e31096e2de5b0351144fe0684b608791ee26c842bf2da1b19ae"
dependencies = [
"ra-ap-rustc_index_macros",
"smallvec",
]

[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffcd77debcaf2ad690a57c2d041c11eb33fe66869754b2c5f35c52954b46af0c"
checksum = "cfb234e1f84b92be45276c3025bee18789e9bc95bec8789bec961e78edb01c52"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -1546,9 +1549,9 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_lexer"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49265cdf8823f8d246e476c79c60bd6e5b551c81ae76e1c8d6a5e0dc73df0bca"
checksum = "7a3a40bd11dc43d1cb110e730b80620cf8102f4cca8920a02b65954da0ed931f"
dependencies = [
"memchr",
"unicode-properties",
Expand All @@ -1557,19 +1560,19 @@ dependencies = [

[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3da239fdc971176de0db45cb631d71475b52033a3d0027d91964da7be89eee6"
checksum = "5feb877478994cb4c0c0c7a5116a352eefc0634aefc8636feb00a893fa5b7135"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
]

[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.95.0"
version = "0.97.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56057d08fdfa0d95494e461bbdd5d4b3fdb349cca6be05ad7759bc964be1b8d4"
checksum = "a76774d35934d464c4115908cde16f76a4f7e540fe1eea6b79336c556e37bdd3"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash 2.0.0",
Expand Down Expand Up @@ -1744,6 +1747,12 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"

[[package]]
name = "rustc-stable-hash"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2febf9acc5ee5e99d1ad0afcdbccc02d87aa3f857a1f01f825b80eacf8edfcd1"

[[package]]
name = "rustc_apfloat"
version = "0.2.1+llvm-462a31f5a5ab"
Expand Down
12 changes: 6 additions & 6 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ ide-db = { path = "./crates/ide-db", version = "0.0.0" }
ide-diagnostics = { path = "./crates/ide-diagnostics", version = "0.0.0" }
ide-ssr = { path = "./crates/ide-ssr", version = "0.0.0" }
intern = { path = "./crates/intern", version = "0.0.0" }
limit = { path = "./crates/limit", version = "0.0.0" }
load-cargo = { path = "./crates/load-cargo", version = "0.0.0" }
mbe = { path = "./crates/mbe", version = "0.0.0" }
parser = { path = "./crates/parser", version = "0.0.0" }
Expand All @@ -87,11 +86,12 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }
edition = { path = "./crates/edition", version = "0.0.0" }

ra-ap-rustc_lexer = { version = "0.95", default-features = false }
ra-ap-rustc_parse_format = { version = "0.95", default-features = false }
ra-ap-rustc_index = { version = "0.95", default-features = false }
ra-ap-rustc_abi = { version = "0.95", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.95", default-features = false }
ra-ap-rustc_hashes = { version = "0.97", default-features = false }
ra-ap-rustc_lexer = { version = "0.97", default-features = false }
ra-ap-rustc_parse_format = { version = "0.97", default-features = false }
ra-ap-rustc_index = { version = "0.97", default-features = false }
ra-ap-rustc_abi = { version = "0.97", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.97", default-features = false }

# local crates that aren't published to crates.io. These should not have versions.

Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ https://rust-analyzer.github.io/book/installation.html
## Documentation

If you want to **contribute** to rust-analyzer check out the [CONTRIBUTING.md](./CONTRIBUTING.md) or
if you are just curious about how things work under the hood, check the [./docs/dev](./docs/dev)
folder.
if you are just curious about how things work under the hood, see the
[Contributing](https://rust-analyzer.github.io/book/contributing) section of the manual.

If you want to **use** rust-analyzer's language server with your editor of
choice, check [the manual](https://rust-analyzer.github.io/book/).
Expand Down
37 changes: 26 additions & 11 deletions src/tools/rust-analyzer/crates/base-db/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ pub struct CrateData {
pub dependencies: Vec<Dependency>,
pub origin: CrateOrigin,
pub is_proc_macro: bool,
/// The working directory to run proc-macros in. This is the workspace root of the cargo workspace
/// for workspace members, the crate manifest dir otherwise.
pub proc_macro_cwd: Option<AbsPathBuf>,
}

#[derive(Default, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -360,8 +363,9 @@ impl CrateGraph {
cfg_options: Arc<CfgOptions>,
potential_cfg_options: Option<Arc<CfgOptions>>,
mut env: Env,
is_proc_macro: bool,
origin: CrateOrigin,
is_proc_macro: bool,
proc_macro_cwd: Option<AbsPathBuf>,
) -> CrateId {
env.entries.shrink_to_fit();
let data = CrateData {
Expand All @@ -375,6 +379,7 @@ impl CrateGraph {
dependencies: Vec::new(),
origin,
is_proc_macro,
proc_macro_cwd,
};
self.arena.alloc(data)
}
Expand Down Expand Up @@ -698,8 +703,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate2 = graph.add_crate_root(
FileId::from_raw(2u32),
Expand All @@ -709,8 +715,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate3 = graph.add_crate_root(
FileId::from_raw(3u32),
Expand All @@ -720,8 +727,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
Expand All @@ -745,8 +753,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate2 = graph.add_crate_root(
FileId::from_raw(2u32),
Expand All @@ -756,8 +765,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
Expand All @@ -778,8 +788,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate2 = graph.add_crate_root(
FileId::from_raw(2u32),
Expand All @@ -789,8 +800,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate3 = graph.add_crate_root(
FileId::from_raw(3u32),
Expand All @@ -800,8 +812,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
Expand All @@ -822,8 +835,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
let crate2 = graph.add_crate_root(
FileId::from_raw(2u32),
Expand All @@ -833,8 +847,9 @@ mod tests {
Default::default(),
Default::default(),
Env::default(),
false,
CrateOrigin::Local { repo: None, name: None },
false,
None,
);
assert!(graph
.add_dep(
Expand Down
4 changes: 1 addition & 3 deletions src/tools/rust-analyzer/crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_hash::FxHashMap;
use span::EditionedFileId;
use syntax::{ast, Parse, SourceFile, SyntaxError};
use triomphe::Arc;
use vfs::{AbsPathBuf, FileId};
use vfs::FileId;

pub use crate::{
change::FileChange,
Expand Down Expand Up @@ -85,8 +85,6 @@ pub trait SourceDatabase: FileLoader + std::fmt::Debug {
/// Crate related data shared by the whole workspace.
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct CrateWorkspaceData {
/// The working directory to run proc-macros in. This is usually the workspace root of cargo workspaces.
pub proc_macro_cwd: Option<AbsPathBuf>,
// FIXME: Consider removing this, making HirDatabase::target_data_layout an input query
pub data_layout: TargetLayoutLoadResult,
/// Toolchain version used to compile the crate.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-def/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ triomphe.workspace = true
rustc_apfloat = "0.2.0"
text-size.workspace = true

ra-ap-rustc_hashes.workspace = true
ra-ap-rustc_parse_format.workspace = true
ra-ap-rustc_abi.workspace = true

Expand All @@ -43,7 +44,6 @@ hir-expand.workspace = true
mbe.workspace = true
cfg.workspace = true
tt.workspace = true
limit.workspace = true
span.workspace = true


Expand Down
Loading
Loading