Skip to content

Subtree update of rust-analyzer #142250

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 62 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
47d9534
Produce ClosureBinder node in atom.rs
aibaars May 30, 2025
d3a7d1c
Add test for closure_binder
aibaars May 30, 2025
bd71e6c
Run 'cargo codegen' to update tests
aibaars May 30, 2025
ca48112
Update expected test output
aibaars May 30, 2025
e3d26cd
Allow assist edit for converting structs to appear also on struct key…
BazookaMusic May 31, 2025
a241d8e
add missing public keyword
BazookaMusic May 31, 2025
01837bc
Formatting issues resolved
BazookaMusic May 31, 2025
b34e36b
rename function so it makes more sense
BazookaMusic May 31, 2025
4f018d8
clippy and more formatting
BazookaMusic May 31, 2025
6a44c01
Merge pull request #19897 from aibaars/patch-2
Veykril Jun 2, 2025
d964f5d
internal: Use 'ProjectJson' consistently
Wilfred Jun 2, 2025
1099b63
Merge pull request #19904 from Wilfred/project_json_naming
Veykril Jun 2, 2025
4d7b1a4
Enhance renaming to include identifiers that are generated from the o…
Veykril May 30, 2025
4c1f3c6
fix: Fix edition handling for names in rename logic
Veykril May 30, 2025
a18f232
Support derive-macros for rename prefix magic
Veykril Jun 2, 2025
23f79c1
Merge pull request #19893 from Veykril/push-wzqsompmnlmx
Veykril Jun 2, 2025
3f0df08
fix: don't duplicate must_use for functions and traits
rmehri01 Jun 2, 2025
d122bd4
simplify expression that checks the offset
BazookaMusic Jun 2, 2025
59fe399
feat: implement completion for diagnostic module
rmehri01 Jun 2, 2025
ddcc1af
fix: Cycle handlers for `HirDatabase::infer, const_param_ty_with_diag…
ShoyuVanilla May 30, 2025
e323eae
Add a quickfix for accessing a private field of a struct
MatrixFrog May 26, 2025
ae8e361
Merge pull request #19901 from BazookaMusic/master
Veykril Jun 3, 2025
e179d2b
Merge pull request #19894 from ShoyuVanilla/some-query-cycles
Veykril Jun 3, 2025
2ada018
Merge pull request #19869 from MatrixFrog/publicize_field
Veykril Jun 3, 2025
1cefc21
chore(deps): bump tar-fs from 2.1.2 to 2.1.3 in /editors/code
dependabot[bot] Jun 3, 2025
840142b
ci: Pin `cargo-workspaces` to `0.3.6`
ShoyuVanilla Jun 3, 2025
32297bd
hir-ty: add incremental tests checking for `infer` invalidation
davidbarsky Jun 3, 2025
e5fb11a
Merge pull request #19915 from ShoyuVanilla/publish-libs-crash
lnicola Jun 4, 2025
cd38deb
ci: When autopublishing, remove `xtask` from workspace
ShoyuVanilla Jun 4, 2025
8f5d007
Merge pull request #19919 from ShoyuVanilla/patch-1
lnicola Jun 4, 2025
d61d0f7
fix: Typo mistake in autopublish workflow
ShoyuVanilla Jun 4, 2025
b02d034
Merge pull request #19920 from ShoyuVanilla/patch-2
lnicola Jun 4, 2025
4e85d77
ci: Pin `cargo-workspaces` version to `0.3.6`, again
ShoyuVanilla Jun 4, 2025
f97317a
Merge pull request #19921 from ShoyuVanilla/ci-retry
lnicola Jun 4, 2025
2163766
Merge pull request #19914 from davidbarsky/davidbarsky/add-some-addit…
Veykril Jun 4, 2025
e07199a
Merge pull request #19913 from rust-lang/dependabot/npm_and_yarn/edit…
lnicola Jun 4, 2025
c1e3da3
Remove unnecessary parameters in inlay-hint computation
Veykril Jun 3, 2025
25cef03
Give path segment type anchors their own grammar rule
Veykril Jun 4, 2025
efa88e5
feat: Add `dyn` keyword inlay hints
Veykril Jun 4, 2025
fd269a0
Merge pull request #19922 from Veykril/push-oxyomxrsplpx
Veykril Jun 4, 2025
13d71f7
refactor: Cleanup descension stuff
Veykril Jun 2, 2025
746a6fc
Merge pull request #19905 from Veykril/push-unwwyqpwqxky
Veykril Jun 4, 2025
c5355a1
match on segments of path and some small cleanup
rmehri01 Jun 4, 2025
53ef69e
add qualifiers to attribute completions
rmehri01 Jun 4, 2025
77b0d3e
Deduplicate code in proc-macro-srv
Veykril Jun 5, 2025
957e649
Merge pull request #19928 from Veykril/push-kznpuqllrvvq
Veykril Jun 5, 2025
129d568
fix: Record macro calls in signatures in `ChildBySource` impls
Veykril Jun 5, 2025
929f82a
Merge pull request #19932 from Veykril/push-skzlyntpxpsw
Veykril Jun 5, 2025
1de4972
Better parser recovery for macro calls in type bound position
Veykril Jun 5, 2025
d2c0de2
Merge pull request #19933 from Veykril/push-uyxorpyvnzsl
Veykril Jun 5, 2025
0713466
Always include quickfixes for diagnostics, even when diagnostics are …
ChayimFriedman2 Jun 6, 2025
903a0db
Stabilize unlinked file diagnostic
ChayimFriedman2 Jun 6, 2025
e90b3fb
fix: Record macro calls for fields in `ChildBySource` impls
Veykril Jun 6, 2025
c8b0b08
Merge pull request #19936 from ChayimFriedman2/unlinked-file-stable
Veykril Jun 6, 2025
98a4508
Merge pull request #19935 from ChayimFriedman2/exp-diag-show-quickfix
Veykril Jun 6, 2025
337c2d9
Merge pull request #19937 from Veykril/push-rvnylnlnxxyr
Veykril Jun 6, 2025
3bae562
Merge pull request #19908 from rmehri01/rmehri01/diagnostic_attribute…
Veykril Jun 6, 2025
814b9a1
Stabilize the "JSON is not Rust" diagnostic
ChayimFriedman2 Jun 8, 2025
37c8788
Merge pull request #19949 from ChayimFriedman2/stabilize-json
ChayimFriedman2 Jun 8, 2025
cbe6fe8
Preparing for merge from rust-lang/rust
lnicola Jun 9, 2025
88223c5
Merge from rust-lang/rust
lnicola Jun 9, 2025
f5bfde2
Merge pull request #19954 from lnicola/sync-from-rust
lnicola Jun 9, 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/autopublish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: rustup update --no-self-update stable

- name: Install cargo-workspaces
run: cargo install cargo-workspaces
run: cargo install cargo-workspaces --version "0.3.6"

- name: Publish Crates
env:
Expand All @@ -54,8 +54,8 @@ jobs:
cargo workspaces rename --from project-model project_model
cargo workspaces rename --from test-fixture test_fixture
cargo workspaces rename --from test-utils test_utils
# Remove library crates from the workspaces so we don't auto-publish them as well
sed -i 's/ "lib\/\*",//' ./Cargo.toml
# Remove library crates and xtask from the workspaces so we don't auto-publish them as well
sed -i 's|^members = .*$|members = ["crates/*"]|' Cargo.toml
cargo workspaces rename ra_ap_%n
find crates/rust-analyzer -type f -name '*.rs' -exec sed -i 's/rust_analyzer/ra_ap_rust_analyzer/g' {} +
cargo workspaces publish --yes --force '*' --exact --no-git-commit --allow-dirty --skip-published custom 0.0.$(($RUN_NUMBER + 133))
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: rustup update --no-self-update stable

- name: Install cargo-workspaces
run: cargo install cargo-workspaces
run: cargo install cargo-workspaces --version "0.3.6"

- name: Publish Crates
env:
Expand Down
2 changes: 2 additions & 0 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ smol_str.opt-level = 3
text-size.opt-level = 3
serde.opt-level = 3
salsa.opt-level = 3
dissimilar.opt-level = 3

# This speeds up `cargo xtask dist`.
miniz_oxide.opt-level = 3

Expand Down
10 changes: 8 additions & 2 deletions src/tools/rust-analyzer/crates/hir-def/src/dyn_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ pub mod keys {
pub const PROC_MACRO: Key<ast::Fn, ProcMacroId> = Key::new();
pub const MACRO_CALL: Key<ast::MacroCall, MacroCallId> = Key::new();
pub const ATTR_MACRO_CALL: Key<ast::Item, MacroCallId> = Key::new();
pub const DERIVE_MACRO_CALL: Key<ast::Attr, (AttrId, MacroCallId, Box<[Option<MacroCallId>]>)> =
Key::new();
pub const DERIVE_MACRO_CALL: Key<
ast::Attr,
(
AttrId,
/* derive() */ MacroCallId,
/* actual derive macros */ Box<[Option<MacroCallId>]>,
),
> = Key::new();

/// XXX: AST Nodes and SyntaxNodes have identity equality semantics: nodes are
/// equal if they point to exactly the same object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,12 @@ pub fn new() {
// [email protected]
// [email protected]
// [email protected]
// [email protected] "<"
// [email protected]
// [email protected] "("
// [email protected]
// [email protected] "8"
// [email protected]
// [email protected] "<"
// [email protected]
// [email protected] "("
// [email protected]
// [email protected] "8"
// [email protected] "+"
// [email protected]
// [email protected]
Expand Down
2 changes: 2 additions & 0 deletions src/tools/rust-analyzer/crates/hir-ty/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use crate::{
#[query_group::query_group]
pub trait HirDatabase: DefDatabase + std::fmt::Debug {
#[salsa::invoke(crate::infer::infer_query)]
#[salsa::cycle(cycle_result = crate::infer::infer_cycle_result)]
fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;

// region:mir
Expand Down Expand Up @@ -132,6 +133,7 @@ pub trait HirDatabase: DefDatabase + std::fmt::Debug {

// FIXME: Make this a non-interned query.
#[salsa::invoke_interned(crate::lower::const_param_ty_with_diagnostics_query)]
#[salsa::cycle(cycle_result = crate::lower::const_param_ty_with_diagnostics_cycle_result)]
fn const_param_ty_with_diagnostics(&self, def: ConstParamId) -> (Ty, Diagnostics);

#[salsa::invoke(crate::lower::const_param_ty_query)]
Expand Down
12 changes: 10 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ use chalk_ir::{
use either::Either;
use hir_def::{
AdtId, AssocItemId, ConstId, DefWithBodyId, FieldId, FunctionId, GenericDefId, GenericParamId,
ImplId, ItemContainerId, Lookup, TraitId, TupleFieldId, TupleId, TypeAliasId, VariantId,
ImplId, ItemContainerId, LocalFieldId, Lookup, TraitId, TupleFieldId, TupleId, TypeAliasId,
VariantId,
builtin_type::{BuiltinInt, BuiltinType, BuiltinUint},
expr_store::{Body, ExpressionStore, HygieneId, path::Path},
hir::{BindingAnnotation, BindingId, ExprId, ExprOrPatId, LabelId, PatId},
Expand Down Expand Up @@ -135,6 +136,10 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
Arc::new(ctx.resolve_all())
}

pub(crate) fn infer_cycle_result(_: &dyn HirDatabase, _: DefWithBodyId) -> Arc<InferenceResult> {
Arc::new(InferenceResult { has_errors: true, ..Default::default() })
}

/// Fully normalize all the types found within `ty` in context of `owner` body definition.
///
/// This is appropriate to use only after type-check: it assumes
Expand Down Expand Up @@ -203,7 +208,7 @@ pub(crate) type InferResult<T> = Result<InferOk<T>, TypeError>;
pub enum InferenceDiagnostic {
NoSuchField {
field: ExprOrPatId,
private: bool,
private: Option<LocalFieldId>,
variant: VariantId,
},
PrivateField {
Expand Down Expand Up @@ -558,6 +563,9 @@ impl InferenceResult {
ExprOrPatId::PatId(id) => self.type_of_pat.get(id),
}
}
pub fn is_erroneous(&self) -> bool {
self.has_errors && self.type_of_expr.iter().count() == 0
}
}

impl Index<ExprId> for InferenceResult {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/infer/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ impl InferenceContext<'_> {
self.push_diagnostic(
InferenceDiagnostic::NoSuchField {
field: field.expr.into(),
private: true,
private: Some(local_id),
variant: def,
},
);
Expand All @@ -564,7 +564,7 @@ impl InferenceContext<'_> {
None => {
self.push_diagnostic(InferenceDiagnostic::NoSuchField {
field: field.expr.into(),
private: false,
private: None,
variant: def,
});
None
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/infer/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl InferenceContext<'_> {
{
self.push_diagnostic(InferenceDiagnostic::NoSuchField {
field: inner.into(),
private: true,
private: Some(local_id),
variant: def,
});
}
Expand All @@ -157,7 +157,7 @@ impl InferenceContext<'_> {
None => {
self.push_diagnostic(InferenceDiagnostic::NoSuchField {
field: inner.into(),
private: false,
private: None,
variant: def,
});
self.err_ty()
Expand Down
20 changes: 14 additions & 6 deletions src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,14 @@ pub(crate) fn impl_self_ty_with_diagnostics_query(
)
}

pub(crate) fn impl_self_ty_with_diagnostics_cycle_result(
db: &dyn HirDatabase,
impl_id: ImplId,
) -> (Binders<Ty>, Diagnostics) {
let generics = generics(db, impl_id.into());
(make_binders(db, &generics, TyKind::Error.intern(Interner)), None)
}

pub(crate) fn const_param_ty_query(db: &dyn HirDatabase, def: ConstParamId) -> Ty {
db.const_param_ty_with_diagnostics(def).0
}
Expand Down Expand Up @@ -1633,12 +1641,12 @@ pub(crate) fn const_param_ty_with_diagnostics_query(
(ty, create_diagnostics(ctx.diagnostics))
}

pub(crate) fn impl_self_ty_with_diagnostics_cycle_result(
db: &dyn HirDatabase,
impl_id: ImplId,
) -> (Binders<Ty>, Diagnostics) {
let generics = generics(db, impl_id.into());
(make_binders(db, &generics, TyKind::Error.intern(Interner)), None)
pub(crate) fn const_param_ty_with_diagnostics_cycle_result(
_: &dyn HirDatabase,
_: crate::db::HirDatabaseData,
_: ConstParamId,
) -> (Ty, Diagnostics) {
(TyKind::Error.intern(Interner), None)
}

pub(crate) fn impl_trait_query(db: &dyn HirDatabase, impl_id: ImplId) -> Option<Binders<TraitRef>> {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@ pub fn lower_to_mir(
// need to take this input explicitly.
root_expr: ExprId,
) -> Result<MirBody> {
if infer.type_mismatches().next().is_some() {
if infer.type_mismatches().next().is_some() || infer.is_erroneous() {
return Err(MirLowerError::HasErrors);
}
let mut ctx = MirLowerCtx::new(db, owner, body, infer);
Expand Down
Loading
Loading