forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#101753 - oli-obk:tait_closure_args, r=compi…
…ler-errors Prefer explict closure sig types over expected ones fixes rust-lang#100800 Previously we only checked that given closure arguments are equal to expected closure arguments, but now we choose the given closure arguments for the signature that is used when type checking the closure body, and keep the other signature for the type of the closure as seen outside of it.
- 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