-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elaborate supertrait obligations when deducing closure signature
- Loading branch information
1 parent
060d439
commit caa701e
Showing
4 changed files
with
41 additions
and
35 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
src/test/ui/closures/issue-23012-supertrait-signature-inference.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 | ||
// Checks that we can infer a closure signature even if the `FnOnce` bound is | ||
// a supertrait of the obligations we have currently registered for the Ty var. | ||
|
||
pub trait Receive<T, E>: FnOnce(Result<T, E>) { | ||
fn receive(self, res: Result<T, E>); | ||
} | ||
|
||
impl<T, E, F: FnOnce(Result<T, E>)> Receive<T, E> for F { | ||
fn receive(self, res: Result<T, E>) { | ||
self(res) | ||
} | ||
} | ||
|
||
pub trait Async<T, E> { | ||
fn receive<F: Receive<T, E>>(self, f: F); | ||
} | ||
|
||
impl<T, E> Async<T, E> for Result<T, E> { | ||
fn receive<F: Receive<T, E>>(self, f: F) { | ||
f(self) | ||
} | ||
} | ||
|
||
pub fn main() { | ||
Ok::<u32, ()>(123).receive(|res| { | ||
res.unwrap(); | ||
}); | ||
} |
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
26 changes: 0 additions & 26 deletions
26
src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr
This file was deleted.
Oops, something went wrong.