-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ICE when multiple supertrait substitutions need assoc but only on…
…e is provided
- Loading branch information
1 parent
8e324b4
commit c977f8e
Showing
10 changed files
with
71 additions
and
35 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
15 changes: 15 additions & 0 deletions
15
tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.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,15 @@ | ||
trait Sup<T> { | ||
type Assoc: Default; | ||
} | ||
|
||
impl<T: Default> Sup<T> for () { | ||
type Assoc = T; | ||
} | ||
impl<T: Default, U: Default> Dyn<T, U> for () {} | ||
|
||
trait Dyn<A, B>: Sup<A, Assoc = A> + Sup<B> {} | ||
|
||
fn main() { | ||
let q: <dyn Dyn<i32, u32> as Sup<u32>>::Assoc = Default::default(); | ||
//~^ ERROR the value of the associated type `Assoc` in `Sup<u32>` must be specified | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/ui/dyn-compatibility/require-assoc-for-all-super-substs.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,12 @@ | ||
error[E0191]: the value of the associated type `Assoc` in `Sup<u32>` must be specified | ||
--> $DIR/require-assoc-for-all-super-substs.rs:13:17 | ||
| | ||
LL | type Assoc: Default; | ||
| ------------------- `Assoc` defined here | ||
... | ||
LL | let q: <dyn Dyn<i32, u32> as Sup<u32>>::Assoc = Default::default(); | ||
| ^^^^^^^^^^^^^ help: specify the associated type: `Dyn<i32, u32, Assoc = Type>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0191`. |
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