11error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time
2- --> $DIR/check-values-constraints.rs:64 :7
2+ --> $DIR/check-values-constraints.rs:65 :7
33 |
44LL | ..SafeStruct {
55 | _______^
@@ -11,28 +11,8 @@ LL | | }
1111LL | };
1212 | - value is dropped here
1313
14- error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
15- --> $DIR/check-values-constraints.rs:81:33
16- |
17- LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
18- | ^^^^^^^^^^^^^
19- |
20- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
21- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
22-
23- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
24- --> $DIR/check-values-constraints.rs:81:33
25- |
26- LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
27- | ^^^^^^^^^^^^^
28- |
29- note: function `box_assume_init_into_vec_unsafe` is not const
30- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
31- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
32- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
33-
3414error[E0015]: cannot call non-const method `<str as ToString>::to_string` in statics
35- --> $DIR/check-values-constraints.rs:92 :38
15+ --> $DIR/check-values-constraints.rs:91 :38
3616 |
3717LL | field2: SafeEnum::Variant4("str".to_string()),
3818 | ^^^^^^^^^^^
@@ -47,128 +27,24 @@ note: method `to_string` is not const because trait `ToString` is not const
4727 = note: calls in statics are limited to constant functions, tuple structs and tuple variants
4828 = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
4929
50- error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
51- --> $DIR/check-values-constraints.rs:96:5
52- |
53- LL | vec![MyOwned],
54- | ^^^^^^^^^^^^^
55- |
56- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
57- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
58-
59- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
60- --> $DIR/check-values-constraints.rs:96:5
61- |
62- LL | vec![MyOwned],
63- | ^^^^^^^^^^^^^
64- |
65- note: function `box_assume_init_into_vec_unsafe` is not const
66- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
67- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
68- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
69-
70- error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
71- --> $DIR/check-values-constraints.rs:98:5
72- |
73- LL | vec![MyOwned],
74- | ^^^^^^^^^^^^^
75- |
76- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
77- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
78-
79- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
80- --> $DIR/check-values-constraints.rs:98:5
81- |
82- LL | vec![MyOwned],
83- | ^^^^^^^^^^^^^
84- |
85- note: function `box_assume_init_into_vec_unsafe` is not const
86- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
87- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
88- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
89-
90- error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
91- --> $DIR/check-values-constraints.rs:103:6
92- |
93- LL | &vec![MyOwned],
94- | ^^^^^^^^^^^^^
95- |
96- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
97- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
98-
99- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
100- --> $DIR/check-values-constraints.rs:103:6
101- |
102- LL | &vec![MyOwned],
103- | ^^^^^^^^^^^^^
104- |
105- note: function `box_assume_init_into_vec_unsafe` is not const
106- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
107- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
108- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
109-
110- error[E0015]: cannot call non-const associated function `Box::<[MyOwned; 1]>::new_uninit` in statics
111- --> $DIR/check-values-constraints.rs:105:6
112- |
113- LL | &vec![MyOwned],
114- | ^^^^^^^^^^^^^
115- |
116- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
117- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
118-
119- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<MyOwned, 1>` in statics
120- --> $DIR/check-values-constraints.rs:105:6
121- |
122- LL | &vec![MyOwned],
123- | ^^^^^^^^^^^^^
124- |
125- note: function `box_assume_init_into_vec_unsafe` is not const
126- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
127- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
128- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
129-
130- error[E0015]: cannot call non-const associated function `Box::<[isize; 1]>::new_uninit` in statics
131- --> $DIR/check-values-constraints.rs:111:31
30+ error: encountered `const_allocate` pointer in final value that was not made global
31+ --> $DIR/check-values-constraints.rs:106:1
13232 |
13333LL | static STATIC19: Vec<isize> = vec![3];
134- | ^^^^^^^
34+ | ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^
13535 |
136- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
137- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
138-
139- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<isize, 1>` in statics
140- --> $DIR/check-values-constraints.rs:111:31
141- |
142- LL | static STATIC19: Vec<isize> = vec![3];
143- | ^^^^^^^
144- |
145- note: function `box_assume_init_into_vec_unsafe` is not const
146- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
147- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
148- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
36+ = note: use `const_make_global` to turn allocated pointers into immutable globals before returning
14937
150- error[E0015]: cannot call non-const associated function `Box::<[isize; 1]>::new_uninit` in statics
151- --> $DIR/check-values-constraints.rs:117:32
38+ error: encountered `const_allocate` pointer in final value that was not made global
39+ --> $DIR/check-values-constraints.rs:112:9
15240 |
15341LL | static x: Vec<isize> = vec![3];
154- | ^^^^^^^
42+ | ^^^^^^^^^^^^^ ^^^^^^^
15543 |
156- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
157- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
158-
159- error[E0015]: cannot call non-const function `std::boxed::box_assume_init_into_vec_unsafe::<isize, 1>` in statics
160- --> $DIR/check-values-constraints.rs:117:32
161- |
162- LL | static x: Vec<isize> = vec![3];
163- | ^^^^^^^
164- |
165- note: function `box_assume_init_into_vec_unsafe` is not const
166- --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
167- = note: calls in statics are limited to constant functions, tuple structs and tuple variants
168- = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
44+ = note: use `const_make_global` to turn allocated pointers into immutable globals before returning
16945
17046error[E0507]: cannot move out of static item `x`
171- --> $DIR/check-values-constraints.rs:119 :9
47+ --> $DIR/check-values-constraints.rs:114 :9
17248 |
17349LL | x
17450 | ^ move occurs because `x` has type `Vec<isize>`, which does not implement the `Copy` trait
@@ -182,7 +58,7 @@ help: consider cloning the value if the performance cost is acceptable
18258LL | x.clone()
18359 | ++++++++
18460
185- error: aborting due to 17 previous errors
61+ error: aborting due to 5 previous errors
18662
18763Some errors have detailed explanations: E0015, E0493, E0507.
18864For more information about an error, try `rustc --explain E0015`.
0 commit comments