Skip to content

Commit 4996735

Browse files
committed
Auto merge of #88210 - spastorino:diff-lifetimes-def-use-test, r=oli-obk
Test TAITs different lifetimes in defining uses fail r? `@oli-obk` Related to #86727
2 parents 5585532 + 10b3325 commit 4996735

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(type_alias_impl_trait)]
2+
#![allow(dead_code)]
3+
4+
type OneLifetime<'a, 'b> = impl std::fmt::Debug;
5+
6+
fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
7+
a
8+
}
9+
10+
fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
11+
//~^ ERROR: concrete type differs from previous defining opaque type use
12+
b
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: concrete type differs from previous defining opaque type use
2+
--> $DIR/different_lifetimes_defining_uses.rs:10:1
3+
|
4+
LL | fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a u32`, got `&'b u32`
6+
|
7+
note: previous use here
8+
--> $DIR/different_lifetimes_defining_uses.rs:6:1
9+
|
10+
LL | fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)