Add raw address of expressions to the AST and HIR
This commit is contained in:
parent
9420ff4c0e
commit
a8efd31f2b
22 changed files with 308 additions and 139 deletions
19
src/test/ui/raw-ref-op/raw-ref-temp-deref.rs
Normal file
19
src/test/ui/raw-ref-op/raw-ref-temp-deref.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Ensure that we don't allow taking the address of temporary values
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const PAIR: (i32, i64) = (1, 2);
|
||||
const PAIR_REF: &(i32, i64) = &(1, 2);
|
||||
|
||||
const ARRAY: [i32; 2] = [1, 2];
|
||||
const ARRAY_REF: &[i32; 2] = &[3, 4];
|
||||
const SLICE_REF: &[i32] = &[5, 6];
|
||||
|
||||
fn main() {
|
||||
// These are all OK, we're not taking the address of the temporary
|
||||
let deref_ref = &raw const *PAIR_REF; //~ ERROR not yet implemented
|
||||
let field_deref_ref = &raw const PAIR_REF.0; //~ ERROR not yet implemented
|
||||
let deref_ref = &raw const *ARRAY_REF; //~ ERROR not yet implemented
|
||||
let field_deref_ref = &raw const ARRAY_REF[0]; //~ ERROR not yet implemented
|
||||
let deref_ref = &raw const *SLICE_REF; //~ ERROR not yet implemented
|
||||
let field_deref_ref = &raw const SLICE_REF[1]; //~ ERROR not yet implemented
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue