Type inference not working well with ptr mutability #124665
Labels
A-inference
Area: Type inference
C-bug
Category: This is a bug.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: the code compiles successfully (but with unused warnings)
Instead, this happened: The compiler fails to infer the type of
addr
because it doesn't recognize that the type it inferred for immut_addr is always the same as the one cast_mut producesOn stable the compiler suggests to add
: *const _
to immut_addr as a type annotation, but after adding this, it errors the same way it did before.Meta
rustc --version --verbose
:This happens both on stable (1.78) and on the latest nightly
Output
The text was updated successfully, but these errors were encountered: