Address final nits
This commit is contained in:
parent
9d200f2d88
commit
e5376f3947
@ -130,13 +130,14 @@ enum AdjustMode {
|
|||||||
/// Peel off all immediate reference types.
|
/// Peel off all immediate reference types.
|
||||||
Peel,
|
Peel,
|
||||||
/// Reset binding mode to the initial mode.
|
/// Reset binding mode to the initial mode.
|
||||||
|
/// Used for destructuring assignment, where we don't want any match ergonomics.
|
||||||
Reset,
|
Reset,
|
||||||
/// Produced by ref patterns.
|
/// Produced by ref patterns.
|
||||||
/// Reset the binding mode to the initial mode,
|
/// Reset the binding mode to the initial mode,
|
||||||
/// and if the old biding mode was by-reference
|
/// and if the old biding mode was by-reference
|
||||||
/// with mutability matching the pattern,
|
/// with mutability matching the pattern,
|
||||||
/// mark the pattern as having consumed this reference.
|
/// mark the pattern as having consumed this reference.
|
||||||
RefReset(Mutability),
|
ResetAndConsumeRef(Mutability),
|
||||||
/// Pass on the input binding mode and expected type.
|
/// Pass on the input binding mode and expected type.
|
||||||
Pass,
|
Pass,
|
||||||
}
|
}
|
||||||
@ -292,7 +293,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
match adjust_mode {
|
match adjust_mode {
|
||||||
AdjustMode::Pass => (expected, def_bm, false),
|
AdjustMode::Pass => (expected, def_bm, false),
|
||||||
AdjustMode::Reset => (expected, INITIAL_BM, false),
|
AdjustMode::Reset => (expected, INITIAL_BM, false),
|
||||||
AdjustMode::RefReset(mutbl) => (expected, INITIAL_BM, def_bm.0 == ByRef::Yes(mutbl)),
|
AdjustMode::ResetAndConsumeRef(mutbl) => {
|
||||||
|
(expected, INITIAL_BM, def_bm.0 == ByRef::Yes(mutbl))
|
||||||
|
}
|
||||||
AdjustMode::Peel => {
|
AdjustMode::Peel => {
|
||||||
let peeled = self.peel_off_references(pat, expected, def_bm);
|
let peeled = self.peel_off_references(pat, expected, def_bm);
|
||||||
(peeled.0, peeled.1, false)
|
(peeled.0, peeled.1, false)
|
||||||
@ -351,7 +354,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// See issue #46688.
|
// See issue #46688.
|
||||||
PatKind::Ref(_, mutbl) => AdjustMode::RefReset(*mutbl),
|
PatKind::Ref(_, mutbl) => AdjustMode::ResetAndConsumeRef(*mutbl),
|
||||||
// A `_` pattern works with any expected type, so there's no need to do anything.
|
// A `_` pattern works with any expected type, so there's no need to do anything.
|
||||||
PatKind::Wild
|
PatKind::Wild
|
||||||
// A malformed pattern doesn't have an expected type, so let's just accept any type.
|
// A malformed pattern doesn't have an expected type, so let's just accept any type.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user