1
Fork 0

fix(resolve): update the ambiguity glob binding as warning recursively

This commit is contained in:
bohan 2023-07-26 22:46:49 +08:00
parent 317ec04d18
commit cac0bd0bef
65 changed files with 1532 additions and 56 deletions

View file

@ -3316,6 +3316,7 @@ declare_lint_pass! {
// tidy-alphabetical-start
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
AMBIGUOUS_ASSOCIATED_ITEMS,
AMBIGUOUS_GLOB_IMPORTS,
AMBIGUOUS_GLOB_REEXPORTS,
ARITHMETIC_OVERFLOW,
ASM_SUB_REGISTER,
@ -4405,3 +4406,46 @@ declare_lint! {
Warn,
"unrecognized diagnostic attribute"
}
declare_lint! {
/// The `ambiguous_glob_imports` lint detects glob imports that should report ambiguity
/// errors, but previously didn't do that due to rustc bugs.
///
/// ### Example
///
/// ```rust,compile_fail
///
/// #![deny(ambiguous_glob_imports)]
/// pub fn foo() -> u32 {
/// use sub::*;
/// C
/// }
///
/// mod sub {
/// mod mod1 { pub const C: u32 = 1; }
/// mod mod2 { pub const C: u32 = 2; }
///
/// pub use mod1::*;
/// pub use mod2::*;
/// }
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// Previous versions of Rust compile it successfully because it
/// had lost the ambiguity error when resolve `use sub::mod2::*`.
///
/// This is a [future-incompatible] lint to transition this to a
/// hard error in the future.
///
/// [future-incompatible]: ../index.md#future-incompatible-lints
pub AMBIGUOUS_GLOB_IMPORTS,
Warn,
"detects certain glob imports that require reporting an ambiguity error",
@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::FutureReleaseError,
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
};
}