forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#125413 - lcnr:ambig-drop-region-constraints, …
…r=<try> drop region constraints for ambiguous goals See the comment in `compute_external_query_constraints`. While the underlying issue is preexisting, this fixes a bug introduced by rust-lang#125343. It slightly weakens the leak chec, even if we didn't have any test which was affected. I want to write such a test before merging this PR. r? `@compiler-errors`
- Loading branch information
Showing
2 changed files
with
68 additions
and
25 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
29 changes: 29 additions & 0 deletions
29
tests/ui/traits/next-solver/normalize/ambig-goal-infer-in-type-oulives.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,29 @@ | ||
//@ check-pass | ||
//@ compile-flags: -Znext-solver | ||
//@ ignore-compare-mode-next-solver (explicitly enabled) | ||
|
||
// Regression test for an ICE when trying to bootstrap rustc | ||
// with #125343. An ambiguous goal returned a `TypeOutlives` | ||
// constraint referencing an inference variable. This inference | ||
// variable was created inside of the goal, causing it to be | ||
// unconstrained in the caller. This then caused an ICE in MIR | ||
// borrowck. | ||
|
||
struct Foo<T>(T); | ||
trait Extend<T> { | ||
fn extend<I: IntoIterator<Item = T>>(iter: I); | ||
} | ||
|
||
impl<T> Extend<T> for Foo<T> { | ||
fn extend<I: IntoIterator<Item = T>>(_: I) { | ||
todo!() | ||
} | ||
} | ||
|
||
impl<'a, T: 'a + Copy> Extend<&'a T> for Foo<T> { | ||
fn extend<I: IntoIterator<Item = &'a T>>(iter: I) { | ||
<Self as Extend<T>>::extend(iter.into_iter().copied()) | ||
} | ||
} | ||
|
||
fn main() {} |