Skip to content

Commit 5d79874

Browse files
authored
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`
2 parents b232c46 + 696d503 commit 5d79874

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_lint/src/internal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
108108
lint.build(&format!("usage of qualified `ty::{}`", t))
109109
.span_suggestion(
110110
path.span,
111-
"try using it unqualified",
111+
"try importing it and using it unqualified",
112112
t,
113113
// The import probably needs to be changed
114114
Applicability::MaybeIncorrect,

src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: usage of qualified `ty::Ty<'_>`
22
--> $DIR/qualified_ty_ty_ctxt.rs:25:11
33
|
44
LL | ty_q: ty::Ty<'_>,
5-
| ^^^^^^^^^^ help: try using it unqualified: `Ty<'_>`
5+
| ^^^^^^^^^^ help: try importing it and using it unqualified: `Ty<'_>`
66
|
77
note: the lint level is defined here
88
--> $DIR/qualified_ty_ty_ctxt.rs:4:9
@@ -14,7 +14,7 @@ error: usage of qualified `ty::TyCtxt<'_>`
1414
--> $DIR/qualified_ty_ty_ctxt.rs:27:16
1515
|
1616
LL | ty_ctxt_q: ty::TyCtxt<'_>,
17-
| ^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_>`
17+
| ^^^^^^^^^^^^^^ help: try importing it and using it unqualified: `TyCtxt<'_>`
1818

1919
error: aborting due to 2 previous errors
2020

0 commit comments

Comments
 (0)