511e7626ae
A similar approach could be used for type parameters. Fixes #2282.
18 lines
329 B
Rust
18 lines
329 B
Rust
struct contravariant {
|
|
f: ∫
|
|
}
|
|
|
|
fn to_same_lifetime(bi: contravariant/&r) {
|
|
let bj: contravariant/&r = bi;
|
|
}
|
|
|
|
fn to_shorter_lifetime(bi: contravariant/&r) {
|
|
let bj: contravariant/&blk = bi;
|
|
}
|
|
|
|
fn to_longer_lifetime(bi: contravariant/&r) -> contravariant/&static {
|
|
bi //~ ERROR mismatched types
|
|
}
|
|
|
|
fn main() {
|
|
} |