Skip to content

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

Closed
@tmiasko

Description

@tmiasko

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

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-destructorsArea: Destructors (`Drop`, …)C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions