rust/tests/ui/borrowck/borrowck-trait-lifetime.rs

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

19 lines
367 B
Rust
Raw Normal View History

//@ run-pass
#![allow(unused_imports)]
// This test verifies that casting from the same lifetime on a value
// to the same lifetime on a trait succeeds. See issue #10766.
//@ pretty-expanded FIXME #23616
#![allow(dead_code)]
use std::marker;
fn main() {
2015-02-18 23:58:07 +00:00
trait T { fn foo(&self) {} }
2019-05-28 18:47:21 +00:00
fn f<'a, V: T>(v: &'a V) -> &'a dyn T {
v as &'a dyn T
}
}