rust/compiler/rustc_mir_build
Daniel Noom 998bf0ab88 Add note to non-exhaustive match on reference to empty
Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.

I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.

Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.

This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.

Fixes #78123
2021-01-03 19:05:23 +01:00
..
src Add note to non-exhaustive match on reference to empty 2021-01-03 19:05:23 +01:00
Cargo.toml