diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-11-23 14:15:49 +0000 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-11-24 18:06:13 +0000 |
| commit | a8efd31f2b97a043d73db2131dddfedd65485d50 (patch) | |
| tree | d5eef5952391f5bf162f3ce4a4470255157843f0 /src/test/ui/raw-ref-op/raw-ref-temp-deref.rs | |
| parent | 9420ff4c0ebea44b167d530bb59f9d5721d8ff0b (diff) | |
| download | rust-a8efd31f2b97a043d73db2131dddfedd65485d50.tar.gz rust-a8efd31f2b97a043d73db2131dddfedd65485d50.zip | |
Add raw address of expressions to the AST and HIR
Diffstat (limited to 'src/test/ui/raw-ref-op/raw-ref-temp-deref.rs')
| -rw-r--r-- | src/test/ui/raw-ref-op/raw-ref-temp-deref.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs new file mode 100644 index 00000000000..22de148e4c2 --- /dev/null +++ b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs @@ -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 +} |
