diff options
| author | bors <bors@rust-lang.org> | 2024-04-29 14:01:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-29 14:01:42 +0000 |
| commit | 9b00956e56009bab2aa15d7bff10916599e3d6d6 (patch) | |
| tree | 47ac998e48319f9df56e8200e538738a030e6a2e /compiler/rustc_resolve | |
| parent | 15adfb9cd5b029268e1470a41391d91859b0a1f8 (diff) | |
| parent | 0d61eaea5977143b7809b5a8f9e03e8d5c439870 (diff) | |
| download | rust-1.78.0.tar.gz rust-1.78.0.zip | |
Auto merge of #124517 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.78.0
[stable] 1.78 (round 2) This backports "Don't trigger `unused_qualifications` on global paths" (https://github.com/rust-lang/rust/pull/122435). r? `@Mark-Simulacrum`
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 837c069b599..c661be3587e 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4665,6 +4665,13 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { } fn lint_unused_qualifications(&mut self, path: &[Segment], ns: Namespace, finalize: Finalize) { + // Don't lint on global paths because the user explicitly wrote out the full path. + if let Some(seg) = path.first() + && seg.ident.name == kw::PathRoot + { + return; + } + if path.iter().any(|seg| seg.ident.span.from_expansion()) { return; } |
