-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return nested obligations from canonical response var unification
- Loading branch information
1 parent
df7fd99
commit 2bab422
Showing
5 changed files
with
78 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
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() {} |