File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
src/librustc_mir_build/hair/pattern Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -885,22 +885,10 @@ impl<'tcx> Constructor<'tcx> {
885
885
// 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
- let allowed_to_inspect = is_visible
889
- && match ( is_non_exhaustive, is_uninhabited) {
890
- // Treat all uninhabited types in non-exhaustive variants as
891
- // `TyErr`.
892
- ( true , true ) => false ,
893
- ( _, _) => {
894
- match ty. kind {
895
- // If the field type returned is an array of an unknown
896
- // size return an TyErr.
897
- ty:: Array ( _, len) => len
898
- . try_eval_usize ( cx. tcx , cx. param_env )
899
- . is_some ( ) ,
900
- _ => true ,
901
- }
902
- }
903
- } ;
888
+ // Also treat all uninhabited types in non-exhaustive variants as
889
+ // `TyErr`.
890
+ let allowed_to_inspect =
891
+ is_visible && !( is_non_exhaustive && is_uninhabited) ;
904
892
905
893
if allowed_to_inspect {
906
894
Pat :: wildcard_from_ty ( ty)
You can’t perform that action at this time.
0 commit comments