pin!()
macro no longer constant-promotes &mut
references to empty arrays
#142345
Labels
A-pin
Area: Pin
C-bug
Category: This is a bug.
F-super_let
it's super, let's go!
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
Code
I tried this code:
I expected to see this happen: The code compiles
Instead, this happened (when compiled with beta rust):
See also #140126, which is about the fact that
&mut
references to empty arrays are, for some reason, sometimes allowed in const contexts.This was found while messing around. I don't know if any code relies on this.
Version it worked on
It most recently worked on: stable Rust 1.87.0
Version with regression
The error is reproducible on the playground with
1.88.0-beta.5 (2025-06-01 645b44edd3717f02838d)
The regression presumably happened due to #139114. cc @m-ou-se
@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged A-pin F-super_let
The text was updated successfully, but these errors were encountered: