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#114196 - compiler-errors:bubble-pls, r=lcnr
Bubble up nested goals from equation in `predicates_for_object_candidate` This used to be needed for rust-lang#114036 (comment), but since it's no longer, I'm opening this as a separate PR. This also fixes one ICEing UI test: (`tests/ui/unboxed-closures/issue-53448.rs`) r? `@lcnr`
- Loading branch information
Showing
3 changed files
with
44 additions
and
23 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
20 changes: 20 additions & 0 deletions
20
tests/ui/traits/new-solver/object-soundness-requires-generalization.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,20 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// ignore-test | ||
|
||
trait Trait { | ||
type Gat<'lt>; | ||
} | ||
impl Trait for u8 { | ||
type Gat<'lt> = u8; | ||
} | ||
|
||
fn test<T: Trait, F: FnOnce(<T as Trait>::Gat<'_>) -> S + ?Sized, S>() {} | ||
|
||
fn main() { | ||
// Proving `dyn FnOnce: FnOnce` requires making sure that all of the supertraits | ||
// of the trait and associated type bounds hold. We check this in | ||
// `predicates_for_object_candidate`, and eagerly replace projections using equality | ||
// which may generalize a type and emit a nested AliasRelate goal. Make sure that | ||
// we don't ICE in that case, and bubble that goal up to the caller. | ||
test::<u8, dyn FnOnce(<u8 as Trait>::Gat<'_>) + 'static, _>(); | ||
} |