Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make ProjectionTy::trait_ref truncate substs again
Also make sure that type arguments of associated types are printed in some error messages.
- Loading branch information
1 parent
79f6f11
commit dfee89f
Showing
12 changed files
with
216 additions
and
49 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
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
17 changes: 17 additions & 0 deletions
17
src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.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,17 @@ | ||
// Test that correct syntax is used in suggestion to constrain associated type | ||
|
||
#![feature(generic_associated_types)] | ||
//~^ WARNING the feature `generic_associated_types` is incomplete | ||
|
||
trait X { | ||
type Y<T>; | ||
} | ||
|
||
fn f<T: X>(a: T::Y<i32>) { | ||
//~^ HELP consider constraining the associated type `<T as X>::Y<i32>` to `Vec<i32>` | ||
//~| SUGGESTION Y<i32> = Vec<i32>> | ||
let b: Vec<i32> = a; | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
fn main() {} |
27 changes: 27 additions & 0 deletions
27
src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.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,27 @@ | ||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/constraint-assoc-type-suggestion.rs:3:12 | ||
| | ||
LL | #![feature(generic_associated_types)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/constraint-assoc-type-suggestion.rs:13:23 | ||
| | ||
LL | let b: Vec<i32> = a; | ||
| -------- ^ expected struct `Vec`, found associated type | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected struct `Vec<i32>` | ||
found associated type `<T as X>::Y<i32>` | ||
help: consider constraining the associated type `<T as X>::Y<i32>` to `Vec<i32>` | ||
| | ||
LL | fn f<T: X<Y<i32> = Vec<i32>>>(a: T::Y<i32>) { | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
Oops, something went wrong.