refactor the normalization in coerce_shared_info#158659
Conversation
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| target.peel_refs(), | ||
| source_field_span, | ||
| ) | ||
| .is_ok() |
There was a problem hiding this comment.
okay, this code is weird.
- we don't do this
relatein a probe, so if this errors, any e.g. region constraints from it stick around - we don't check region constraints here?
- same with the
relatefurther down, which also doesn't happen in acommit_if_okand we don't check region constraints here either - also, no need to create a new
ObligationCtxtin this branch
There was a problem hiding this comment.
i really like the way the EvalCtxt taints itself when encountering an error so that trying to do operations in the same snapshot then ICEs.
This feels very useful to me and I would love to also extend that to InferCtxt in general is harder as we want to continue to collect errors in e.g. typeck even if normalization fails for some part of our type. We just set that type to a ´{type error}` and continue 🤔 unsure whether there's anything to protect users of the type system from mistakes like this
There was a problem hiding this comment.
please either fix these issues or add FIXME(the_relevant_feature) here :>
This is pre-requisite of removing
eq_structurally_relating_aliaseswhich is part of #155345.coerce_shared_infois only used in the unstable featurereborrowwhich provides aCoerceSharedtrait indicating a mutable borrow can be converted into a shared borrow.I think using
deeply_normalizeis more suitable for these identity instantiated types.No reason to allow ambiguous normalization and use infer vars as normalization result here.
r? lcnr