We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcc2321 commit 0760803Copy full SHA for 0760803
src/libcore/tests/mem.rs
@@ -134,4 +134,16 @@ fn test_discriminant_send_sync() {
134
fn test_const_forget() {
135
const _: () = forget(0i32);
136
const _: () = forget(Vec::<Vec<Box<i32>>>::new());
137
+
138
+ // Writing this function signature without const-forget
139
+ // triggers compiler errors:
140
+ // 1) That we use a non-const fn inside a const fn
141
+ // 2) without the forget, it complains about the destructor of Box
142
+ //
143
+ // FIXME: this method cannot be called in const-eval yet, as Box isn't
144
+ // const constructable
145
+ #[allow(unused)]
146
+ const fn const_forget_box<T: ?Sized>(x: Box<T>) {
147
+ forget(x);
148
+ }
149
}
0 commit comments