rust/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs

19 lines
357 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 17:58:07 -06:00
trait T { fn foo(&self) {} }
fn f<'a, V: T>(v: &'a V) -> &'a T {
v as &'a T
}
}