Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0246980
Fix not applicable on while for replace_is_method_with_if_let_method
A4-Tacks Oct 27, 2025
e7fb68a
Properly support opaques
ChayimFriedman2 Oct 24, 2025
023c4ef
When renaming `self` to other name, change callers method method call…
ChayimFriedman2 Aug 2, 2025
ec84b26
Merge pull request #20369 from ChayimFriedman2/rename-self2
ChayimFriedman2 Oct 27, 2025
74b2a94
Consider all matches for flyimport even when searched with a qualifier
ChayimFriedman2 Oct 27, 2025
3009a73
fix: Resolve `target-dir` more precisely
ShoyuVanilla Oct 27, 2025
512abf6
Merge pull request #20919 from ChayimFriedman2/qualifier-many-flyimport
ShoyuVanilla Oct 27, 2025
506341b
Avoid calling `specializes()` query on crates that do not define `#![…
ChayimFriedman2 Oct 27, 2025
778a318
Merge pull request #20921 from ChayimFriedman2/specialization-ns2
ChayimFriedman2 Oct 27, 2025
0c108b1
perf: Reduce `client_commands` allocations in proto conversion
Veykril Oct 27, 2025
0e60684
Merge pull request #20922 from Veykril/veykril/push-pznvunxxozkq
Veykril Oct 27, 2025
540df3d
Provide an option to not show derives near the ADT for "Goto Implemen…
ChayimFriedman2 Jul 6, 2025
6aed15e
Merge pull request #20186 from ChayimFriedman2/goto-impl-no-derive
ChayimFriedman2 Oct 28, 2025
ae2818d
fix: Canonicalize flycheck output path
ShoyuVanilla Oct 28, 2025
5fc223d
Merge pull request #20915 from A4-Tacks/is-method-with-while-let
ShoyuVanilla Oct 28, 2025
a6f4d1d
Merge pull request #20906 from ChayimFriedman2/opaques-ns
ShoyuVanilla Oct 28, 2025
13834a0
Fix handling of blocks modules that are not the root module
ChayimFriedman2 Oct 28, 2025
4d338cb
Support memory profiling with dhat
ChayimFriedman2 Oct 28, 2025
360720b
Merge pull request #20930 from ChayimFriedman2/builtin-res-block
ShoyuVanilla Oct 28, 2025
0ceb668
Show proper async function signatures in the signature help
SomeoneToIgnore Oct 27, 2025
7c62a30
Merge pull request #20931 from SomeoneToIgnore/async-signature
ChayimFriedman2 Oct 28, 2025
5f0c7c2
fix: Improve error recovery when parsing malformed function return types
Veykril Oct 29, 2025
d9c3ba7
Merge pull request #20934 from Veykril/veykril/push-qtzmsqkzntpo
Veykril Oct 29, 2025
008c60d
minor: Cleanup `map_rust_child_diagnostics` a bit
Veykril Aug 2, 2025
ad13b1a
Merge pull request #20366 from Veykril/push-lmmtrpptrxom
Veykril Oct 30, 2025
2ac9a9a
fix: Do not make false positive syntax errors on frontmatter
ShoyuVanilla Oct 30, 2025
1c07f88
Merge pull request #20942 from ShoyuVanilla/frontmatter-err
ShoyuVanilla Oct 30, 2025
fd378ce
Fix typos, backtick errors/omissions
jhpratt Oct 31, 2025
be6574b
Merge pull request #20945 from jhpratt/master
ShoyuVanilla Oct 31, 2025
7a33724
Merge pull request #20927 from ChayimFriedman2/dhat
ShoyuVanilla Oct 31, 2025
599c379
Fix building with DHAT
ChayimFriedman2 Nov 1, 2025
39cc97c
Merge pull request #20956 from ChayimFriedman2/fix-dhat
ChayimFriedman2 Nov 1, 2025
103f094
Merge pull request #20920 from ShoyuVanilla/target-dirs
ShoyuVanilla Nov 2, 2025
365798d
Fix missing other assoc items for generate_blanket_trait_impl
A4-Tacks Nov 2, 2025
449576a
Prepare for merging from rust-lang/rust
invalid-email-address Nov 3, 2025
3dae6b6
Merge ref 'c5dabe8cf798' from rust-lang/rust
invalid-email-address Nov 3, 2025
1625b1e
Merge pull request #20957 from A4-Tacks/blanket-assoc-items
ShoyuVanilla Nov 3, 2025
236b89e
Add more expression to 'in_value'
A4-Tacks Nov 3, 2025
fdaf4fa
fix: Expand literals with wrong suffixes into `LitKind::Err`
ShoyuVanilla Nov 3, 2025
f311196
fix: Canonicalize `custom-target.json` paths when fetching sysroot me…
ShoyuVanilla Nov 3, 2025
493829c
Merge pull request #20964 from ShoyuVanilla/canonicalize-tgts
Veykril Nov 3, 2025
94f3ded
Merge pull request #20963 from ShoyuVanilla/lit-suffix
Veykril Nov 3, 2025
9533fd7
Merge pull request #20961 from A4-Tacks/more-in-value
ShoyuVanilla Nov 4, 2025
9e9ea26
Add ide-assist: convert_range_for_to_while
A4-Tacks Aug 29, 2025
a925768
Add dynamic assistant description
A4-Tacks Nov 4, 2025
9cec431
Merge pull request #20565 from A4-Tacks/conv-range-for-to-while
ShoyuVanilla Nov 4, 2025
fe6abc7
Fix test name
ChayimFriedman2 Nov 4, 2025
934b58e
Merge pull request #20966 from ChayimFriedman2/fix-test-name
ChayimFriedman2 Nov 4, 2025
d81d5f0
Fix test URL
lnicola Nov 4, 2025
5873327
Merge pull request #20960 from rust-lang/rustc-pull
lnicola Nov 4, 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
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/.typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ trivias = "trivias"
thir = "thir"
jod = "jod"
tructure = "tructure"
taits = "taits"

[default.extend-identifiers]
anc = "anc"
Expand Down
32 changes: 31 additions & 1 deletion src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,22 @@ dependencies = [
"syn",
]

[[package]]
name = "dhat"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98cd11d84628e233de0ce467de10b8633f4ddaecafadefc86e13b84b8739b827"
dependencies = [
"backtrace",
"lazy_static",
"mintex",
"parking_lot",
"rustc-hash 1.1.0",
"serde",
"serde_json",
"thousands",
]

[[package]]
name = "dirs"
version = "6.0.0"
Expand Down Expand Up @@ -1383,6 +1399,12 @@ dependencies = [
"adler2",
]

[[package]]
name = "mintex"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c505b3e17ed6b70a7ed2e67fbb2c560ee327353556120d6e72f5232b6880d536"

[[package]]
name = "mio"
version = "1.1.0"
Expand Down Expand Up @@ -1452,7 +1474,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.60.2",
"windows-sys 0.61.0",
]

[[package]]
Expand Down Expand Up @@ -2011,6 +2033,7 @@ dependencies = [
"cargo_metadata 0.21.0",
"cfg",
"crossbeam-channel",
"dhat",
"dirs",
"dissimilar",
"expect-test",
Expand Down Expand Up @@ -2047,6 +2070,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"smallvec",
"stdx",
"syntax",
"syntax-bridge",
Expand Down Expand Up @@ -2528,6 +2552,12 @@ dependencies = [
"syn",
]

[[package]]
name = "thousands"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"

[[package]]
name = "thread_local"
version = "1.1.9"
Expand Down
28 changes: 11 additions & 17 deletions src/tools/rust-analyzer/crates/hir-def/src/item_tree/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,13 @@ impl<'a> Ctx<'a> {
});
match &vis {
RawVisibility::Public => RawVisibilityId::PUB,
RawVisibility::Module(path, explicitness) if path.segments().is_empty() => {
match (path.kind, explicitness) {
(PathKind::SELF, VisibilityExplicitness::Explicit) => {
RawVisibilityId::PRIV_EXPLICIT
}
(PathKind::SELF, VisibilityExplicitness::Implicit) => {
RawVisibilityId::PRIV_IMPLICIT
}
(PathKind::Crate, _) => RawVisibilityId::PUB_CRATE,
_ => RawVisibilityId(self.visibilities.insert_full(vis).0 as u32),
}
RawVisibility::PubSelf(VisibilityExplicitness::Explicit) => {
RawVisibilityId::PRIV_EXPLICIT
}
RawVisibility::PubSelf(VisibilityExplicitness::Implicit) => {
RawVisibilityId::PRIV_IMPLICIT
}
RawVisibility::PubCrate => RawVisibilityId::PUB_CRATE,
_ => RawVisibilityId(self.visibilities.insert_full(vis).0 as u32),
}
}
Expand Down Expand Up @@ -466,10 +461,7 @@ pub(crate) fn lower_use_tree(
}

fn private_vis() -> RawVisibility {
RawVisibility::Module(
Interned::new(ModPath::from_kind(PathKind::SELF)),
VisibilityExplicitness::Implicit,
)
RawVisibility::PubSelf(VisibilityExplicitness::Implicit)
}

pub(crate) fn visibility_from_ast(
Expand All @@ -486,9 +478,11 @@ pub(crate) fn visibility_from_ast(
Some(path) => path,
}
}
ast::VisibilityKind::PubCrate => ModPath::from_kind(PathKind::Crate),
ast::VisibilityKind::PubCrate => return RawVisibility::PubCrate,
ast::VisibilityKind::PubSuper => ModPath::from_kind(PathKind::Super(1)),
ast::VisibilityKind::PubSelf => ModPath::from_kind(PathKind::SELF),
ast::VisibilityKind::PubSelf => {
return RawVisibility::PubSelf(VisibilityExplicitness::Explicit);
}
ast::VisibilityKind::Pub => return RawVisibility::Public,
};
RawVisibility::Module(Interned::new(path), VisibilityExplicitness::Explicit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ macro_rules! m2 { () => ( ${invalid()} ) }

#[test]
fn test_rustc_issue_57597() {
// <https://github.com/rust-lang/rust/blob/HEAD/tests/ui/issues/issue-57597.rs>
// <https://github.com/rust-lang/rust/blob/ec2cc76/tests/ui/macros/issue-57597.rs>
check(
r#"
macro_rules! m0 { ($($($i:ident)?)+) => {}; }
Expand Down
23 changes: 11 additions & 12 deletions src/tools/rust-analyzer/crates/hir-def/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,9 @@ fn resolver_for_scope_<'db>(
if let Some(block) = scopes.block(scope) {
let def_map = block_def_map(db, block);
let local_def_map = block.lookup(db).module.only_local_def_map(db);
r = r.push_block_scope(def_map, local_def_map);
// Using `DefMap::ROOT` is okay here since inside modules other than the root,
// there can't directly be expressions.
r = r.push_block_scope(def_map, local_def_map, DefMap::ROOT);
// FIXME: This adds as many module scopes as there are blocks, but resolving in each
// already traverses all parents, so this is O(n²). I think we could only store the
// innermost module scope instead?
Expand Down Expand Up @@ -1108,12 +1110,9 @@ impl<'db> Resolver<'db> {
self,
def_map: &'db DefMap,
local_def_map: &'db LocalDefMap,
module_id: LocalModuleId,
) -> Resolver<'db> {
self.push_scope(Scope::BlockScope(ModuleItemMap {
def_map,
local_def_map,
module_id: DefMap::ROOT,
}))
self.push_scope(Scope::BlockScope(ModuleItemMap { def_map, local_def_map, module_id }))
}

fn push_expr_scope(
Expand Down Expand Up @@ -1273,7 +1272,7 @@ impl HasResolver for ModuleId {
let (mut def_map, local_def_map) = self.local_def_map(db);
let mut module_id = self.local_id;

if !self.is_block_module() {
if !self.is_within_block() {
return Resolver {
scopes: vec![],
module_scope: ModuleItemMap { def_map, local_def_map, module_id },
Expand All @@ -1283,18 +1282,18 @@ impl HasResolver for ModuleId {
let mut modules: SmallVec<[_; 1]> = smallvec![];
while let Some(parent) = def_map.parent() {
let block_def_map = mem::replace(&mut def_map, parent.def_map(db));
modules.push(block_def_map);
if !parent.is_block_module() {
module_id = parent.local_id;
let block_module_id = mem::replace(&mut module_id, parent.local_id);
modules.push((block_def_map, block_module_id));
if !parent.is_within_block() {
break;
}
}
let mut resolver = Resolver {
scopes: Vec::with_capacity(modules.len()),
module_scope: ModuleItemMap { def_map, local_def_map, module_id },
};
for def_map in modules.into_iter().rev() {
resolver = resolver.push_block_scope(def_map, local_def_map);
for (def_map, module_id) in modules.into_iter().rev() {
resolver = resolver.push_block_scope(def_map, local_def_map, module_id);
}
resolver
}
Expand Down
13 changes: 8 additions & 5 deletions src/tools/rust-analyzer/crates/hir-def/src/visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,21 @@ pub(crate) fn field_visibilities_query(

pub fn visibility_from_ast(
db: &dyn DefDatabase,
has_resolver: impl HasResolver,
has_resolver: impl HasResolver + HasModule,
ast_vis: InFile<Option<ast::Visibility>>,
) -> Visibility {
let mut span_map = None;
let raw_vis = crate::item_tree::visibility_from_ast(db, ast_vis.value, &mut |range| {
span_map.get_or_insert_with(|| db.span_map(ast_vis.file_id)).span_for_range(range).ctx
});
if raw_vis == RawVisibility::Public {
return Visibility::Public;
match raw_vis {
RawVisibility::PubSelf(explicitness) => {
Visibility::Module(has_resolver.module(db), explicitness)
}
RawVisibility::PubCrate => Visibility::PubCrate(has_resolver.krate(db)),
RawVisibility::Public => Visibility::Public,
RawVisibility::Module(..) => Visibility::resolve(db, &has_resolver.resolver(db), &raw_vis),
}

Visibility::resolve(db, &has_resolver.resolver(db), &raw_vis)
}

/// Resolve visibility of a type alias.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn autoderef<'db>(
env: Arc<TraitEnvironment<'db>>,
ty: Canonical<'db, Ty<'db>>,
) -> impl Iterator<Item = Ty<'db>> + use<'db> {
let mut table = InferenceTable::new(db, env);
let mut table = InferenceTable::new(db, env, None);
let ty = table.instantiate_canonical(ty);
let mut autoderef = Autoderef::new_no_tracking(&mut table, ty);
let mut v = Vec::new();
Expand Down
5 changes: 3 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,9 +2078,10 @@ pub fn write_visibility<'db>(
if vis_id == module_id {
// pub(self) or omitted
Ok(())
} else if root_module_id == vis_id {
} else if root_module_id == vis_id && !root_module_id.is_within_block() {
write!(f, "pub(crate) ")
} else if module_id.containing_module(f.db) == Some(vis_id) {
} else if module_id.containing_module(f.db) == Some(vis_id) && !vis_id.is_block_module()
{
write!(f, "pub(super) ")
} else {
write!(f, "pub(in ...) ")
Expand Down
Loading
Loading