diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-12-28 20:05:22 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-01-09 10:20:12 +0100 |
| commit | 4b4fc63eb7745639c76c1f8011239354a1823547 (patch) | |
| tree | c505539d763b2879049ee5fe08cb1667da319685 /src/test/ui/error-codes | |
| parent | 167ceff01ec2f01f677fa6351646255d3dacbb98 (diff) | |
Stabilize `let` bindings and destructuring in constants and const fn
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0010-teach.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0010-teach.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0010.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0010.stderr | 11 |
4 files changed, 23 insertions, 4 deletions
diff --git a/src/test/ui/error-codes/E0010-teach.rs b/src/test/ui/error-codes/E0010-teach.rs index fc5dffb37cf..da51035ab55 100644 --- a/src/test/ui/error-codes/E0010-teach.rs +++ b/src/test/ui/error-codes/E0010-teach.rs @@ -4,5 +4,6 @@ #![allow(warnings)] const CON : Box<i32> = box 0; //~ ERROR E0010 +//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr index da0aadfded5..77e7b5ec0e8 100644 --- a/src/test/ui/error-codes/E0010-teach.stderr +++ b/src/test/ui/error-codes/E0010-teach.stderr @@ -6,6 +6,16 @@ LL | const CON : Box<i32> = box 0; //~ ERROR E0010 | = 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. -error: aborting due to previous error +error[E0019]: constant contains unimplemented expression type + --> $DIR/E0010-teach.rs:6:28 + | +LL | const CON : Box<i32> = box 0; //~ ERROR E0010 + | ^ + | + = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. + = note: Remember: you can't use a function call inside a const's initialization expression! However, you can use it anywhere else. + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors occurred: E0010, E0019. +For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/error-codes/E0010.rs b/src/test/ui/error-codes/E0010.rs index e62997640f4..3398e2c28ba 100644 --- a/src/test/ui/error-codes/E0010.rs +++ b/src/test/ui/error-codes/E0010.rs @@ -2,5 +2,6 @@ #![allow(warnings)] const CON : Box<i32> = box 0; //~ ERROR E0010 +//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr index b4b490922c4..1364693109e 100644 --- a/src/test/ui/error-codes/E0010.stderr +++ b/src/test/ui/error-codes/E0010.stderr @@ -4,6 +4,13 @@ error[E0010]: allocations are not allowed in constants LL | const CON : Box<i32> = box 0; //~ ERROR E0010 | ^^^^^ allocation not allowed in constants -error: aborting due to previous error +error[E0019]: constant contains unimplemented expression type + --> $DIR/E0010.rs:4:28 + | +LL | const CON : Box<i32> = box 0; //~ ERROR E0010 + | ^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors occurred: E0010, E0019. +For more information about an error, try `rustc --explain E0010`. |
