-
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 #109493 - compiler-errors:new-solver-vars-obligations…
…, r=lcnr Return nested obligations from canonical response var unification Handle alias-eq obligations being emitted from `instantiate_and_apply_query_response` in: * `EvalCtxt` - by processing the nested obligations in the next loop by `new_goals` * `FulfillCtxt` - by adding the nested obligations to the fulfillment's pending obligations * `InferCtxt::evaluate_obligation` - ~~by returning `EvaluationResult::EvaluatedToAmbig` (boo 👎, see the FIXME)~~ same behavior as above, since we use fulfillment and `select_where_possible` The only one that's truly sketchy is `evaluate_obligation`, but it's not hard to modify this behavior moving forward. From #109037, I think a smaller repro could be crafted if I were smarter, but I am not, so I just took this from #105878. r? `@lcnr` cc `@BoxyUwU`
- Loading branch information
Showing
6 changed files
with
84 additions
and
46 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
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
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
40 changes: 40 additions & 0 deletions
40
tests/ui/traits/new-solver/alias-eq-in-canonical-response.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,40 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
|
||
trait Foo { | ||
type Gat<'a> | ||
where | ||
Self: 'a; | ||
fn bar(&self) -> Self::Gat<'_>; | ||
} | ||
|
||
enum Option<T> { | ||
Some(T), | ||
None, | ||
} | ||
|
||
impl<T> Option<T> { | ||
fn as_ref(&self) -> Option<&T> { | ||
match self { | ||
Option::Some(t) => Option::Some(t), | ||
Option::None => Option::None, | ||
} | ||
} | ||
|
||
fn map<U>(self, f: impl FnOnce(T) -> U) -> Option<U> { | ||
match self { | ||
Option::Some(t) => Option::Some(f(t)), | ||
Option::None => Option::None, | ||
} | ||
} | ||
} | ||
|
||
impl<T: Foo + 'static> Foo for Option<T> { | ||
type Gat<'a> = Option<<T as Foo>::Gat<'a>> where Self: 'a; | ||
|
||
fn bar(&self) -> Self::Gat<'_> { | ||
self.as_ref().map(Foo::bar) | ||
} | ||
} | ||
|
||
fn main() {} |