@@ -11,10 +11,9 @@ use hir::def::DefKind;
11
11
use hir:: pat_util:: EnumerateAndAdjustIterator as _;
12
12
use rustc_abi:: { FIRST_VARIANT , FieldIdx , VariantIdx } ;
13
13
use rustc_data_structures:: fx:: FxIndexMap ;
14
- use rustc_hir as hir;
15
14
use rustc_hir:: def:: { CtorOf , Res } ;
16
15
use rustc_hir:: def_id:: LocalDefId ;
17
- use rustc_hir:: { HirId , PatKind } ;
16
+ use rustc_hir:: { self as hir , HirId , PatExpr , PatExprKind , PatKind } ;
18
17
use rustc_lint:: LateContext ;
19
18
use rustc_middle:: hir:: place:: ProjectionKind ;
20
19
// Export these here so that Clippy can use them.
@@ -564,11 +563,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
564
563
// FIXME(never_patterns): does this do what I expect?
565
564
needs_to_be_read = true ;
566
565
}
567
- PatKind :: Path ( qpath) => {
566
+ PatKind :: Expr ( PatExpr { kind : PatExprKind :: Path ( qpath) , hir_id , span } ) => {
568
567
// A `Path` pattern is just a name like `Foo`. This is either a
569
568
// named constant or else it refers to an ADT variant
570
569
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) ;
572
571
match res {
573
572
Res :: Def ( DefKind :: Const , _) | Res :: Def ( DefKind :: AssocConst , _) => {
574
573
// Named constants have to be equated with the value
@@ -581,7 +580,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
581
580
// Otherwise, this is a struct/enum variant, and so it's
582
581
// only a read if we need to read the discriminant.
583
582
needs_to_be_read |=
584
- self . is_multivariant_adt ( place. place . ty ( ) , pat . span ) ;
583
+ self . is_multivariant_adt ( place. place . ty ( ) , * span) ;
585
584
}
586
585
}
587
586
}
@@ -1801,8 +1800,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1801
1800
}
1802
1801
}
1803
1802
1804
- PatKind :: Path ( _)
1805
- | PatKind :: Binding ( .., None )
1803
+ PatKind :: Binding ( .., None )
1806
1804
| PatKind :: Expr ( ..)
1807
1805
| PatKind :: Range ( ..)
1808
1806
| PatKind :: Never
0 commit comments