-
-
Notifications
You must be signed in to change notification settings - Fork 17.2k
slice::from_raw_parts returns a different address in const context for u8 #105536
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-sliceArea: `[T]`Area: `[T]`C-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-sliceArea: `[T]`Area: `[T]`C-bugCategory: This is a bug.Category: This is a bug.T-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.
Possibly as a result of some u8-specific optimizations, a const
&[u8]returned bystd::slice::from_raw_partshas a different address than all other uses of the same expression. Forum discussion.I tried this code:
Playground
I expected to see this happen: All assertions should pass.
Instead, this happened:
Meta
rustc --version --verbose:Backtrace