forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#83729 - JohnTitor:issue-43913, r=estebank
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ``@estebank``
- Loading branch information
Showing
9 changed files
with
81 additions
and
23 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
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
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
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
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
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
src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.fixed
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 @@ | ||
// Regression test of #43913. | ||
|
||
// run-rustfix | ||
|
||
#![feature(trait_alias)] | ||
#![allow(bare_trait_objects, dead_code)] | ||
|
||
trait Strings = Iterator<Item=String>; | ||
|
||
struct Struct<S: Strings>(S); | ||
//~^ ERROR: expected trait, found type alias `Strings` | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.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 @@ | ||
// Regression test of #43913. | ||
|
||
// run-rustfix | ||
|
||
#![feature(trait_alias)] | ||
#![allow(bare_trait_objects, dead_code)] | ||
|
||
type Strings = Iterator<Item=String>; | ||
|
||
struct Struct<S: Strings>(S); | ||
//~^ ERROR: expected trait, found type alias `Strings` | ||
|
||
fn main() {} |
14 changes: 14 additions & 0 deletions
14
src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr
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,14 @@ | ||
error[E0404]: expected trait, found type alias `Strings` | ||
--> $DIR/suggest-trait-alias-instead-of-type.rs:10:18 | ||
| | ||
LL | struct Struct<S: Strings>(S); | ||
| ^^^^^^^ type aliases cannot be used as traits | ||
| | ||
help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | ||
| | ||
LL | trait Strings = Iterator<Item=String>; | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0404`. |