You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a bit of a hack here, which I don't love, but the other ways I
could think of doing this were substantially messier. I'll be saving
that for a separate commit to reduce the noise in this one. I also
haven't written that separate commit yet though, since I'm not convinced
the alternatives I've thought of are better than this. Please let me
know if one of these (or better yet, something else) sounds good:
- The callback argument to `cat_pattern` could take a
`PatOrAdjust<'hir>` enum instead of a `Pat<'hir>`, which would
correspond either to a (potentially scrutinee-borrowing) pattern or a
(currently definitely scrutinee-borrowing) implicit overloaded deref.
Matching on `PatOrAdjust` is really noisy, unfortunately, and would
require a separate `cat_pattern_unadjusted` helper that bypasses it to
avoid reindenting `maybe_read_scrutinee`.
- `cat_pattern` could invoke the delegate's `borrow` callback directly.
This results in some repeated work between `walk_pat` and
`maybe_read_scrutinee` for refutable patterns (but hopefully that
wouldn't have correctness implications..?). `cat_pattern` would also
need to take the `HirId` of the top-level scrutinee expression as an
argument for use in diagnostics.
0 commit comments