Skip to content

Commit 2973939

Browse files
committed
Add impl_trait_in_bindings tests
1 parent a30f178 commit 2973939

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ check-pass
2+
3+
#![feature(impl_trait_in_bindings)]
4+
5+
// A test for #61773 which would have been difficult to support if we
6+
// were to represent `impl_trait_in_bindings` using opaque types.
7+
8+
trait Trait<'a, 'b> { }
9+
impl<T> Trait<'_, '_> for T { }
10+
11+
12+
fn bar<'a, 'b>(data0: &'a u32, data1: &'b u32) {
13+
let x: impl Trait<'_, '_> = (data0, data1);
14+
force_equal(x);
15+
}
16+
17+
fn force_equal<'a>(t: impl Trait<'a, 'a>) { }
18+
19+
fn main() { }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ check-pass
2+
3+
#![feature(impl_trait_in_bindings)]
4+
5+
// A test for #61773 which would have been difficult to support if we
6+
// were to represent `impl_trait_in_bindings` using opaque types.
7+
8+
trait Foo<'a> { }
9+
impl Foo<'_> for &u32 { }
10+
11+
fn bar<'a>(data: &'a u32) {
12+
let x: impl Foo<'_> = data;
13+
}
14+
15+
fn main() {
16+
let _: impl Foo<'_> = &44;
17+
}

0 commit comments

Comments
 (0)