File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/librustc_mir_build/hair/pattern Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -880,15 +880,15 @@ impl<'tcx> Constructor<'tcx> {
880
880
let ty = field. ty ( cx. tcx , substs) ;
881
881
let is_visible = adt. is_enum ( )
882
882
|| field. vis . is_accessible_from ( cx. module , cx. tcx ) ;
883
- let is_uninhabited = cx. is_uninhabited ( ty) ;
884
- // Treat all non-visible fields as `TyErr`. They can't appear
885
- // in any other pattern from this match (because they are
883
+ let is_inhabited = ! cx. is_uninhabited ( ty) ;
884
+ // Treat all uninhabited non-visible fields as `TyErr`. They can't
885
+ // appear in any other pattern from this match (because they are
886
886
// private), so their type does not matter - but we don't want
887
887
// to know they are uninhabited.
888
888
// Also treat all uninhabited types in non-exhaustive variants as
889
889
// `TyErr`.
890
890
let allowed_to_inspect =
891
- is_visible && ! ( is_non_exhaustive && is_uninhabited ) ;
891
+ is_inhabited || ( is_visible && !is_non_exhaustive ) ;
892
892
893
893
if allowed_to_inspect {
894
894
Pat :: wildcard_from_ty ( ty)
You can’t perform that action at this time.
0 commit comments