-
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.
Gracefully handle non-WF alias in assemble_alias_bound_candidates_recur
- Loading branch information
1 parent
6cc4843
commit 5461fd4
Showing
3 changed files
with
42 additions
and
2 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,19 @@ | ||
// compile-flags: -Znext-solver | ||
|
||
#![feature(lazy_type_alias)] | ||
//~^ WARN the feature `lazy_type_alias` is incomplete | ||
|
||
trait Foo {} | ||
|
||
type A<T: Foo> = T; | ||
|
||
struct W<T>(T); | ||
|
||
// For `W<A<usize>>` to be WF, `A<usize>: Sized` must hold. However, when assembling | ||
// alias bounds for `A<usize>`, we try to normalize it, but it doesn't hold because | ||
// `usize: Foo` doesn't hold. Therefore we ICE, because we don't expect to still | ||
// encounter weak types in `assemble_alias_bound_candidates_recur`. | ||
fn hello(_: W<A<usize>>) {} | ||
//~^ ERROR the type `W<A<usize>>` is not well-formed | ||
|
||
fn main() {} |
17 changes: 17 additions & 0 deletions
17
tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.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,17 @@ | ||
warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/alias-bounds-when-not-wf.rs:3: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 | ||
|
||
error: the type `W<A<usize>>` is not well-formed | ||
--> $DIR/alias-bounds-when-not-wf.rs:16:13 | ||
| | ||
LL | fn hello(_: W<A<usize>>) {} | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error; 1 warning emitted | ||
|