-
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.
Don't ICE on associated type projection without feature gate
- Loading branch information
1 parent
2a1af89
commit 8c667fe
Showing
3 changed files
with
55 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
tests/ui/traits/new-solver/dont-ice-on-assoc-projection.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,19 @@ | ||
// compile-flags: -Ztrait-solver=next-coherence | ||
|
||
// Makes sure we don't ICE on associated const projection when the feature gate | ||
// is not enabled, since we should avoid encountering ICEs on stable if possible. | ||
|
||
trait Bar { | ||
const ASSOC: usize; | ||
} | ||
impl Bar for () { | ||
const ASSOC: usize = 1; | ||
} | ||
|
||
trait Foo {} | ||
impl Foo for () {} | ||
impl<T> Foo for T where T: Bar<ASSOC = 0> {} | ||
//~^ ERROR associated const equality is incomplete | ||
//~| ERROR conflicting implementations of trait `Foo` for type `()` | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
tests/ui/traits/new-solver/dont-ice-on-assoc-projection.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,21 @@ | ||
error[E0658]: associated const equality is incomplete | ||
--> $DIR/dont-ice-on-assoc-projection.rs:15:32 | ||
| | ||
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {} | ||
| ^^^^^^^^^ | ||
| | ||
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information | ||
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable | ||
|
||
error[E0119]: conflicting implementations of trait `Foo` for type `()` | ||
--> $DIR/dont-ice-on-assoc-projection.rs:15:1 | ||
| | ||
LL | impl Foo for () {} | ||
| --------------- first implementation here | ||
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {} | ||
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0119, E0658. | ||
For more information about an error, try `rustc --explain E0119`. |