-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #122319 - compiler-errors:next-solver-normalizing-sel…
…f-constrains-args, r=lcnr Don't ICE when non-self part of trait goal is constrained in new solver Self-explanatory. See test for example when this can happen.
- Loading branch information
Showing
19 changed files
with
38 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.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,24 @@ | ||
//@ check-pass | ||
|
||
// This goal is also possible w/ a GAT, but lazy_type_alias | ||
// makes the behavior a bit more readable. | ||
#![feature(lazy_type_alias)] | ||
//~^ WARN the feature `lazy_type_alias` is incomplete | ||
|
||
struct Wr<T>(T); | ||
trait Foo {} | ||
impl Foo for Wr<i32> {} | ||
|
||
type Alias<T> = (T,) | ||
where Wr<T>: Foo; | ||
|
||
fn hello<T>() where Alias<T>: Into<(T,)>, Wr<T>: Foo {} | ||
|
||
fn main() { | ||
// When calling `hello`, proving `Alias<?0>: Into<(?0,)>` will require | ||
// normalizing the self type of the goal. This will emit the where | ||
// clause `Wr<?0>: Foo`, which constrains `?0` in both the self type | ||
// *and* the non-self part of the goal. That used to trigger a debug | ||
// assertion. | ||
hello::<_>(); | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.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,11 @@ | ||
warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/normalize-self-type-constrains-trait-args.rs:5:12 | ||
| | ||
LL | #![feature(lazy_type_alias)] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.