Add tests for lifetime-swaps, not just type param swaps
This commit is contained in:
parent
d526a8d594
commit
80c7b6108f
@ -0,0 +1,10 @@
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo<'a, 'b> = impl std::fmt::Debug;
|
||||
|
||||
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
|
||||
(i, i) //~^ ERROR concrete type differs from previous
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,14 @@
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:1
|
||||
|
|
||||
LL | fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a i32`, got `&'b i32`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:1
|
||||
|
|
||||
LL | fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -7,6 +7,15 @@ fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>)
|
||||
(a.clone(), a)
|
||||
}
|
||||
|
||||
type Foo<'a, 'b> = impl std::fmt::Debug;
|
||||
|
||||
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
|
||||
(i, j)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", <X<_, _> as ToString>::to_string(&f(42_i32, String::new()).1));
|
||||
let meh = 42;
|
||||
let muh = 69;
|
||||
println!("{:?}", foo(&meh, &muh));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user