@@ -766,13 +766,13 @@ impl<'p, 'tcx> Witness<'p, 'tcx> {
766766/// `is_under_guard` is used to inform if the pattern has a guard. If it 
767767/// has one it must not be inserted into the matrix. This shouldn't be 
768768/// relied on for soundness. 
769- #[ instrument( level = "debug" ,  skip( cx,  matrix,  hir_id ) ,  ret) ]  
769+ #[ instrument( level = "debug" ,  skip( cx,  matrix,  lint_root ) ,  ret) ]  
770770fn  is_useful < ' p ,  ' tcx > ( 
771771    cx :  & MatchCheckCtxt < ' p ,  ' tcx > , 
772772    matrix :  & Matrix < ' p ,  ' tcx > , 
773773    v :  & PatStack < ' p ,  ' tcx > , 
774774    witness_preference :  ArmType , 
775-     hir_id :  HirId , 
775+     lint_root :  HirId , 
776776    is_under_guard :  bool , 
777777    is_top_level :  bool , 
778778)  -> Usefulness < ' p ,  ' tcx >  { 
@@ -805,7 +805,7 @@ fn is_useful<'p, 'tcx>(
805805        for  v in  v. expand_or_pat ( )  { 
806806            debug ! ( ?v) ; 
807807            let  usefulness = ensure_sufficient_stack ( || { 
808-                 is_useful ( cx,  & matrix,  & v,  witness_preference,  hir_id ,  is_under_guard,  false ) 
808+                 is_useful ( cx,  & matrix,  & v,  witness_preference,  lint_root ,  is_under_guard,  false ) 
809809            } ) ; 
810810            debug ! ( ?usefulness) ; 
811811            ret. extend ( usefulness) ; 
@@ -838,7 +838,7 @@ fn is_useful<'p, 'tcx>(
838838                pcx, 
839839                matrix. heads ( ) , 
840840                matrix. column_count ( ) . unwrap_or ( 0 ) , 
841-                 hir_id , 
841+                 lint_root , 
842842            ) 
843843        } 
844844        // We split the head constructor of `v`. 
@@ -853,7 +853,15 @@ fn is_useful<'p, 'tcx>(
853853            let  spec_matrix = start_matrix. specialize_constructor ( pcx,  & ctor) ; 
854854            let  v = v. pop_head_constructor ( pcx,  & ctor) ; 
855855            let  usefulness = ensure_sufficient_stack ( || { 
856-                 is_useful ( cx,  & spec_matrix,  & v,  witness_preference,  hir_id,  is_under_guard,  false ) 
856+                 is_useful ( 
857+                     cx, 
858+                     & spec_matrix, 
859+                     & v, 
860+                     witness_preference, 
861+                     lint_root, 
862+                     is_under_guard, 
863+                     false , 
864+                 ) 
857865            } ) ; 
858866            let  usefulness = usefulness. apply_constructor ( pcx,  start_matrix,  & ctor) ; 
859867
@@ -897,7 +905,7 @@ fn is_useful<'p, 'tcx>(
897905                // NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`. 
898906                cx. tcx . emit_spanned_lint ( 
899907                    NON_EXHAUSTIVE_OMITTED_PATTERNS , 
900-                     hir_id , 
908+                     lint_root , 
901909                    pcx. span , 
902910                    NonExhaustiveOmittedPattern  { 
903911                        scrut_ty :  pcx. ty , 
@@ -955,7 +963,7 @@ pub(crate) struct UsefulnessReport<'p, 'tcx> {
955963pub ( crate )  fn  compute_match_usefulness < ' p ,  ' tcx > ( 
956964    cx :  & MatchCheckCtxt < ' p ,  ' tcx > , 
957965    arms :  & [ MatchArm < ' p ,  ' tcx > ] , 
958-     scrut_hir_id :  HirId , 
966+     lint_root :  HirId , 
959967    scrut_ty :  Ty < ' tcx > , 
960968)  -> UsefulnessReport < ' p ,  ' tcx >  { 
961969    let  mut  matrix = Matrix :: empty ( ) ; 
@@ -980,7 +988,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>(
980988
981989    let  wild_pattern = cx. pattern_arena . alloc ( DeconstructedPat :: wildcard ( scrut_ty) ) ; 
982990    let  v = PatStack :: from_pattern ( wild_pattern) ; 
983-     let  usefulness = is_useful ( cx,  & matrix,  & v,  FakeExtraWildcard ,  scrut_hir_id ,  false ,  true ) ; 
991+     let  usefulness = is_useful ( cx,  & matrix,  & v,  FakeExtraWildcard ,  lint_root ,  false ,  true ) ; 
984992    let  non_exhaustiveness_witnesses = match  usefulness { 
985993        WithWitnesses ( pats)  => pats. into_iter ( ) . map ( |w| w. single_pattern ( ) ) . collect ( ) , 
986994        NoWitnesses  {  .. }  => bug ! ( ) , 
0 commit comments