-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Associated-const ranges in patterns are miscompiled in beta #57960
Copy link
Copy link
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from stable to beta.
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from stable to beta.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This code demonstrates the problem (playpen):
With stable-1.32.0 it prints
3. With beta-1.33.0 it wrongly prints1.Beta also produces these wrong warnings:
It seems that Rustc decides, that the first arm covers the whole range of a
u8and optimizes out the other arms before they even reach MIR.The code is very similar to this testcase.
But the testcase does not test that the other arms can be reached.
I was able to bisect the regression to #55937.
(This issue seems similar to #57894, but the reduced testcase there does not
use any associated consts)