Skip to content

Commit 5a788f0

Browse files
committed
Fix bug in TyKind lint
1 parent 9b2bf70 commit 5a788f0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/librustc/lint/internal.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Some lints that are only useful in the compiler or crates that use compiler internals, such as
22
//! Clippy.
33
4-
use crate::hir::{HirId, Path, QPath, Ty, TyKind};
4+
use crate::hir::{def::Def, HirId, Path, QPath, Ty, TyKind};
55
use crate::lint::{
66
EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass,
77
};
@@ -92,10 +92,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyKindUsage {
9292
segments: segments_iter.cloned().collect(),
9393
};
9494

95-
if let Some(def) = last.def {
96-
if def
97-
.def_id()
98-
.match_path(cx.tcx, &["rustc", "ty", "sty", "TyKind"])
95+
match last.def {
96+
Some(Def::Err) => (),
97+
Some(def)
98+
if def
99+
.def_id()
100+
.match_path(cx.tcx, &["rustc", "ty", "sty", "TyKind"]) =>
99101
{
100102
cx.struct_span_lint(
101103
USAGE_OF_TY_TYKIND,
@@ -110,6 +112,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyKindUsage {
110112
)
111113
.emit();
112114
}
115+
_ => (),
113116
}
114117
}
115118
}

0 commit comments

Comments
 (0)