diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index d7fc028287ff5..a9e3d33e9802a 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -677,6 +677,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { { if binding.res() != Res::Err && glob_binding.res() != Res::Err + && binding.res() != glob_binding.res() // Only warn if they're different items && let NameBindingKind::Import { import: glob_import, .. } = glob_binding.kind && let Some(glob_import_id) = glob_import.id() diff --git a/tests/ui/lint/hidden-glob-reexports-issue-146164.rs b/tests/ui/lint/hidden-glob-reexports-issue-146164.rs new file mode 100644 index 0000000000000..fb20f6700b76f --- /dev/null +++ b/tests/ui/lint/hidden-glob-reexports-issue-146164.rs @@ -0,0 +1,10 @@ +//@ check-pass +// Test that hidden_glob_reexports lint doesn't warn when importing the same item +// that's already available through a glob re-export + +pub use std::option::*; +use std::option::Option; + +fn main() { + let _x: Option = Some(42); +}

AltStyle によって変換されたページ (->オリジナル) /