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#104258 - compiler-errors:tait-closure-deduc…
…e, r=oli-obk Deduce closure signature from a type alias `impl Trait`'s supertraits r? `@oli-obk` Basically pass the TAIT's bounds through the same method that we're using to deduce a signature from infer var closure bounds. Does this need a new FCP? I see it as a logical extension of rust-lang#101834, but happy to rfcbot a new one if it does.
- Loading branch information
Showing
3 changed files
with
94 additions
and
42 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
15 changes: 15 additions & 0 deletions
15
src/test/ui/impl-trait/deduce-signature-from-supertrait.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,15 @@ | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
trait SuperExpectation: Fn(i32) {} | ||
|
||
impl<T: Fn(i32)> SuperExpectation for T {} | ||
|
||
type Foo = impl SuperExpectation; | ||
|
||
fn main() { | ||
let _: Foo = |x| { | ||
let _ = x.to_string(); | ||
}; | ||
} |