Test TAITs different lifetimes in defining uses fail
This commit is contained in:
parent
a9ab2e5539
commit
10b3325d26
2 changed files with 29 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
type OneLifetime<'a, 'b> = impl std::fmt::Debug;
|
||||||
|
|
||||||
|
fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
|
||||||
|
//~^ ERROR: concrete type differs from previous defining opaque type use
|
||||||
|
b
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,14 @@
|
||||||
|
error: concrete type differs from previous defining opaque type use
|
||||||
|
--> $DIR/different_lifetimes_defining_uses.rs:10:1
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a u32`, got `&'b u32`
|
||||||
|
|
|
||||||
|
note: previous use here
|
||||||
|
--> $DIR/different_lifetimes_defining_uses.rs:6:1
|
||||||
|
|
|
||||||
|
LL | fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue