about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-27 22:32:28 +0100
committerGitHub <noreply@github.com>2022-01-27 22:32:28 +0100
commit5d79874e79403a1dd629ab82f5f729be2240c5bd (patch)
tree21cd219b88f0af0c818ce985396015d75a661aed
parentb232c46069a59692da015013b6c96fa6b1edc189 (diff)
parent696d5034b22eea20daaa549f3346672d26708df2 (diff)
downloadrust-5d79874e79403a1dd629ab82f5f729be2240c5bd.tar.gz
rust-5d79874e79403a1dd629ab82f5f729be2240c5bd.zip
Rollup merge of #93357 - nnethercote:clarify-usage-of-qualified-ty, r=lcnr
Clarify the `usage-of-qualified-ty` error message.

I found this message confusing when I encountered it. This commit makes
it clearer that you have to import the unqualified type yourself.

r? `@lcnr`
-rw-r--r--compiler/rustc_lint/src/internal.rs2
-rw-r--r--src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 7353cd6b876..d8e1162890c 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
                                     lint.build(&format!("usage of qualified `ty::{}`", t))
                                         .span_suggestion(
                                             path.span,
-                                            "try using it unqualified",
+                                            "try importing it and using it unqualified",
                                             t,
                                             // The import probably needs to be changed
                                             Applicability::MaybeIncorrect,
diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
index 59732cd84e5..a1056cf85d3 100644
--- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
+++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
@@ -2,7 +2,7 @@ error: usage of qualified `ty::Ty<'_>`
   --> $DIR/qualified_ty_ty_ctxt.rs:25:11
    |
 LL |     ty_q: ty::Ty<'_>,
-   |           ^^^^^^^^^^ help: try using it unqualified: `Ty<'_>`
+   |           ^^^^^^^^^^ help: try importing it and using it unqualified: `Ty<'_>`
    |
 note: the lint level is defined here
   --> $DIR/qualified_ty_ty_ctxt.rs:4:9
@@ -14,7 +14,7 @@ error: usage of qualified `ty::TyCtxt<'_>`
   --> $DIR/qualified_ty_ty_ctxt.rs:27:16
    |
 LL |     ty_ctxt_q: ty::TyCtxt<'_>,
-   |                ^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_>`
+   |                ^^^^^^^^^^^^^^ help: try importing it and using it unqualified: `TyCtxt<'_>`
 
 error: aborting due to 2 previous errors