blob: 10959aa3379c91fa7d678806a83faa6975b0e3d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
//
// Tests for the "de-borrow" class of optimisations (that try to remove useless borrows)
//
#[test="simple_exp"]
fn simple(a: (i32,)) -> i32
{
let b: &(i32,);
bb0: {
ASSIGN b = &a;
ASSIGN retval = b*.0;
} RETURN;
}
fn simple_exp(a: (i32,)) -> i32
{
bb0: {
ASSIGN retval = a.0;
} RETURN;
}
// Should also work for mutable borrows
#[test="simple_mut_exp"]
fn simple_mut(a: (i32,)) -> i32
{
let b: &mut (i32,);
bb0: {
ASSIGN b = &mut a;
ASSIGN retval = b*.0;
} RETURN;
}
fn simple_mut_exp(a: (i32,)) -> i32
{
bb0: {
ASSIGN retval = a.0;
} RETURN;
}
|