summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-39292.rs
blob: 968cf08916fd6dd2bfd840e605fb7c0c715d4df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-pass
// Regression test for issue #39292. The object vtable was being
// incorrectly left with a null pointer.

trait Foo<T> {
    fn print<'a>(&'a self) where T: 'a { println!("foo"); }
}

impl<'a> Foo<&'a ()> for () { }

trait Bar: for<'a> Foo<&'a ()> { }

impl Bar for () {}

fn main() {
    (&() as &dyn Bar).print(); // Segfault
}