Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta] backports + bootstrap bump #95061

Merged
merged 4 commits into from
Mar 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert accidental stabilization
(cherry picked from commit 5f7ca55)
  • Loading branch information
oli-obk authored and cuviper committed Mar 18, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ac796ac9faa2c9733fe2cf85ba766ac5f0b2f97b
3 changes: 1 addition & 2 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
@@ -1170,8 +1170,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> const Drop for Box<T, A> {
unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
fn drop(&mut self) {
// FIXME: Do nothing, drop is currently performed by compiler.
}
2 changes: 1 addition & 1 deletion library/alloc/tests/boxed.rs
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ fn const_box() {
*boxed = 42;
assert!(*boxed == 42);

*boxed
*Box::leak(boxed)
};

assert!(VALUE == 42);
4 changes: 4 additions & 0 deletions src/test/ui/consts/drop_box.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const fn f<T>(_: Box<T>) {}
//~^ ERROR destructors cannot be evaluated at compile-time

fn main() {}
11 changes: 11 additions & 0 deletions src/test/ui/consts/drop_box.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop_box.rs:1:15
|
LL | const fn f<T>(_: Box<T>) {}
| ^ - value is dropped here
| |
| constant functions cannot evaluate destructors

error: aborting due to previous error

For more information about this error, try `rustc --explain E0493`.