about summary refs log tree commit diff
path: root/tests/ui/check-static-values-constraints.stderr
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/check-static-values-constraints.stderr
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'tests/ui/check-static-values-constraints.stderr')
-rw-r--r--tests/ui/check-static-values-constraints.stderr77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/ui/check-static-values-constraints.stderr b/tests/ui/check-static-values-constraints.stderr
new file mode 100644
index 00000000000..b13700a4ea5
--- /dev/null
+++ b/tests/ui/check-static-values-constraints.stderr
@@ -0,0 +1,77 @@
+error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time
+  --> $DIR/check-static-values-constraints.rs:65:43
+   |
+LL |                                           ..SafeStruct{field1: SafeEnum::Variant3(WithDtor),
+   |  ___________________________________________^
+LL | |
+LL | |                                                      field2: SafeEnum::Variant1}};
+   | |                                                                                ^- value is dropped here
+   | |________________________________________________________________________________|
+   |                                                                                  the destructor for this type cannot be evaluated in statics
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:79:33
+   |
+LL | static STATIC11: Box<MyOwned> = box MyOwned;
+   |                                 ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0015]: cannot call non-const fn `<str as ToString>::to_string` in statics
+  --> $DIR/check-static-values-constraints.rs:89:38
+   |
+LL |     field2: SafeEnum::Variant4("str".to_string())
+   |                                      ^^^^^^^^^^^
+   |
+   = note: calls in statics are limited to constant functions, tuple structs and tuple variants
+   = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:94:5
+   |
+LL |     box MyOwned,
+   |     ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:95:5
+   |
+LL |     box MyOwned,
+   |     ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:99:6
+   |
+LL |     &box MyOwned,
+   |      ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:100:6
+   |
+LL |     &box MyOwned,
+   |      ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:106:5
+   |
+LL |     box 3;
+   |     ^^^^^ allocation not allowed in statics
+
+error[E0507]: cannot move out of static item `x`
+  --> $DIR/check-static-values-constraints.rs:110:45
+   |
+LL |     let y = { static x: Box<isize> = box 3; x };
+   |                                             ^ move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait
+   |
+help: consider borrowing here
+   |
+LL |     let y = { static x: Box<isize> = box 3; &x };
+   |                                             +
+
+error[E0010]: allocations are not allowed in statics
+  --> $DIR/check-static-values-constraints.rs:110:38
+   |
+LL |     let y = { static x: Box<isize> = box 3; x };
+   |                                      ^^^^^ allocation not allowed in statics
+
+error: aborting due to 10 previous errors
+
+Some errors have detailed explanations: E0010, E0015, E0493, E0507.
+For more information about an error, try `rustc --explain E0010`.