diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/ui/raw-ref-op | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
Move /src/test to /tests
Diffstat (limited to 'src/test/ui/raw-ref-op')
| -rw-r--r-- | src/test/ui/raw-ref-op/feature-raw-ref-op.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/feature-raw-ref-op.stderr | 57 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/raw-ref-op.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/raw-ref-temp-deref.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/raw-ref-temp.rs | 31 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/raw-ref-temp.stderr | 99 | ||||
| -rw-r--r-- | src/test/ui/raw-ref-op/unusual_locations.rs | 22 |
7 files changed, 0 insertions, 267 deletions
diff --git a/src/test/ui/raw-ref-op/feature-raw-ref-op.rs b/src/test/ui/raw-ref-op/feature-raw-ref-op.rs deleted file mode 100644 index 0a44b1cde40..00000000000 --- a/src/test/ui/raw-ref-op/feature-raw-ref-op.rs +++ /dev/null @@ -1,21 +0,0 @@ -// gate-test-raw_ref_op - -macro_rules! is_expr { - ($e:expr) => {} -} - -is_expr!(&raw const a); //~ ERROR raw address of syntax is experimental -is_expr!(&raw mut a); //~ ERROR raw address of syntax is experimental - -#[cfg(FALSE)] -fn cfgd_out() { - let mut a = 0; - &raw const a; //~ ERROR raw address of syntax is experimental - &raw mut a; //~ ERROR raw address of syntax is experimental -} - -fn main() { - let mut y = 123; - let x = &raw const y; //~ ERROR raw address of syntax is experimental - let x = &raw mut y; //~ ERROR raw address of syntax is experimental -} diff --git a/src/test/ui/raw-ref-op/feature-raw-ref-op.stderr b/src/test/ui/raw-ref-op/feature-raw-ref-op.stderr deleted file mode 100644 index 1e5fd84ff71..00000000000 --- a/src/test/ui/raw-ref-op/feature-raw-ref-op.stderr +++ /dev/null @@ -1,57 +0,0 @@ -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:13:5 - | -LL | &raw const a; - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:14:5 - | -LL | &raw mut a; - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:19:13 - | -LL | let x = &raw const y; - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:20:13 - | -LL | let x = &raw mut y; - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:7:10 - | -LL | is_expr!(&raw const a); - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:8:10 - | -LL | is_expr!(&raw mut a); - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/raw-ref-op/raw-ref-op.rs b/src/test/ui/raw-ref-op/raw-ref-op.rs deleted file mode 100644 index 0c6e23a00d5..00000000000 --- a/src/test/ui/raw-ref-op/raw-ref-op.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass - -#![feature(raw_ref_op)] - -fn main() { - let mut x = 123; - let c_p = &raw const x; - let m_p = &raw mut x; - let i_r = &x; - assert!(c_p == i_r); - assert!(c_p == m_p); - unsafe { assert!(*c_p == *i_r ); } -} 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 deleted file mode 100644 index 2e075a1b9e8..00000000000 --- a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// Check that taking the address of a place that contains a dereference is -// allowed. -#![feature(raw_ref_op, type_ascription)] - -const PAIR_REF: &(i32, i64) = &(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; - let field_deref_ref = &raw const PAIR_REF.0; - let deref_ref = &raw const *ARRAY_REF; - let index_deref_ref = &raw const ARRAY_REF[0]; - let deref_ref = &raw const *SLICE_REF; - let index_deref_ref = &raw const SLICE_REF[1]; - - let x = 0; - let ascribe_ref = &raw const type_ascribe!(x, i32); - let ascribe_deref = &raw const type_ascribe!(*ARRAY_REF, [i32; 2]); - let ascribe_index_deref = &raw const type_ascribe!(ARRAY_REF[0], i32); -} diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.rs b/src/test/ui/raw-ref-op/raw-ref-temp.rs deleted file mode 100644 index 10e47cb34c5..00000000000 --- a/src/test/ui/raw-ref-op/raw-ref-temp.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Ensure that we don't allow taking the address of temporary values -#![feature(raw_ref_op, type_ascription)] - -const FOUR: u64 = 4; - -const PAIR: (i32, i64) = (1, 2); - -const ARRAY: [i32; 2] = [1, 2]; - -fn main() { - let ref_expr = &raw const 2; //~ ERROR cannot take address - let mut_ref_expr = &raw mut 3; //~ ERROR cannot take address - let ref_const = &raw const FOUR; //~ ERROR cannot take address - let mut_ref_const = &raw mut FOUR; //~ ERROR cannot take address - - let field_ref_expr = &raw const (1, 2).0; //~ ERROR cannot take address - let mut_field_ref_expr = &raw mut (1, 2).0; //~ ERROR cannot take address - let field_ref = &raw const PAIR.0; //~ ERROR cannot take address - let mut_field_ref = &raw mut PAIR.0; //~ ERROR cannot take address - - let index_ref_expr = &raw const [1, 2][0]; //~ ERROR cannot take address - let mut_index_ref_expr = &raw mut [1, 2][0]; //~ ERROR cannot take address - let index_ref = &raw const ARRAY[0]; //~ ERROR cannot take address - let mut_index_ref = &raw mut ARRAY[1]; //~ ERROR cannot take address - - let ref_ascribe = &raw const type_ascribe!(2, i32); //~ ERROR cannot take address - let mut_ref_ascribe = &raw mut type_ascribe!(3, i32); //~ ERROR cannot take address - - let ascribe_field_ref = &raw const type_ascribe!(PAIR.0, i32); //~ ERROR cannot take address - let ascribe_index_ref = &raw mut type_ascribe!(ARRAY[0], i32); //~ ERROR cannot take address -} diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.stderr b/src/test/ui/raw-ref-op/raw-ref-temp.stderr deleted file mode 100644 index b9666162517..00000000000 --- a/src/test/ui/raw-ref-op/raw-ref-temp.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:11:31 - | -LL | let ref_expr = &raw const 2; - | ^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:12:33 - | -LL | let mut_ref_expr = &raw mut 3; - | ^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:13:32 - | -LL | let ref_const = &raw const FOUR; - | ^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:14:34 - | -LL | let mut_ref_const = &raw mut FOUR; - | ^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:16:37 - | -LL | let field_ref_expr = &raw const (1, 2).0; - | ^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:17:39 - | -LL | let mut_field_ref_expr = &raw mut (1, 2).0; - | ^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:18:32 - | -LL | let field_ref = &raw const PAIR.0; - | ^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:19:34 - | -LL | let mut_field_ref = &raw mut PAIR.0; - | ^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:21:37 - | -LL | let index_ref_expr = &raw const [1, 2][0]; - | ^^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:22:39 - | -LL | let mut_index_ref_expr = &raw mut [1, 2][0]; - | ^^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:23:32 - | -LL | let index_ref = &raw const ARRAY[0]; - | ^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:24:34 - | -LL | let mut_index_ref = &raw mut ARRAY[1]; - | ^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:26:34 - | -LL | let ref_ascribe = &raw const type_ascribe!(2, i32); - | ^^^^^^^^^^^^^^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:27:36 - | -LL | let mut_ref_ascribe = &raw mut type_ascribe!(3, i32); - | ^^^^^^^^^^^^^^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:29:40 - | -LL | let ascribe_field_ref = &raw const type_ascribe!(PAIR.0, i32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value - -error[E0745]: cannot take address of a temporary - --> $DIR/raw-ref-temp.rs:30:38 - | -LL | let ascribe_index_ref = &raw mut type_ascribe!(ARRAY[0], i32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value - -error: aborting due to 16 previous errors - -For more information about this error, try `rustc --explain E0745`. diff --git a/src/test/ui/raw-ref-op/unusual_locations.rs b/src/test/ui/raw-ref-op/unusual_locations.rs deleted file mode 100644 index 6bf37408a8b..00000000000 --- a/src/test/ui/raw-ref-op/unusual_locations.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check-pass - -#![feature(raw_ref_op)] - -const USES_PTR: () = { let u = (); &raw const u; }; -static ALSO_USES_PTR: () = { let u = (); &raw const u; }; - -fn main() { - let x: [i32; { let u = 2; let x = &raw const u; 4 }] - = [2; { let v = 3; let y = &raw const v; 4 }]; - let mut one = 1; - let two = 2; - if &raw const one == &raw mut one { - match &raw const two { - _ => {} - } - } - let three = 3; - let mut four = 4; - println!("{:p}", &raw const three); - unsafe { &raw mut four; } -} |
