-
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.
Prefer explict closure sig types over expected ones
- Loading branch information
Showing
7 changed files
with
87 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// check-pass | ||
|
||
// regression test for https://github.com/rust-lang/rust/issues/100800 | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
trait Anything {} | ||
impl<T> Anything for T {} | ||
type Input = impl Anything; | ||
fn run<F: FnOnce(Input) -> ()>(f: F, i: Input) { | ||
f(i); | ||
} | ||
|
||
fn main() { | ||
run(|x: u32| {println!("{x}");}, 0); | ||
} |
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,23 @@ | ||
// run-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
trait Foo { | ||
// This was reachable in https://github.com/rust-lang/rust/issues/100800 | ||
fn foo(&self) { unreachable!() } | ||
} | ||
impl<T> Foo for T {} | ||
|
||
struct B; | ||
impl B { | ||
fn foo(&self) {} | ||
} | ||
|
||
type Input = impl Foo; | ||
fn run1<F: FnOnce(Input)>(f: F, i: Input) {f(i)} | ||
fn run2<F: FnOnce(B)>(f: F, i: B) {f(i)} | ||
|
||
fn main() { | ||
run1(|x: B| {x.foo()}, B); | ||
run2(|x: B| {x.foo()}, B); | ||
} |
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