about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-02-27 13:07:44 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-03-12 13:19:46 +0000
commitdd7df04e168324fc002ab4985b6c7513f08ccf49 (patch)
treed20567e06dfccad24f16dabddb42852a498a8c1a /tests/ui/error-codes
parent24c0b81c1fd5de8e00276524896d3352ed91a8cb (diff)
downloadrust-dd7df04e168324fc002ab4985b6c7513f08ccf49.tar.gz
rust-dd7df04e168324fc002ab4985b6c7513f08ccf49.zip
Remove uses of `box_syntax` in rustc and tools
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0010-teach.rs5
-rw-r--r--tests/ui/error-codes/E0010-teach.stderr21
-rw-r--r--tests/ui/error-codes/E0010.rs5
-rw-r--r--tests/ui/error-codes/E0010.stderr22
4 files changed, 37 insertions, 16 deletions
diff --git a/tests/ui/error-codes/E0010-teach.rs b/tests/ui/error-codes/E0010-teach.rs
index fc5dffb37cf..798fcda2a10 100644
--- a/tests/ui/error-codes/E0010-teach.rs
+++ b/tests/ui/error-codes/E0010-teach.rs
@@ -1,8 +1,7 @@
 // compile-flags: -Z teach
 
-#![feature(box_syntax)]
 #![allow(warnings)]
 
-const CON : Box<i32> = box 0; //~ ERROR E0010
-
+const CON: Vec<i32> = vec![1, 2, 3]; //~ ERROR E0010
+//~| ERROR cannot call non-const fn
 fn main() {}
diff --git a/tests/ui/error-codes/E0010-teach.stderr b/tests/ui/error-codes/E0010-teach.stderr
index 33de9fd685e..7634970f36e 100644
--- a/tests/ui/error-codes/E0010-teach.stderr
+++ b/tests/ui/error-codes/E0010-teach.stderr
@@ -1,11 +1,22 @@
 error[E0010]: allocations are not allowed in constants
-  --> $DIR/E0010-teach.rs:6:24
+  --> $DIR/E0010-teach.rs:5:23
    |
-LL | const CON : Box<i32> = box 0;
-   |                        ^^^^^ allocation not allowed in constants
+LL | const CON: Vec<i32> = vec![1, 2, 3];
+   |                       ^^^^^^^^^^^^^ allocation not allowed in constants
    |
    = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to previous error
+error[E0015]: cannot call non-const fn `slice::<impl [i32]>::into_vec::<std::alloc::Global>` in constants
+  --> $DIR/E0010-teach.rs:5:23
+   |
+LL | const CON: Vec<i32> = vec![1, 2, 3];
+   |                       ^^^^^^^^^^^^^
+   |
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0010`.
+Some errors have detailed explanations: E0010, E0015.
+For more information about an error, try `rustc --explain E0010`.
diff --git a/tests/ui/error-codes/E0010.rs b/tests/ui/error-codes/E0010.rs
index e62997640f4..11721efffcb 100644
--- a/tests/ui/error-codes/E0010.rs
+++ b/tests/ui/error-codes/E0010.rs
@@ -1,6 +1,5 @@
-#![feature(box_syntax)]
 #![allow(warnings)]
 
-const CON : Box<i32> = box 0; //~ ERROR E0010
-
+const CON: Vec<i32> = vec![1, 2, 3]; //~ ERROR E0010
+//~| ERROR cannot call non-const fn
 fn main() {}
diff --git a/tests/ui/error-codes/E0010.stderr b/tests/ui/error-codes/E0010.stderr
index 0042333b98a..08947222422 100644
--- a/tests/ui/error-codes/E0010.stderr
+++ b/tests/ui/error-codes/E0010.stderr
@@ -1,9 +1,21 @@
 error[E0010]: allocations are not allowed in constants
-  --> $DIR/E0010.rs:4:24
+  --> $DIR/E0010.rs:3:23
    |
-LL | const CON : Box<i32> = box 0;
-   |                        ^^^^^ allocation not allowed in constants
+LL | const CON: Vec<i32> = vec![1, 2, 3];
+   |                       ^^^^^^^^^^^^^ allocation not allowed in constants
+   |
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0015]: cannot call non-const fn `slice::<impl [i32]>::into_vec::<std::alloc::Global>` in constants
+  --> $DIR/E0010.rs:3:23
+   |
+LL | const CON: Vec<i32> = vec![1, 2, 3];
+   |                       ^^^^^^^^^^^^^
+   |
+   = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0010`.
+Some errors have detailed explanations: E0010, E0015.
+For more information about an error, try `rustc --explain E0010`.