Skip to content

Commit 34c80e4

Browse files
committed
Surpress suggestion from unstable items on stable channel
1 parent c871d09 commit 34c80e4

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16091609
}
16101610
}
16111611

1612+
suggestions.retain(|suggestion| suggestion.is_stable || self.tcx.sess.is_nightly_build());
16121613
suggestions
16131614
}
16141615

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0433]: failed to resolve: use of undeclared type `Complete`
2+
--> $DIR/suggest-unresolve-149402.rs:7:12
3+
|
4+
LL | x.push(Complete::Item { name: "hello" });
5+
| ^^^^^^^^ use of undeclared type `Complete`
6+
|
7+
help: there is an enum variant `std::ops::CoroutineState::Complete`; try using the variant's enum
8+
|
9+
LL - x.push(Complete::Item { name: "hello" });
10+
LL + x.push(std::ops::CoroutineState::Item { name: "hello" });
11+
|
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0433`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ revisions: stable nightly
2+
//@ [nightly] only-nightly
3+
//@ [stable] only-stable
4+
5+
fn foo() {
6+
let x = Vec::new();
7+
x.push(Complete::Item { name: "hello" });
8+
//~^ ERROR failed to resolve: use of undeclared type `Complete`
9+
}
10+
11+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0433]: failed to resolve: use of undeclared type `Complete`
2+
--> $DIR/suggest-unresolve-149402.rs:7:12
3+
|
4+
LL | x.push(Complete::Item { name: "hello" });
5+
| ^^^^^^^^ use of undeclared type `Complete`
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)