Skip to content
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

Subtree update of rust-analyzer #124433

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
29d28f8
Make `cargo run` always available for binaries
joshka Mar 29, 2024
3a4a69a
Add config hover_show_adtFieldsOrVariants to handle hovering limitati…
roife Apr 6, 2024
3994fcb
Update tests and docs for hover_show_adtFieldsOrVariants
roife Apr 6, 2024
2b38652
fix: the fields or variants of ADT was not restricted by limitations …
roife Apr 6, 2024
a113612
fix: adjust the limitation for ADTs' fields to 5
roife Apr 7, 2024
a8e50cf
Handle panicking like rustc CTFE does
Noratrieb Mar 24, 2024
b6751b7
Fix missing function body in minicore
Veykril Mar 25, 2024
4a33c5f
Fixup some issues with minicore
Veykril Mar 26, 2024
ca53651
Fix #[rustc_const_panic_str] functions not actually being hooked
Veykril Apr 18, 2024
2efaa44
Implement BeginPanic for mir eval
Veykril Apr 19, 2024
c1a4ba5
fix: add a separate setting for enum variants
roife Apr 19, 2024
0e9d845
Add hovering limitations support for variants
roife Apr 19, 2024
f7f02c0
fix: remove space within `{}` when no fields in struct
roife Apr 20, 2024
570c725
try to generate more meaningful names
leviska Apr 20, 2024
846f804
add test with multiple names
leviska Apr 20, 2024
04de0ff
Peek for panic message in test output
Veykril Apr 19, 2024
8f21381
Use josh for subtree syncs
lnicola Apr 7, 2024
7c39263
Allow rust files to be used linkedProjects
Veykril Apr 21, 2024
3c0f2db
Auto merge of #17118 - Veykril:linked-rust-files, r=Veykril
bors Apr 21, 2024
92ace4b
Extract common fields out of ProjectWorkspace variants
Veykril Apr 21, 2024
0a29e6f
Support flychecking for cargo scripts
Veykril Apr 21, 2024
23f19a2
Auto merge of #17119 - Veykril:linked-rust-files, r=Veykril
bors Apr 21, 2024
7a3ad03
Auto merge of #17115 - leviska:json_is_not_rust_better_names, r=Veykril
bors Apr 21, 2024
8ea8c74
Auto merge of #16938 - Nilstrieb:dont-panic-tests, r=Veykril
bors Apr 21, 2024
a200391
Auto merge of #17025 - lnicola:josh, r=lnicola
bors Apr 21, 2024
2d4723b
chore: add some `tracing` to project loading
davidbarsky Apr 18, 2024
afa2a89
Auto merge of #17102 - davidbarsky:david/add-some-tracing-to-project-…
bors Apr 22, 2024
9e212e0
different error code based on variant
Apr 23, 2024
5a315da
Auto merge of #17131 - bzy-debug:issue-17107, r=lnicola
bors Apr 24, 2024
410f71f
fix: move no_std check out of loop
joshka Apr 24, 2024
ec1a29b
Drop unknown lifetimes when rendering generic args
Veykril Apr 24, 2024
1709e37
Auto merge of #16972 - joshka:cargo-run-runnable, r=Veykril
bors Apr 25, 2024
10e82da
Add inlay hints lifetime arg tests
Veykril Apr 24, 2024
d00de38
Auto merge of #17021 - roife:add-hover-limits-for-adts, r=Veykril
bors Apr 25, 2024
a2259bb
Auto merge of #17134 - Veykril:lt-err-display, r=Veykril
bors Apr 25, 2024
7dd3a16
fix: Fix expression scopes not being calculated for inline consts
Veykril Apr 25, 2024
b2c3774
Auto merge of #17135 - Veykril:inline-const-scope, r=Veykril
bors Apr 25, 2024
3bc103a
Show workspace info in the status bar
Veykril Apr 26, 2024
cb12dbb
Auto merge of #17143 - Veykril:status-info, r=Veykril
bors Apr 26, 2024
2b6f198
fix: Fix source roots not always being created when necessary
Veykril Apr 26, 2024
0d33960
Auto merge of #17145 - Veykril:fix-missing-source-root, r=Veykril
bors Apr 26, 2024
0274d34
add no-new-root check to josh pull
RalfJung Apr 27, 2024
70fb039
empty rust-version file, since no pull has happened yet
RalfJung Apr 27, 2024
30b02be
experiment
RalfJung Apr 27, 2024
95b27b9
Preparing for merge from rust-lang/rust
RalfJung Apr 27, 2024
2a404a3
Merge from rust-lang/rust
RalfJung Apr 27, 2024
2d80667
Merge remote-tracking branch 'origin/master'
RalfJung Apr 27, 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
7 changes: 7 additions & 0 deletions src/tools/rust-analyzer/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@

# prettier format
f247090558c9ba3c551566eae5882b7ca865225f

# subtree syncs
932d85b52946d917deab2c23ead552f7f713b828
3e358a6827d83e8d6473913a5e304734aadfed04
9d2cb42a413e51deb50b36794a2e1605381878fc
f532576ac53ddcc666bc8d59e0b6437065e2f599
c48062fe2ab9a2d913d1985a6b0aec4bf936bfc1
50 changes: 50 additions & 0 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,27 @@ dependencies = [
"syn",
]

[[package]]
name = "directories"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
dependencies = [
"dirs-sys",
]

[[package]]
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.48.0",
]

[[package]]
name = "dissimilar"
version = "1.0.7"
Expand Down Expand Up @@ -898,6 +919,16 @@ dependencies = [
"libc",
]

[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.4.2",
"libc",
]

[[package]]
name = "limit"
version = "0.0.0"
Expand Down Expand Up @@ -1186,6 +1217,12 @@ version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"

[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"

[[package]]
name = "parking_lot"
version = "0.12.1"
Expand Down Expand Up @@ -1566,6 +1603,17 @@ dependencies = [
"bitflags 1.3.2",
]

[[package]]
name = "redox_users"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
dependencies = [
"getrandom",
"libredox",
"thiserror",
]

[[package]]
name = "rowan"
version = "0.15.15"
Expand Down Expand Up @@ -2255,6 +2303,7 @@ dependencies = [
"paths",
"rustc-hash",
"stdx",
"tracing",
]

[[package]]
Expand Down Expand Up @@ -2499,6 +2548,7 @@ name = "xtask"
version = "0.1.0"
dependencies = [
"anyhow",
"directories",
"flate2",
"itertools",
"proc-macro2",
Expand Down
2 changes: 2 additions & 0 deletions src/tools/rust-analyzer/crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub trait FileLoader {
/// Text of the file.
fn file_text(&self, file_id: FileId) -> Arc<str>;
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId>;
/// Crates whose root's source root is the same as the source root of `file_id`
fn relevant_crates(&self, file_id: FileId) -> Arc<[CrateId]>;
}

Expand Down Expand Up @@ -104,6 +105,7 @@ pub trait SourceDatabaseExt: SourceDatabase {
#[salsa::input]
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;

/// Crates whose root fool is in `id`.
fn source_root_crates(&self, id: SourceRootId) -> Arc<[CrateId]>;
}

Expand Down
16 changes: 13 additions & 3 deletions src/tools/rust-analyzer/crates/flycheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ impl FlycheckHandle {
config: FlycheckConfig,
sysroot_root: Option<AbsPathBuf>,
workspace_root: AbsPathBuf,
manifest_path: Option<AbsPathBuf>,
) -> FlycheckHandle {
let actor = FlycheckActor::new(id, sender, config, sysroot_root, workspace_root);
let actor =
FlycheckActor::new(id, sender, config, sysroot_root, workspace_root, manifest_path);
let (sender, receiver) = unbounded::<StateChange>();
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
.name("Flycheck".to_owned())
Expand Down Expand Up @@ -205,6 +207,7 @@ struct FlycheckActor {
id: usize,
sender: Box<dyn Fn(Message) + Send>,
config: FlycheckConfig,
manifest_path: Option<AbsPathBuf>,
/// Either the workspace root of the workspace we are flychecking,
/// or the project root of the project.
root: AbsPathBuf,
Expand Down Expand Up @@ -233,6 +236,7 @@ impl FlycheckActor {
config: FlycheckConfig,
sysroot_root: Option<AbsPathBuf>,
workspace_root: AbsPathBuf,
manifest_path: Option<AbsPathBuf>,
) -> FlycheckActor {
tracing::info!(%id, ?workspace_root, "Spawning flycheck");
FlycheckActor {
Expand All @@ -241,6 +245,7 @@ impl FlycheckActor {
config,
sysroot_root,
root: workspace_root,
manifest_path,
command_handle: None,
command_receiver: None,
}
Expand Down Expand Up @@ -388,8 +393,13 @@ impl FlycheckActor {
"--message-format=json"
});

cmd.arg("--manifest-path");
cmd.arg(self.root.join("Cargo.toml"));
if let Some(manifest_path) = &self.manifest_path {
cmd.arg("--manifest-path");
cmd.arg(manifest_path);
if manifest_path.extension().map_or(false, |ext| ext == "rs") {
cmd.arg("-Zscript");
}
}

options.apply_on_command(&mut cmd);
(cmd, options.extra_args.clone())
Expand Down
80 changes: 41 additions & 39 deletions src/tools/rust-analyzer/crates/hir-def/src/body/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1869,42 +1869,45 @@ impl ExprCollector<'_> {
) -> ExprId {
match count {
Some(FormatCount::Literal(n)) => {
match LangItem::FormatCount.ty_rel_path(self.db, self.krate, name![Is]) {
Some(count_is) => {
let count_is = self.alloc_expr_desugared(Expr::Path(count_is));
let args = self.alloc_expr_desugared(Expr::Literal(Literal::Uint(
*n as u128,
Some(BuiltinUint::Usize),
)));
self.alloc_expr_desugared(Expr::Call {
callee: count_is,
args: Box::new([args]),
is_assignee_expr: false,
})
}
None => self.missing_expr(),
}
let args = self.alloc_expr_desugared(Expr::Literal(Literal::Uint(
*n as u128,
Some(BuiltinUint::Usize),
)));
let count_is =
match LangItem::FormatCount.ty_rel_path(self.db, self.krate, name![Is]) {
Some(count_is) => self.alloc_expr_desugared(Expr::Path(count_is)),
None => self.missing_expr(),
};
self.alloc_expr_desugared(Expr::Call {
callee: count_is,
args: Box::new([args]),
is_assignee_expr: false,
})
}
Some(FormatCount::Argument(arg)) => {
if let Ok(arg_index) = arg.index {
let (i, _) = argmap.insert_full((arg_index, ArgumentType::Usize));

match LangItem::FormatCount.ty_rel_path(self.db, self.krate, name![Param]) {
Some(count_param) => {
let count_param = self.alloc_expr_desugared(Expr::Path(count_param));
let args = self.alloc_expr_desugared(Expr::Literal(Literal::Uint(
i as u128,
Some(BuiltinUint::Usize),
)));
self.alloc_expr_desugared(Expr::Call {
callee: count_param,
args: Box::new([args]),
is_assignee_expr: false,
})
}
let args = self.alloc_expr_desugared(Expr::Literal(Literal::Uint(
i as u128,
Some(BuiltinUint::Usize),
)));
let count_param = match LangItem::FormatCount.ty_rel_path(
self.db,
self.krate,
name![Param],
) {
Some(count_param) => self.alloc_expr_desugared(Expr::Path(count_param)),
None => self.missing_expr(),
}
};
self.alloc_expr_desugared(Expr::Call {
callee: count_param,
args: Box::new([args]),
is_assignee_expr: false,
})
} else {
// FIXME: This drops arg causing it to potentially not be resolved/type checked
// when typing?
self.missing_expr()
}
}
Expand All @@ -1925,7 +1928,8 @@ impl ExprCollector<'_> {
fn make_argument(&mut self, arg: ExprId, ty: ArgumentType) -> ExprId {
use ArgumentType::*;
use FormatTrait::*;
match LangItem::FormatArgument.ty_rel_path(

let new_fn = match LangItem::FormatArgument.ty_rel_path(
self.db,
self.krate,
match ty {
Expand All @@ -1941,16 +1945,14 @@ impl ExprCollector<'_> {
Usize => name![from_usize],
},
) {
Some(new_fn) => {
let new_fn = self.alloc_expr_desugared(Expr::Path(new_fn));
self.alloc_expr_desugared(Expr::Call {
callee: new_fn,
args: Box::new([arg]),
is_assignee_expr: false,
})
}
Some(new_fn) => self.alloc_expr_desugared(Expr::Path(new_fn)),
None => self.missing_expr(),
}
};
self.alloc_expr_desugared(Expr::Call {
callee: new_fn,
args: Box::new([arg]),
is_assignee_expr: false,
})
}
// endregion: format
}
Expand Down
Loading
Loading