-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
ConstantIndex and Index not flagged as potential aliases #160525
Copy link
Copy link
Open
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-arrayArea: `[T; N]`Area: `[T; N]`A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-arrayArea: `[T; N]`Area: `[T; N]`A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
I tried this code (playpen):
I expected to see this happen: Compiler rejects code as unsound.
Instead, this happened: Compiler accepts code and prints a garbage number.
When run under Miri, we see this output:
Hypothesis: after a
move _1[ConstantIndex{0 of 1}], a subsequent use of_1[Index(_6)]is not flagged as a use-of-partially-moved. The "any subpath moved" check of borrowck treatsConstantIndexas a sibling of a runtimeIndexprojection, rather than a potential alias.Meta
Nightly channel
Build using the Nightly version: 1.99.0-nightly
(2026-08-03 5048696)