@@ -132,18 +132,18 @@ fn test_discriminant_send_sync() { |
|
|
132 |
132 |
|
133 |
133 |
#[test] |
134 |
134 |
fn test_const_forget() { |
135 |
|
-const fn test_const_forget<T>(x: T) { |
136 |
|
-forget(x); |
137 |
|
-} |
|
135 |
+const _: () = forget(0i32); |
|
136 |
+const _: () = forget(Vec::<Vec<Box<i32>>>::new()); |
138 |
137 |
|
139 |
138 |
// Writing this function signature without const-forget |
140 |
139 |
// triggers compiler errors: |
141 |
140 |
// 1) That we use a non-const fn inside a const fn |
142 |
141 |
// 2) without the forget, it complains about the destructor of Box |
143 |
|
-const fn const_forget_box<T>(mut x: Box<T>) { |
|
142 |
+const fn const_forget_box<T>(x: Box<T>) { |
144 |
143 |
forget(x); |
145 |
144 |
} |
146 |
145 |
|
147 |
|
-const _: () = test_const_forget(0i32); |
148 |
|
-const _: () = test_const_forget(Vec::<Vec<Box<i32>>>::new()); |
|
146 |
+// Call the forget_box at runtime, |
|
147 |
+// as we can't const-construct a box yet. |
|
148 |
+const_forget_box(Box::new(0i32)); |
149 |
149 |
} |