]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/closure_args2.rs
Auto merge of #106916 - lukas-code:overlapping-substs, r=estebank
[rust.git] / tests / ui / type-alias-impl-trait / closure_args2.rs
1 // run-pass
2
3 #![feature(type_alias_impl_trait)]
4
5 trait Foo {
6     // This was reachable in https://github.com/rust-lang/rust/issues/100800
7     fn foo(&self) { unreachable!() }
8 }
9 impl<T> Foo for T {}
10
11 struct B;
12 impl B {
13     fn foo(&self) {}
14 }
15
16 type Input = impl Foo;
17 fn run1<F: FnOnce(Input)>(f: F, i: Input) {f(i)}
18 fn run2<F: FnOnce(B)>(f: F, i: B) {f(i)}
19
20 fn main() {
21     run1(|x: B| {x.foo()}, B);
22     run2(|x: B| {x.foo()}, B);
23 }