-
-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Match guard can both move and static-promote a single constant #145237
Copy link
Copy link
Open
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-constant-promotionArea: constant promotionArea: constant promotionA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Description
Activity
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-constant-promotionArea: constant promotionArea: constant promotionA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
View all comments
I'm not sure if this is a bug or not.
I expected the below code to produce a compile error, but instead it compiles fine.
It seems that the single
Thingconstant is both moved and static-promoted. This seems very strange.Related to #144939. Discovered in #141295 (comment).
@rustbot labels +A-patterns +A-const-eval
Meta
Reproduces on the playground with version
1.91.0-nightly (2025-08-09 ca77504943887037504c)