Skip to content

Commit ed34354

Browse files
committed
Do not lint unresolved trait for ineffective unstable trait impl
1 parent bd4a96a commit ed34354

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

compiler/rustc_passes/src/stability.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
748748
let mut c = CheckTraitImplStable { tcx: self.tcx, fully_stable: true };
749749
c.visit_ty(self_ty);
750750
c.visit_trait_ref(t);
751-
if c.fully_stable {
751+
752+
// do not lint when the trait isn't resolved, since resolution error should
753+
// be fixed first
754+
if t.path.res != Res::Err && c.fully_stable {
752755
self.tcx.struct_span_lint_hir(
753756
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
754757
item.hir_id(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(staged_api)]
2+
#![stable(feature = "uwu", since = "1.0.0")]
3+
4+
#[unstable(feature = "foo", issue = "none")]
5+
impl Foo for () {}
6+
//~^ ERROR cannot find trait `Foo` in this scope
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0405]: cannot find trait `Foo` in this scope
2+
--> $DIR/unresolved_stability_lint.rs:5:6
3+
|
4+
LL | impl Foo for () {}
5+
| ^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0405`.

0 commit comments

Comments
 (0)