rust/tests/ui/borrowck/implied-bound-from-impl-header.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
546 B
Rust
Raw Normal View History

2025-01-25 21:42:29 +00:00
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get
// its implied bounds in impl header.
trait Ref<'a> {
type Assoc;
}
impl<'a, T> Ref<'a> for T where T: 'a {
type Assoc = &'a T;
}
fn outlives<'a, T: 'a>() {}
trait Trait<'a, T> {
fn test();
}
impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc {
fn test() {
outlives::<'a, T>();
}
}
fn main() {}