@@ -11,10 +11,9 @@ use hir::def::DefKind;
1111use hir:: pat_util:: EnumerateAndAdjustIterator as _;
1212use rustc_abi:: { FIRST_VARIANT , FieldIdx , VariantIdx } ;
1313use rustc_data_structures:: fx:: FxIndexMap ;
14- use rustc_hir as hir;
1514use rustc_hir:: def:: { CtorOf , Res } ;
1615use rustc_hir:: def_id:: LocalDefId ;
17- use rustc_hir:: { HirId , PatKind } ;
16+ use rustc_hir:: { self as hir , HirId , PatExpr , PatExprKind , PatKind } ;
1817use rustc_lint:: LateContext ;
1918use rustc_middle:: hir:: place:: ProjectionKind ;
2019// Export these here so that Clippy can use them.
@@ -564,11 +563,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
564563 // FIXME(never_patterns): does this do what I expect?
565564 needs_to_be_read = true ;
566565 }
567- PatKind :: Path ( qpath) => {
566+ PatKind :: Expr ( PatExpr { kind : PatExprKind :: Path ( qpath) , hir_id , .. } ) => {
568567 // A `Path` pattern is just a name like `Foo`. This is either a
569568 // named constant or else it refers to an ADT variant
570569
571- let res = self . cx . typeck_results ( ) . qpath_res ( qpath, pat . hir_id ) ;
570+ let res = self . cx . typeck_results ( ) . qpath_res ( qpath, * hir_id) ;
572571 match res {
573572 Res :: Def ( DefKind :: Const , _) | Res :: Def ( DefKind :: AssocConst , _) => {
574573 // Named constants have to be equated with the value
@@ -1800,8 +1799,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
18001799 }
18011800 }
18021801
1803- PatKind :: Path ( _)
1804- | PatKind :: Binding ( .., None )
1802+ PatKind :: Binding ( .., None )
18051803 | PatKind :: Expr ( ..)
18061804 | PatKind :: Range ( ..)
18071805 | PatKind :: Never
0 commit comments