Mutable closure captures through opaque casts - #160150
Conversation
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
a35616e to
89bb76d
Compare
|
Some changes occurred in cc @BoxyUwU Some changes occurred in match checking cc @Nadrieril |
|
r? @khyperia rustbot has assigned @khyperia. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Would you mind describing a bit why a new THIR ExprKind is needed? This seems like it's a bug with the old solver, the new solver is able to error on this without requiring a new THIR node kind. How is it able to do so? Why is a new node kind needed for the old solver? If there's a good reason, do we want to only create this node kind if the old solver is in use? |
|
@khyperia I tried replacing the captured place's opaque base type with the hidden type instead but the actual MIR local remains opaque. projecting a field from it without |
|
I feel fairly uncomfortable with changes here and think that The new solver handles this correctly by normalizing opaque types in the defining scope. I think we should keep #160120 as an error with the old solver as properly fixing this requires properly normalizing opaque types which is too large of a change given the impending next-solver stabilization |
|
@lcnr that makes sense thanks for clarifying. I’ll close the PR then |
fixes #160120
Preserve place semantics for opaque projections in closure captures instead of lowering them through
ExprKind::Useand ensures mutable captures through TAIT opaque casts are validated by borrowck with both solvers