mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Replace TyCtxt::node_lint call with TyCtxt::emit_node_lint in rustc_hir_typeck
This commit is contained in:
@@ -736,12 +736,18 @@ fn lint_ambiguously_glob_imported_traits(
|
||||
let trait_name = self.tcx.item_name(pick.item.container_id(self.tcx));
|
||||
let import_span = self.tcx.hir_span_if_local(pick.import_ids[0].to_def_id()).unwrap();
|
||||
|
||||
self.tcx.node_lint(AMBIGUOUS_GLOB_IMPORTED_TRAITS, segment.hir_id, |diag| {
|
||||
diag.primary_message(format!("Use of ambiguously glob imported trait `{trait_name}`"))
|
||||
self.tcx.emit_node_lint(
|
||||
AMBIGUOUS_GLOB_IMPORTED_TRAITS,
|
||||
segment.hir_id,
|
||||
rustc_errors::DiagDecorator(|diag| {
|
||||
diag.primary_message(format!(
|
||||
"Use of ambiguously glob imported trait `{trait_name}`"
|
||||
))
|
||||
.span(segment.ident.span)
|
||||
.span_label(import_span, format!("`{trait_name}` imported ambiguously here"))
|
||||
.help(format!("Import `{trait_name}` explicitly"));
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
fn upcast(
|
||||
|
||||
@@ -7,9 +7,9 @@ LL | use m2::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
= note: `#[warn(ambiguous_glob_imported_traits)]` (part of `#[warn(future_incompatible)]`) on by default
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
@@ -49,9 +49,9 @@ LL | use m2::*;
|
||||
LL | 0u8.method2();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
warning: Use of ambiguously glob imported trait `Trait`
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:49:9
|
||||
@@ -62,9 +62,9 @@ LL | use m2_reexport::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:51:9
|
||||
@@ -88,9 +88,9 @@ LL | use ambig_reexport::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:58:9
|
||||
@@ -115,9 +115,9 @@ LL | use external::m2::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:66:9
|
||||
@@ -142,9 +142,9 @@ LL | use external::m2_reexport::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:74:9
|
||||
@@ -168,9 +168,9 @@ LL | use external::ambig_reexport::*;
|
||||
LL | 0u8.method1();
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: Import `Trait` explicitly
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #147992 <https://github.com/rust-lang/rust/issues/147992>
|
||||
= help: Import `Trait` explicitly
|
||||
|
||||
error[E0599]: no method named `method2` found for type `u8` in the current scope
|
||||
--> $DIR/ambiguous-trait-in-scope.rs:81:9
|
||||
|
||||
Reference in New Issue
Block a user