188 lines
7.9 KiB
Text
188 lines
7.9 KiB
Text
error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time
|
|
--> $DIR/check-values-constraints.rs:64:7
|
|
|
|
|
LL | ..SafeStruct {
|
|
| _______^
|
|
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
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
|
|
--> $DIR/check-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 `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:81:33
|
|
|
|
|
LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const method `<str as ToString>::to_string` in statics
|
|
--> $DIR/check-values-constraints.rs:92:38
|
|
|
|
|
LL | field2: SafeEnum::Variant4("str".to_string()),
|
|
| ^^^^^^^^^^^
|
|
|
|
|
note: method `to_string` is not const because trait `ToString` is not const
|
|
--> $SRC_DIR/alloc/src/string.rs:LL:COL
|
|
|
|
|
= note: this trait is not const
|
|
::: $SRC_DIR/alloc/src/string.rs:LL:COL
|
|
|
|
|
= note: this method is not const
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
|
|
--> $DIR/check-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 `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:96:5
|
|
|
|
|
LL | vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
|
|
--> $DIR/check-values-constraints.rs:98:5
|
|
|
|
|
LL | vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:98:5
|
|
|
|
|
LL | vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
|
|
--> $DIR/check-values-constraints.rs:103:6
|
|
|
|
|
LL | &vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:103:6
|
|
|
|
|
LL | &vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
|
|
--> $DIR/check-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 `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:105:6
|
|
|
|
|
LL | &vec![MyOwned],
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[isize; 1]>::new_uninit` in statics
|
|
--> $DIR/check-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 `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<isize, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:111:31
|
|
|
|
|
LL | static STATIC19: Vec<isize> = vec![3];
|
|
| ^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const associated function `Box::<[isize; 1]>::new_uninit` in statics
|
|
--> $DIR/check-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 `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<isize, 1>` in statics
|
|
--> $DIR/check-values-constraints.rs:117:32
|
|
|
|
|
LL | static x: Vec<isize> = vec![3];
|
|
| ^^^^^^^
|
|
|
|
|
note: function `box_assume_init_into_vec_unsafe` is not const
|
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
= note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
|
|
|
error[E0507]: cannot move out of static item `x`
|
|
--> $DIR/check-values-constraints.rs:119:9
|
|
|
|
|
LL | x
|
|
| ^ move occurs because `x` has type `Vec<isize>`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider borrowing here
|
|
|
|
|
LL | &x
|
|
| +
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | x.clone()
|
|
| ++++++++
|
|
|
|
error: aborting due to 17 previous errors
|
|
|
|
Some errors have detailed explanations: E0015, E0493, E0507.
|
|
For more information about an error, try `rustc --explain E0015`.
|