Skip to content

Commit

Permalink
Unrolled build for rust-lang#122545
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#122545 - Alexendoo:unused-qualifications, r=petrochenkov

Ignore paths from expansion in `unused_qualifications`

If any of the path segments are from an expansion the lint is skipped currently, but a path from an expansion where all of the segments are passed in would not be. Doesn't seem that likely to occur but it could happen
  • Loading branch information
rust-timer authored Mar 21, 2024
2 parents 6ec953c + a845246 commit f9b0e58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4672,7 +4672,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
return;
}

if path.iter().any(|seg| seg.ident.span.from_expansion()) {
if finalize.path_span.from_expansion()
|| path.iter().any(|seg| seg.ident.span.from_expansion())
{
return;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn main() {
foo::bar();
foo::$b(); // issue #96698
$a::bar();
$a::$b();
} }
m!(foo, bar);
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn main() {
foo::bar();
foo::$b(); // issue #96698
$a::bar();
$a::$b();
} }
m!(foo, bar);
}
Expand Down

0 comments on commit f9b0e58

Please sign in to comment.