Skip to content

Commit 43f0014

Browse files
committedMar 25, 2025·
Auto merge of rust-lang#138933 - matthiaskrgr:rollup-sjtqkoq, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#135745 (Recognise new IPv6 non-global range from IETF RFC 9602) - rust-lang#137247 (cg_llvm: Reduce the visibility of types, modules and using declarations in `rustc_codegen_llvm`.) - rust-lang#138317 (privacy: Visit types and traits in impls in type privacy lints) - rust-lang#138581 (Abort in deadlock handler if we fail to get a query map) - rust-lang#138776 (coverage: Separate span-extraction from unexpansion) - rust-lang#138886 (Fix autofix for `self` and `self as …` in `unused_imports` lint) - rust-lang#138924 (Reduce `kw::Empty` usage, part 3) - rust-lang#138929 (Visitors track whether an assoc item is in a trait impl or an inherent impl) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 40507bd + 1107fc7 commit 43f0014

File tree

51 files changed

+683
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+683
-395
lines changed
 

‎compiler/rustc_ast/src/mut_visit.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,9 @@ impl WalkItemKind for ItemKind {
13181318
visit_polarity(vis, polarity);
13191319
visit_opt(of_trait, |trait_ref| vis.visit_trait_ref(trait_ref));
13201320
vis.visit_ty(self_ty);
1321-
items.flat_map_in_place(|item| vis.flat_map_assoc_item(item, AssocCtxt::Impl));
1321+
items.flat_map_in_place(|item| {
1322+
vis.flat_map_assoc_item(item, AssocCtxt::Impl { of_trait: of_trait.is_some() })
1323+
});
13221324
}
13231325
ItemKind::Trait(box Trait { safety, is_auto: _, generics, bounds, items }) => {
13241326
visit_safety(vis, safety);

‎compiler/rustc_ast/src/visit.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::ptr::P;
2323
#[derive(Copy, Clone, Debug, PartialEq)]
2424
pub enum AssocCtxt {
2525
Trait,
26-
Impl,
26+
Impl { of_trait: bool },
2727
}
2828

2929
#[derive(Copy, Clone, Debug, PartialEq)]
@@ -422,7 +422,12 @@ impl WalkItemKind for ItemKind {
422422
try_visit!(visitor.visit_generics(generics));
423423
visit_opt!(visitor, visit_trait_ref, of_trait);
424424
try_visit!(visitor.visit_ty(self_ty));
425-
walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Impl);
425+
walk_list!(
426+
visitor,
427+
visit_assoc_item,
428+
items,
429+
AssocCtxt::Impl { of_trait: of_trait.is_some() }
430+
);
426431
}
427432
ItemKind::Struct(struct_definition, generics)
428433
| ItemKind::Union(struct_definition, generics) => {

0 commit comments

Comments
 (0)
Please sign in to comment.