-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #109212 - Ezrashaw:no-similar-sugg-for-unstable, r=es…
…tebank fix: don't suggest similar method when unstable Fixes #109177 Don't display typo suggestions for unstable things, unless the feature flag is enabled. AFAIK, there are two places this occurs: - `rustc_resolve`: before type checking, effectively just `FnCtxt::Free`. - `rustc_hir_typck`: during type checking, for `FnCtxt::Assoc(..)`s. The linked issue is about the latter, obviously the issue is applicable to both. r? `@estebank`
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/ui/stability-attribute/auxiliary/similar-unstable-method.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![feature(staged_api)] | ||
#![stable(feature = "libfoo", since = "1.0.0")] | ||
|
||
#[unstable(feature = "foo", reason = "...", issue = "none")] | ||
pub fn foo() {} | ||
|
||
#[stable(feature = "libfoo", since = "1.0.0")] | ||
pub struct Foo; | ||
|
||
impl Foo { | ||
#[unstable(feature = "foo", reason = "...", issue = "none")] | ||
pub fn foo(&self) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// aux-build: similar-unstable-method.rs | ||
|
||
extern crate similar_unstable_method; | ||
|
||
fn main() { | ||
// FIXME: this function should not suggest the `foo` function. | ||
similar_unstable_method::foo1(); | ||
//~^ ERROR cannot find function `foo1` in crate `similar_unstable_method` [E0425] | ||
|
||
let foo = similar_unstable_method::Foo; | ||
foo.foo1(); | ||
//~^ ERROR no method named `foo1` found for struct `Foo` in the current scope [E0599] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0425]: cannot find function `foo1` in crate `similar_unstable_method` | ||
--> $DIR/issue-109177.rs:7:30 | ||
| | ||
LL | similar_unstable_method::foo1(); | ||
| ^^^^ help: a function with a similar name exists: `foo` | ||
| | ||
::: $DIR/auxiliary/similar-unstable-method.rs:5:1 | ||
| | ||
LL | pub fn foo() {} | ||
| ------------ similarly named function `foo` defined here | ||
|
||
error[E0599]: no method named `foo1` found for struct `Foo` in the current scope | ||
--> $DIR/issue-109177.rs:11:9 | ||
| | ||
LL | foo.foo1(); | ||
| ^^^^ method not found in `Foo` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0425, E0599. | ||
For more information about an error, try `rustc --explain E0425`. |