summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
blob: 5f75fdc716efdc6d135b628a175797cd8726bef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]

pub trait Captures<'a> {}

impl<'a, T: ?Sized> Captures<'a> for T {}

type OneLifetime<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;

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> {
    b
    //~^ ERROR: concrete type differs from previous defining opaque type use
}

fn main() {}