]>
git.proxmox.com Git - rustc.git/blob - tests/ui/raw-ref-op/raw-ref-temp.rs
1 // Ensure that we don't allow taking the address of temporary values
2 #![feature(raw_ref_op, type_ascription)]
6 const PAIR
: (i32, i64) = (1, 2);
8 const ARRAY
: [i32; 2] = [1, 2];
11 let ref_expr
= &raw
const 2; //~ ERROR cannot take address
12 let mut_ref_expr
= &raw
mut 3; //~ ERROR cannot take address
13 let ref_const
= &raw
const FOUR
; //~ ERROR cannot take address
14 let mut_ref_const
= &raw
mut FOUR
; //~ ERROR cannot take address
16 let field_ref_expr
= &raw
const (1, 2).0; //~ ERROR cannot take address
17 let mut_field_ref_expr
= &raw
mut (1, 2).0; //~ ERROR cannot take address
18 let field_ref
= &raw
const PAIR
.0; //~ ERROR cannot take address
19 let mut_field_ref
= &raw
mut PAIR
.0; //~ ERROR cannot take address
21 let index_ref_expr
= &raw
const [1, 2][0]; //~ ERROR cannot take address
22 let mut_index_ref_expr
= &raw
mut [1, 2][0]; //~ ERROR cannot take address
23 let index_ref
= &raw
const ARRAY
[0]; //~ ERROR cannot take address
24 let mut_index_ref
= &raw
mut ARRAY
[1]; //~ ERROR cannot take address
26 let ref_ascribe
= &raw
const type_ascribe
!(2, i32); //~ ERROR cannot take address
27 let mut_ref_ascribe
= &raw
mut type_ascribe
!(3, i32); //~ ERROR cannot take address
29 let ascribe_field_ref
= &raw
const type_ascribe
!(PAIR
.0, i32); //~ ERROR cannot take address
30 let ascribe_index_ref
= &raw
mut type_ascribe
!(ARRAY
[0], i32); //~ ERROR cannot take address