Rollup merge of #71438 - estebank:resolve-sugg-tiny, r=petrochenkov

Tweak some suggestions in `rustc_resolve`
This commit is contained in:
Dylan DPC 2020-04-27 03:26:17 +02:00 committed by GitHub
commit ac62dcef05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 25 deletions

View file

@ -4,7 +4,11 @@ error[E0404]: expected trait, found type alias `Bar`
LL | impl Bar for Baz { }
| ^^^ type aliases cannot be used as traits
|
= note: did you mean to use a trait alias?
help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias
--> $DIR/two_files_data.rs:5:1
|
LL | type Bar = dyn Foo;
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -45,9 +45,12 @@ error[E0423]: expected value, found struct `T`
--> $DIR/E0423.rs:14:8
|
LL | if T {} == T {} { println!("Ok"); }
| ^---
| |
| help: surround the struct literal with parenthesis: `(T {})`
| ^
|
help: surround the struct literal with parentheses
|
LL | if (T {}) == T {} { println!("Ok"); }
| ^ ^
error: aborting due to 5 previous errors

View file

@ -4,7 +4,11 @@ error[E0404]: expected trait, found type alias `Foo`
LL | impl Foo for S {
| ^^^ type aliases cannot be used as traits
|
= note: did you mean to use a trait alias?
help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias
--> $DIR/issue-3907.rs:5:1
|
LL | type Foo = dyn issue_3907::Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: possible better candidate is found in another module, you can import it into scope
|
LL | use issue_3907::Foo;

View file

@ -16,7 +16,11 @@ LL | impl K for isize {}
| type aliases cannot be used as traits
| help: a trait with a similar name exists: `I`
|
= note: did you mean to use a trait alias?
help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias
--> $DIR/issue-5035.rs:2:1
|
LL | type K = dyn I;
| ^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -10,7 +10,11 @@ error[E0404]: expected trait, found type alias `Typedef`
LL | fn g<F:Typedef(isize) -> isize>(x: F) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ type aliases cannot be used as traits
|
= note: did you mean to use a trait alias?
help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias
--> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:4:1
|
LL | type Typedef = isize;
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -46,9 +46,12 @@ error[E0423]: expected value, found struct variant `E::V`
--> $DIR/struct-literal-variant-in-if.rs:10:13
|
LL | if x == E::V { field } {}
| ^^^^----------
| |
| help: surround the struct literal with parenthesis: `(E::V { field })`
| ^^^^
|
help: surround the struct literal with parentheses
|
LL | if x == (E::V { field }) {}
| ^ ^
error[E0308]: mismatched types
--> $DIR/struct-literal-variant-in-if.rs:10:20