rust/tests/ui/check-static-values-constraints.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
3.3 KiB
Plaintext
Raw Normal View History

error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time
2018-12-25 09:56:47 -06:00
--> $DIR/check-static-values-constraints.rs:65:43
2018-08-08 07:28:26 -05:00
|
LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor),
| ___________________________________________^
2019-03-09 06:03:44 -06:00
LL | |
2018-08-08 07:28:26 -05:00
LL | | field2: SafeEnum::Variant1}};
2020-06-20 15:38:57 -05:00
| | ^- value is dropped here
| |________________________________________________________________________________|
| the destructor for this type cannot be evaluated in statics
2018-08-08 07:28:26 -05:00
error[E0010]: allocations are not allowed in statics
2018-12-25 09:56:47 -06:00
--> $DIR/check-static-values-constraints.rs:79:33
2018-08-08 07:28:26 -05:00
|
LL | static STATIC11: Box<MyOwned> = box MyOwned;
| ^^^^^^^^^^^ allocation not allowed in statics
2021-12-09 11:10:05 -06:00
error[E0015]: cannot call non-const fn `<str as ToString>::to_string` in statics
--> $DIR/check-static-values-constraints.rs:89:38
2018-08-08 07:28:26 -05:00
|
LL | field2: SafeEnum::Variant4("str".to_string())
2021-12-09 11:10:05 -06:00
| ^^^^^^^^^^^
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
2022-12-22 12:15:15 -06:00
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
2018-08-08 07:28:26 -05:00
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:94:5
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | box MyOwned,
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^ allocation not allowed in statics
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:95:5
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | box MyOwned,
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^ allocation not allowed in statics
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:99:6
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | &box MyOwned,
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^ allocation not allowed in statics
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:100:6
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | &box MyOwned,
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^ allocation not allowed in statics
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:106:5
2018-08-08 07:28:26 -05:00
|
LL | box 3;
| ^^^^^ allocation not allowed in statics
error[E0507]: cannot move out of static item `x`
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:110:45
2018-08-08 07:28:26 -05:00
|
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 };
| +
2018-08-08 07:28:26 -05:00
error[E0010]: allocations are not allowed in statics
2020-09-29 19:31:04 -05:00
--> $DIR/check-static-values-constraints.rs:110:38
2018-08-08 07:28:26 -05:00
|
LL | let y = { static x: Box<isize> = box 3; x };
| ^^^^^ allocation not allowed in statics
2020-09-29 19:31:04 -05:00
error: aborting due to 10 previous errors
2018-08-08 07:28:26 -05:00
2020-09-29 19:31:04 -05:00
Some errors have detailed explanations: E0010, E0015, E0493, E0507.
2018-08-08 07:28:26 -05:00
For more information about an error, try `rustc --explain E0010`.