Closed
Description
Code
I tried this code:
const _: () = core::mem::forget(Box::<u32>::default); // ERROR
const _: () = core::mem::forget(|| Box::<u32>::default()); // ok
I expected to see this happen: Successful compilation
Instead, this happened:
error[E0277]: the trait bound `Box<u32>: Default` is not satisfied
--> src/lib.rs:1:15
|
1 | const _: () = core::mem::forget(Box::<u32>::default);
| ^^^^^^^^^^^^^^^^^ the trait `~const Default` is not implemented for `Box<u32>`
|
note: the trait `Default` is implemented for `Box<u32>`, but that implementation is not `const`
--> src/lib.rs:1:15
|
1 | const _: () = core::mem::forget(Box::<u32>::default);
| ^^^^^^^^^^^^^^^^^
Version it worked on
It most recently worked on: 1.65.0
Version with regression
rustc --version --verbose
:
rustc 1.66.0-beta.1 (e080cc5a6 2022-11-01)
binary: rustc
commit-hash: e080cc5a659fb760c0bc561b722a790dad35b5e1
commit-date: 2022-11-01
host: aarch64-apple-darwin
release: 1.66.0-beta.1
LLVM version: 15.0.2
@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged