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

regression: destructor of [MaybeUninit<T>; N] cannot be evaluated at compile-time #115410

Closed
tmiasko opened this issue Aug 31, 2023 · 1 comment · Fixed by #115527
Closed

regression: destructor of [MaybeUninit<T>; N] cannot be evaluated at compile-time #115410

tmiasko opened this issue Aug 31, 2023 · 1 comment · Fixed by #115527
Assignees
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-destructors Area: destructors (Drop, ..) C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tmiasko
Copy link
Contributor

tmiasko commented Aug 31, 2023

Code

I tried this code:

pub const fn f<T, const N: usize>(_: [std::mem::MaybeUninit<T>; N]) {}

I expected it to compile successfully. Instead, this happened:

error[E0493]: destructor of `[MaybeUninit<T>; N]` cannot be evaluated at compile-time
 --> x.rs:1:35
  |
1 | pub const fn f<T, const N: usize>(_: [std::mem::MaybeUninit<T>; N]) {}
  |                                   ^                                  - value is dropped here
  |                                   |
  |                                   the destructor for this type cannot be evaluated in constant functions

Version it worked on

It most recently worked on 1.72

Version with regression

Regressed in aafd75a cc @fee1-dead @oli-obk

Originally reported in #115403 (comment) cc @itsxaos

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@tmiasko tmiasko added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Aug 31, 2023
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-untriaged Untriaged performance or correctness regression. labels Aug 31, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 1, 2023
@oli-obk oli-obk self-assigned this Sep 4, 2023
@fmease fmease added A-destructors Area: destructors (Drop, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-eval Area: constant evaluation (mir interpretation) labels Sep 6, 2023
@apiraino
Copy link
Contributor

apiraino commented Sep 7, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 7, 2023
@bors bors closed this as completed in 1e746d7 Sep 7, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 12, 2023
Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are generic, if `T` requires `Drop`

fixes rust-lang/rust#115403
fixes rust-lang/rust#115410

This was accidentally regressed in rust-lang/rust#114134, because it was accidentally stabilized in #102204 (cc `@rust-lang/lang,` seems like an innocent stabilization, considering this PR is more of a bugfix than a feature).

While we have a whole month to beta backport this change before the regression hits stable, I'd still prefer not to go through an FCP on this PR (which fixes a regression), if T-lang wants an FCP, I can can open an issue about the change itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-destructors Area: destructors (Drop, ..) C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
6 participants