-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 bad transmute in typeck in new solver
- Loading branch information
1 parent
409998c
commit 1677200
Showing
3 changed files
with
103 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
17 changes: 17 additions & 0 deletions
17
tests/ui/traits/next-solver/dont-ice-on-bad-transmute-in-typeck.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 @@ | ||
//@ compile-flags: -Znext-solver | ||
|
||
trait Trait<'a> { | ||
type Assoc; | ||
} | ||
|
||
fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) { | ||
//~^ ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
unsafe { std::mem::transmute::<_, ()>(x); } | ||
//~^ ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
//~| ERROR the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
} | ||
|
||
fn main() {} |
75 changes: 75 additions & 0 deletions
75
tests/ui/traits/next-solver/dont-ice-on-bad-transmute-in-typeck.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,75 @@ | ||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:11 | ||
| | ||
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:8 | ||
| | ||
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) { | ||
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:14 | ||
| | ||
LL | unsafe { std::mem::transmute::<_, ()>(x); } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:36 | ||
| | ||
LL | unsafe { std::mem::transmute::<_, ()>(x); } | ||
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:11:43 | ||
| | ||
LL | unsafe { std::mem::transmute::<_, ()>(x); } | ||
| ^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `for<'a> (): Trait<'a>` is not satisfied | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:7:1 | ||
| | ||
LL | fn foo(x: for<'a> fn(<() as Trait<'a>>::Assoc)) { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait<'a>` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/dont-ice-on-bad-transmute-in-typeck.rs:3:1 | ||
| | ||
LL | trait Trait<'a> { | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |