blob: fbd89501559b73c780ec8e0572c262859c5bf571 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// run-pass
#![allow(non_camel_case_types)]
struct boxed_int<'a> {
f: &'a isize,
}
fn max<'r>(bi: &'r boxed_int, f: &'r isize) -> isize {
if *bi.f > *f {*bi.f} else {*f}
}
fn with(bi: &boxed_int) -> isize {
let i = 22;
max(bi, &i)
}
pub fn main() {
let g = 21;
let foo = boxed_int { f: &g };
assert_eq!(with(&foo), 22);
}
|