Skip to content

Subtree update of rust-analyzer #119289

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

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
6adb21a
Update rust-analyzer to support new `injected_env_var` function
GuillaumeGomez Dec 11, 2023
b986d8a
Complete exported macros in `#[macro_use($0)]`
unexge Dec 16, 2023
0e49024
Add missing docs string
unexge Dec 16, 2023
3b8801c
Go to definition for macros in `#[macro_use(...)]`
unexge Dec 16, 2023
cac74d9
Auto merge of #118830 - GuillaumeGomez:env-tracked_env, r=Nilstrieb
bors Dec 17, 2023
e37cf75
Merge commit '21b06c1beb9bb59369ffd652f5d617bcf6952e05' into sync-fro…
lnicola Dec 18, 2023
3562030
internal: Move proc-macro knowledge out of base-db
Veykril Dec 18, 2023
e628f17
Merge branch 'master' into sync-from-rust
lnicola Dec 18, 2023
9a82f8c
Auto merge of #16144 - lnicola:sync-from-rust, r=lnicola
bors Dec 18, 2023
cfc959d
Auto merge of #16143 - Veykril:base-db-no-proc-macros, r=lnicola
bors Dec 18, 2023
66e29be
internal: Split out a span crate
Veykril Dec 18, 2023
ec61623
Move the SpanMap definition into the span crate
Veykril Dec 18, 2023
0380869
Auto merge of #16145 - Veykril:span-crate, r=Veykril
bors Dec 18, 2023
66fa1c9
Don't auto-publish sourcegen
lnicola Dec 18, 2023
bd03f92
Auto merge of #16147 - lnicola:no-ap-sourcegen, r=lnicola
bors Dec 18, 2023
60281a6
Don't fail changelog generation on missing PRs
lnicola Nov 30, 2022
5daf090
Auto merge of #16149 - lnicola:ignore-missing-prs, r=lnicola
bors Dec 18, 2023
f49a2fe
internal: Move out `WithFixture` into dev-dep only crate
Veykril Dec 18, 2023
ae2c322
Auto merge of #16150 - Veykril:text-fixture, r=Veykril
bors Dec 18, 2023
bd61888
fix: resolve alias before resolve variant
Austaras Dec 18, 2023
f663521
Auto merge of #16152 - Austaras:alias, r=Veykril
bors Dec 18, 2023
fec0e04
Add minimal support for the 2024 edition
lnicola Dec 18, 2023
0ed815f
Auto merge of #16151 - lnicola:minimal-2024-edition, r=davidbarsky
bors Dec 18, 2023
5318e89
fix: Dont assume ascii in remove_markdown
Waqar144 Dec 18, 2023
117a28a
fix(mbe): desugar doc correctly for mbe
saiintbrisson Dec 19, 2023
6f58e98
fix(mbe): update test
saiintbrisson Dec 19, 2023
9f4d269
minor: use a single push_str instead of 2 push
Waqar144 Dec 19, 2023
13177e3
minor: Use reserve when removing markdown from text
Waqar144 Dec 19, 2023
f1d09c9
Auto merge of #16159 - Waqar144:work/simplify, r=Veykril
bors Dec 19, 2023
484525f
Auto merge of #16158 - saiintbrisson:fix/mbe/desugar-comment-to-raw-s…
bors Dec 19, 2023
1c4c220
Auto merge of #16160 - Waqar144:work/use-reserve, r=Veykril
bors Dec 19, 2023
dbd0b03
Auto merge of #16155 - Waqar144:work/fix-16142, r=lnicola
bors Dec 19, 2023
f587b54
perf: Run async task in concurrent
sanjaiyan-dev Dec 19, 2023
002e611
fix: Deduplicate annotations
Veykril Dec 19, 2023
7204ee1
Auto merge of #16163 - Veykril:goto-impl-fix, r=Veykril
bors Dec 19, 2023
f178a8b
Bump test-electron
lnicola Dec 19, 2023
37b0019
Auto merge of #16164 - lnicola:bump-test-electron, r=lnicola
bors Dec 19, 2023
831d0e0
Auto merge of #16162 - sanjaiyan-dev:sanjaiyan-async-concurrent, r=ln…
bors Dec 19, 2023
8753ca5
fix: Update metavariable expression implementation
Veykril Dec 19, 2023
f48ecb6
Try to support pre and post-change metavars
Veykril Dec 19, 2023
7bdf48c
Auto merge of #16165 - Veykril:meta-vars, r=Veykril
bors Dec 20, 2023
bc2dee7
feat: auto remove unnecessary braces after remove unused imports
Young-Flash Dec 20, 2023
4cd939a
chore: add test case for nested use tree
Young-Flash Dec 20, 2023
4ec8123
Remove usages of Span::DUMMY
Veykril Dec 20, 2023
2c6ce48
Remove Delimier::dummy_invisible
Veykril Dec 20, 2023
7b80455
Remove Delimiter::DUMMY_INVISIBLE
Veykril Dec 20, 2023
f211a40
Remove SyntaxContext trait
Veykril Dec 20, 2023
65ed198
Auto merge of #16066 - Young-Flash:auto_remove_brace, r=lnicola
bors Dec 20, 2023
337e2ab
Auto merge of #16167 - Veykril:dummy-spans, r=Veykril
bors Dec 20, 2023
071fe4e
Move Intern and Lookup traits to hir-expand
Veykril Dec 20, 2023
51a9e78
Rename some things and turn macro to macro def into a query
Veykril Dec 21, 2023
7d762d1
Record macro def site spans
Veykril Dec 21, 2023
1e1113c
Correctly set and mark the proc-macro spans
Veykril Dec 21, 2023
9ee71b4
Auto merge of #16175 - Veykril:dummy-spans, r=Veykril
bors Dec 21, 2023
5bdb479
fix: Fix span marking for builtin fn macros
Veykril Dec 21, 2023
3ce3593
Auto merge of #16178 - Veykril:builtin-fn-callsite, r=Veykril
bors Dec 21, 2023
a892237
Add rust-analyzer-span server feature equivalent to the ID server
Veykril Dec 11, 2023
6be83b8
Fix IDE layer not resolving assoc type paths in path qualifiers
Veykril Dec 11, 2023
428a34a
Implement server::Span::Join
Veykril Dec 11, 2023
f427f56
Implement other non-db reliant server::Span functions
Veykril Dec 11, 2023
c89fd01
Move proc-macro-test into proc-macro-srv
Veykril Dec 15, 2023
874df3b
Add eager-expand comment
Veykril Dec 15, 2023
96051bc
Fix workspace layout
Veykril Dec 15, 2023
9197b54
Fix dead code warnings
Veykril Dec 15, 2023
ca957f4
Fix proc-macro-test-impl building without any proc-macros
Veykril Dec 15, 2023
2e52aa1
Clean up
Veykril Dec 15, 2023
9e8e124
Special case fixup spans in server::Span impl, they are immutable
Veykril Dec 22, 2023
5761b50
More general server config message for proc-macro-api
Veykril Dec 22, 2023
20e09c6
Auto merge of #16088 - Veykril:proc-macro-srv-2, r=Veykril
bors Dec 22, 2023
2a5b60b
internal: Update world symbols request definiton, prefer focus range …
Veykril Dec 22, 2023
23a1280
Auto merge of #16137 - unexge:complete-macros-in-macro-use, r=Veykril
bors Dec 22, 2023
d2dacc0
Auto merge of #16182 - Veykril:world-symbols-focus-range, r=Veykril
bors Dec 22, 2023
9d24764
internal: Cleanup Expander a bit
Veykril Dec 22, 2023
91046e9
fix: Fix completions analysis not caching all nodes in Semantics
Veykril Dec 22, 2023
3643c37
Auto merge of #16183 - Veykril:expander, r=Veykril
bors Dec 22, 2023
afbb8f3
Auto merge of #16184 - Veykril:completion-panic, r=Veykril
bors Dec 22, 2023
2426d42
fix: remove wrong comma after remove unnecessary braces
Young-Flash Dec 22, 2023
6c9d2ad
test: add test case for remove comma
Young-Flash Dec 22, 2023
a24ede2
Auto merge of #16185 - Young-Flash:fix_auto_remove_brace, r=lnicola
bors Dec 23, 2023
cc73c00
add test case for negative impl
Young-Flash Dec 24, 2023
85fb463
Auto merge of #16190 - Young-Flash:test_case_negative_impl, r=lnicola
bors Dec 24, 2023
bd416e2
Merge commit '85fb463fc586594925f05fc8e285b1568f98f41a'
lnicola Dec 25, 2023
0ccd7c9
Allow unexpected_cfgs in proc-macro-test imp
lnicola Dec 25, 2023
9de5fae
Add proc_macro_def_site to r-a ALLOW_FEATURES
lnicola Jan 2, 2024
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
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ pub struct RustAnalyzer {
}

impl RustAnalyzer {
pub const ALLOW_FEATURES: &'static str = "rustc_private,proc_macro_internals,proc_macro_diagnostic,proc_macro_span,proc_macro_span_shrink";
pub const ALLOW_FEATURES: &'static str = "rustc_private,proc_macro_internals,proc_macro_diagnostic,proc_macro_span,proc_macro_span_shrink,proc_macro_def_site";
}

impl Step for RustAnalyzer {
Expand Down
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- 'crates/proc-macro-api/**'
- 'crates/proc-macro-srv/**'
- 'crates/proc-macro-srv-cli/**'
- 'crates/proc-macro-test/**'

rust:
needs: changes
Expand Down
57 changes: 48 additions & 9 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ dependencies = [
"profile",
"rust-analyzer-salsa",
"rustc-hash",
"semver",
"span",
"stdx",
"syntax",
"test-utils",
"triomphe",
"tt",
"vfs",
]

Expand Down Expand Up @@ -516,8 +516,10 @@ dependencies = [
"rustc-dependencies",
"rustc-hash",
"smallvec",
"span",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"tracing",
"triomphe",
Expand All @@ -542,6 +544,7 @@ dependencies = [
"profile",
"rustc-hash",
"smallvec",
"span",
"stdx",
"syntax",
"tracing",
Expand Down Expand Up @@ -581,6 +584,7 @@ dependencies = [
"smallvec",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"tracing",
"tracing-subscriber",
Expand Down Expand Up @@ -624,6 +628,7 @@ dependencies = [
"smallvec",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"toolchain",
Expand All @@ -647,6 +652,7 @@ dependencies = [
"sourcegen",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
]
Expand All @@ -666,6 +672,7 @@ dependencies = [
"smallvec",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
]
Expand Down Expand Up @@ -694,8 +701,10 @@ dependencies = [
"rayon",
"rustc-hash",
"sourcegen",
"span",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"tracing",
Expand All @@ -720,6 +729,7 @@ dependencies = [
"sourcegen",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
]
Expand All @@ -737,6 +747,7 @@ dependencies = [
"parser",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"text-edit",
"triomphe",
Expand Down Expand Up @@ -903,11 +914,13 @@ version = "0.0.0"
dependencies = [
"anyhow",
"crossbeam-channel",
"hir-expand",
"ide",
"ide-db",
"itertools",
"proc-macro-api",
"project-model",
"span",
"tracing",
"tt",
"vfs",
Expand Down Expand Up @@ -956,9 +969,9 @@ dependencies = [

[[package]]
name = "lsp-types"
version = "0.94.0"
version = "0.95.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237"
checksum = "158c1911354ef73e8fe42da6b10c0484cb65c7f1007f28022e847706c1ab6984"
dependencies = [
"bitflags 1.3.2",
"serde",
Expand All @@ -975,6 +988,7 @@ dependencies = [
"parser",
"rustc-hash",
"smallvec",
"span",
"stdx",
"syntax",
"test-utils",
Expand Down Expand Up @@ -1251,6 +1265,7 @@ dependencies = [
"serde",
"serde_json",
"snap",
"span",
"stdx",
"text-size",
"tracing",
Expand All @@ -1262,6 +1277,7 @@ dependencies = [
name = "proc-macro-srv"
version = "0.0.0"
dependencies = [
"base-db",
"expect-test",
"libloading",
"mbe",
Expand All @@ -1270,6 +1286,7 @@ dependencies = [
"paths",
"proc-macro-api",
"proc-macro-test",
"span",
"stdx",
"tt",
]
Expand All @@ -1287,14 +1304,9 @@ name = "proc-macro-test"
version = "0.0.0"
dependencies = [
"cargo_metadata",
"proc-macro-test-impl",
"toolchain",
]

[[package]]
name = "proc-macro-test-impl"
version = "0.0.0"

[[package]]
name = "proc-macro2"
version = "1.0.69"
Expand Down Expand Up @@ -1535,6 +1547,7 @@ dependencies = [
"sourcegen",
"stdx",
"syntax",
"test-fixture",
"test-utils",
"tikv-jemallocator",
"toolchain",
Expand Down Expand Up @@ -1726,6 +1739,17 @@ dependencies = [
"xshell",
]

[[package]]
name = "span"
version = "0.0.0"
dependencies = [
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-analyzer-salsa",
"stdx",
"syntax",
"vfs",
]

[[package]]
name = "static_assertions"
version = "1.1.0"
Expand Down Expand Up @@ -1796,6 +1820,20 @@ dependencies = [
"ungrammar",
]

[[package]]
name = "test-fixture"
version = "0.0.0"
dependencies = [
"base-db",
"cfg",
"hir-expand",
"rustc-hash",
"span",
"stdx",
"test-utils",
"tt",
]

[[package]]
name = "test-utils"
version = "0.0.0"
Expand Down Expand Up @@ -1998,6 +2036,7 @@ name = "tt"
version = "0.0.0"
dependencies = [
"smol_str",
"span",
"stdx",
"text-size",
]
Expand Down
15 changes: 11 additions & 4 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["xtask/", "lib/*", "crates/*"]
exclude = ["crates/proc-macro-test/imp"]
exclude = ["crates/proc-macro-srv/proc-macro-test/"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -70,10 +70,9 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
profile = { path = "./crates/profile", version = "0.0.0" }
project-model = { path = "./crates/project-model", version = "0.0.0" }
sourcegen = { path = "./crates/sourcegen", version = "0.0.0" }
span = { path = "./crates/span", version = "0.0.0" }
stdx = { path = "./crates/stdx", version = "0.0.0" }
syntax = { path = "./crates/syntax", version = "0.0.0" }
test-utils = { path = "./crates/test-utils", version = "0.0.0" }
text-edit = { path = "./crates/text-edit", version = "0.0.0" }
toolchain = { path = "./crates/toolchain", version = "0.0.0" }
tt = { path = "./crates/tt", version = "0.0.0" }
Expand All @@ -82,7 +81,9 @@ vfs = { path = "./crates/vfs", version = "0.0.0" }
rustc-dependencies = { path = "./crates/rustc-dependencies", version = "0.0.0" }

# local crates that aren't published to crates.io. These should not have versions.
proc-macro-test = { path = "./crates/proc-macro-test" }
sourcegen = { path = "./crates/sourcegen" }
test-fixture = { path = "./crates/test-fixture" }
test-utils = { path = "./crates/test-utils" }

# In-tree crates that are published separately and follow semver. See lib/README.md
line-index = { version = "0.1.1" }
Expand All @@ -91,10 +92,14 @@ lsp-server = { version = "0.7.4" }

# non-local crates
anyhow = "1.0.75"
arrayvec = "0.7.4"
bitflags = "2.4.1"
cargo_metadata = "0.18.1"
command-group = "2.0.1"
crossbeam-channel = "0.5.8"
dissimilar = "1.0.7"
either = "1.9.0"
expect-test = "1.4.0"
hashbrown = { version = "0.14", features = [
"inline-more",
], default-features = false }
Expand All @@ -105,6 +110,7 @@ nohash-hasher = "0.2.0"
rayon = "1.8.0"
rust-analyzer-salsa = "0.17.0-pre.4"
rustc-hash = "1.1.0"
semver = "1.0.14"
serde = { version = "1.0.192", features = ["derive"] }
serde_json = "1.0.108"
smallvec = { version = "1.10.0", features = [
Expand All @@ -124,5 +130,6 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
triomphe = { version = "0.1.10", default-features = false, features = ["std"] }
xshell = "0.2.5"


# We need to freeze the version of the crate, as the raw-api feature is considered unstable
dashmap = { version = "=5.5.3", features = ["raw-api"] }
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/base-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ la-arena.workspace = true
rust-analyzer-salsa.workspace = true
rustc-hash.workspace = true
triomphe.workspace = true
semver.workspace = true

# local deps
cfg.workspace = true
profile.workspace = true
stdx.workspace = true
syntax.workspace = true
test-utils.workspace = true
tt.workspace = true
vfs.workspace = true
span.workspace = true
18 changes: 5 additions & 13 deletions src/tools/rust-analyzer/crates/base-db/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ use salsa::Durability;
use triomphe::Arc;
use vfs::FileId;

use crate::{CrateGraph, ProcMacros, SourceDatabaseExt, SourceRoot, SourceRootId};
use crate::{CrateGraph, SourceDatabaseExt, SourceRoot, SourceRootId};

/// Encapsulate a bunch of raw `.set` calls on the database.
#[derive(Default)]
pub struct Change {
pub struct FileChange {
pub roots: Option<Vec<SourceRoot>>,
pub files_changed: Vec<(FileId, Option<Arc<str>>)>,
pub crate_graph: Option<CrateGraph>,
pub proc_macros: Option<ProcMacros>,
}

impl fmt::Debug for Change {
impl fmt::Debug for FileChange {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut d = fmt.debug_struct("Change");
if let Some(roots) = &self.roots {
Expand All @@ -34,9 +33,9 @@ impl fmt::Debug for Change {
}
}

impl Change {
impl FileChange {
pub fn new() -> Self {
Change::default()
FileChange::default()
}

pub fn set_roots(&mut self, roots: Vec<SourceRoot>) {
Expand All @@ -51,10 +50,6 @@ impl Change {
self.crate_graph = Some(graph);
}

pub fn set_proc_macros(&mut self, proc_macros: ProcMacros) {
self.proc_macros = Some(proc_macros);
}

pub fn apply(self, db: &mut dyn SourceDatabaseExt) {
let _p = profile::span("RootDatabase::apply_change");
if let Some(roots) = self.roots {
Expand All @@ -79,9 +74,6 @@ impl Change {
if let Some(crate_graph) = self.crate_graph {
db.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH);
}
if let Some(proc_macros) = self.proc_macros {
db.set_proc_macros_with_durability(Arc::new(proc_macros), Durability::HIGH);
}
}
}

Expand Down
Loading