This is fine:
checked_captures.push(match capture {
ByValue(name, span) => CheckedCapture::ByValue(name, span)
ByReference(name, span) => CheckedCapture::ByReference(name, span)
ByMutableReference(name, span) => CheckedCapture::ByMutableReference(name, span)
AllByReference(span) => {
.compiler.panic("AllByReference capture should not be looked up by name")
}
})
This is not, and gives us Type mismatch: expected ‘CheckedCapture’, but got ‘never’
:
checked_captures.push(match capture {
ByValue(name, span) => CheckedCapture::ByValue(name, span)
ByReference(name, span) => CheckedCapture::ByReference(name, span)
ByMutableReference(name, span) => CheckedCapture::ByMutableReference(name, span)
AllByReference(span) => .compiler.panic("AllByReference capture should not be looked up by name")
})
This turns out to be intended behaviour: the short => foo
syntax can only be used for yielding values. However, a nicer error message when a match has a type mismatch with never
, would be very helpful! It should tell you that you need to wrap it in {}
.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too