Skip to content

Commit af35dc2

Browse files
authored
Rollup merge of #94805 - oli-obk:drop_box, r=pnkfelix
Revert accidental stabilization fixes #94804
2 parents fa685a5 + 5f7ca55 commit af35dc2

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

library/alloc/src/boxed.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11701170
}
11711171

11721172
#[stable(feature = "rust1", since = "1.0.0")]
1173-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1174-
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> const Drop for Box<T, A> {
1173+
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
11751174
fn drop(&mut self) {
11761175
// FIXME: Do nothing, drop is currently performed by compiler.
11771176
}

library/alloc/tests/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn const_box() {
160160
*boxed = 42;
161161
assert!(*boxed == 42);
162162

163-
*boxed
163+
*Box::leak(boxed)
164164
};
165165

166166
assert!(VALUE == 42);

src/test/ui/consts/drop_box.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const fn f<T>(_: Box<T>) {}
2+
//~^ ERROR destructors cannot be evaluated at compile-time
3+
4+
fn main() {}

src/test/ui/consts/drop_box.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0493]: destructors cannot be evaluated at compile-time
2+
--> $DIR/drop_box.rs:1:15
3+
|
4+
LL | const fn f<T>(_: Box<T>) {}
5+
| ^ - value is dropped here
6+
| |
7+
| constant functions cannot evaluate destructors
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0493`.

0 commit comments

Comments
 (0)