forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#134746 - compiler-errors:autoderef-norm-non…
…-wf-coerce-ice, r=lcnr Don't ICE in coerce when autoderef fails to structurally normalize non-WF type in new solver r? lcnr
- Loading branch information
Showing
3 changed files
with
67 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ compile-flags: -Znext-solver | ||
|
||
trait Wf { | ||
type Assoc; | ||
} | ||
|
||
struct S { | ||
f: &'static <() as Wf>::Assoc, | ||
//~^ ERROR the trait bound `(): Wf` is not satisfied | ||
} | ||
|
||
fn main() { | ||
let x: S = todo!(); | ||
let y: &() = x.f; | ||
//~^ ERROR mismatched types | ||
//~| ERROR the trait bound `(): Wf` is not satisfied | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/ui/traits/next-solver/non-wf-in-coerce-pointers.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,39 @@ | ||
error[E0277]: the trait bound `(): Wf` is not satisfied | ||
--> $DIR/non-wf-in-coerce-pointers.rs:8:17 | ||
| | ||
LL | f: &'static <() as Wf>::Assoc, | ||
| ^^^^^^^^^^^^^^^^^ the trait `Wf` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/non-wf-in-coerce-pointers.rs:3:1 | ||
| | ||
LL | trait Wf { | ||
| ^^^^^^^^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/non-wf-in-coerce-pointers.rs:14:18 | ||
| | ||
LL | let y: &() = x.f; | ||
| --- ^^^ types differ | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected reference `&()` | ||
found reference `&'static <() as Wf>::Assoc` | ||
|
||
error[E0277]: the trait bound `(): Wf` is not satisfied | ||
--> $DIR/non-wf-in-coerce-pointers.rs:14:18 | ||
| | ||
LL | let y: &() = x.f; | ||
| ^^^ the trait `Wf` is not implemented for `()` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/non-wf-in-coerce-pointers.rs:3:1 | ||
| | ||
LL | trait Wf { | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. |