resolve: Fix instability in import suggestions

This commit is contained in:
Vadim Petrochenkov 2017-07-30 02:28:30 +03:00
parent 5c71e4ef90
commit a6993d6469
5 changed files with 55 additions and 74 deletions

View file

@ -33,11 +33,27 @@ fn should_return_fruit_too() -> Fruit::Apple {
//~| NOTE not found in this scope
}
fn foo() -> Ok {
//~^ ERROR expected type, found variant `Ok`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Ok(())
}
fn bar() -> Variant3 {
//~^ ERROR cannot find type `Variant3` in this scope
//~| NOTE not found in this scope
}
fn qux() -> Some {
//~^ ERROR expected type, found variant `Some`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Some(1)
}
fn main() {}
mod x {

View file

@ -38,14 +38,32 @@ help: possible candidate is found in another module, you can import it into scop
12 | use Fruit::Apple;
|
error[E0412]: cannot find type `Variant3` in this scope
error[E0573]: expected type, found variant `Ok`
--> $DIR/issue-35675.rs:36:13
|
36 | fn bar() -> Variant3 {
36 | fn foo() -> Ok {
| ^^ not a type
|
= help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`?
= help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`?
error[E0412]: cannot find type `Variant3` in this scope
--> $DIR/issue-35675.rs:44:13
|
44 | fn bar() -> Variant3 {
| ^^^^^^^^
| |
| not found in this scope
| help: you can try using the variant's enum: `x::Enum`
error: aborting due to 5 previous errors
error[E0573]: expected type, found variant `Some`
--> $DIR/issue-35675.rs:49:13
|
49 | fn qux() -> Some {
| ^^^^ not a type
|
= help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`?
= help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`?
error: aborting due to 7 previous errors