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.

165 lines
7.6 KiB
Plaintext
Raw Normal View History

error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time
--> $DIR/check-static-values-constraints.rs:64:7
2018-08-08 12:28:26 +00:00
|
LL | ..SafeStruct {
| _______^
2019-03-09 12:03:44 +00:00
LL | |
LL | | field1: SafeEnum::Variant3(WithDtor),
LL | | field2: SafeEnum::Variant1,
LL | | }
| |_____^ the destructor for this type cannot be evaluated in statics
LL | };
| - value is dropped here
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:81:33
2018-08-08 12:28:26 +00:00
|
LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
| ^^^^^^^^^^^^^ allocation not allowed in statics
|
= 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 [MyOwned]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:81:33
|
LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
| ^^^^^^^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
2021-12-09 17:10:05 +00:00
error[E0015]: cannot call non-const fn `<str as ToString>::to_string` in statics
--> $DIR/check-static-values-constraints.rs:92:38
2018-08-08 12:28:26 +00:00
|
LL | field2: SafeEnum::Variant4("str".to_string()),
2021-12-09 17:10:05 +00:00
| ^^^^^^^^^^^
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
2022-12-22 18:15:15 +00: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 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:96:5
2018-08-08 12:28:26 +00:00
|
LL | vec![MyOwned],
| ^^^^^^^^^^^^^ allocation not allowed in statics
|
= 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 [MyOwned]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:96:5
|
LL | vec![MyOwned],
| ^^^^^^^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:98:5
|
LL | vec![MyOwned],
| ^^^^^^^^^^^^^ allocation not allowed in statics
|
= 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 [MyOwned]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:98:5
|
LL | vec![MyOwned],
| ^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:103:6
|
LL | &vec![MyOwned],
| ^^^^^^^^^^^^^ allocation not allowed in statics
|
= 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 [MyOwned]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:103:6
2018-08-08 12:28:26 +00:00
|
LL | &vec![MyOwned],
| ^^^^^^^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:105:6
2018-08-08 12:28:26 +00:00
|
LL | &vec![MyOwned],
| ^^^^^^^^^^^^^ allocation not allowed in statics
|
= 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 [MyOwned]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:105:6
|
LL | &vec![MyOwned],
| ^^^^^^^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:111:31
2018-08-08 12:28:26 +00:00
|
LL | static STATIC19: Vec<isize> = vec![3];
| ^^^^^^^ allocation not allowed in statics
|
= 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 [isize]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:111:31
|
LL | static STATIC19: Vec<isize> = vec![3];
| ^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error[E0507]: cannot move out of static item `x`
--> $DIR/check-static-values-constraints.rs:119:9
2018-08-08 12:28:26 +00:00
|
LL | x
| ^ move occurs because `x` has type `Vec<isize>`, which does not implement the `Copy` trait
|
help: consider borrowing here
|
LL | &x
| +
2018-08-08 12:28:26 +00:00
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:117:32
|
LL | static x: Vec<isize> = vec![3];
| ^^^^^^^ allocation not allowed in statics
2018-08-08 12:28:26 +00:00
|
= 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 [isize]>::into_vec::<std::alloc::Global>` in statics
--> $DIR/check-static-values-constraints.rs:117:32
|
LL | static x: Vec<isize> = vec![3];
| ^^^^^^^
|
= 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
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 12:28:26 +00:00
error: aborting due to 17 previous errors
2018-08-08 12:28:26 +00:00
2020-09-30 00:31:04 +00:00
Some errors have detailed explanations: E0010, E0015, E0493, E0507.
2018-08-08 12:28:26 +00:00
For more information about an error, try `rustc --explain E0010`.