Skip to content

Commit f46799a

Browse files
authored
Unrolled build for #142883
Rollup merge of #142883 - mominul:impl_in_bindings, r=lcnr Add impl_trait_in_bindings tests from #61773 This adds the [three test cases](#61773 (comment)) from the #61773 as was suggested by ``@lcnr.`` I have merged the first two cases into one, named as `region-lifetimes.rs` r? ``@lcnr`` Closes #61773
2 parents 28f1c80 + 2973939 commit f46799a

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)