rust/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs

18 lines
335 B
Rust
Raw Normal View History

struct invariant {
f: @[mut &int];
}
fn to_same_lifetime(bi: invariant/&r) {
let bj: invariant/&r = bi;
}
fn to_shorter_lifetime(bi: invariant/&r) {
let bj: invariant/&blk = bi; //~ ERROR mismatched types
}
fn to_longer_lifetime(bi: invariant/&r) -> invariant/&static {
bi //~ ERROR mismatched types
}
fn main() {
}