@@ -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 , PatKind , PatLit , PatLitKind } ;
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.
@@ -560,11 +559,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
560
559
// FIXME(never_patterns): does this do what I expect?
561
560
needs_to_be_read = true ;
562
561
}
563
- PatKind :: Path ( qpath) => {
562
+ PatKind :: Lit ( PatLit { kind : PatLitKind :: Path ( qpath) , hir_id , .. } ) => {
564
563
// A `Path` pattern is just a name like `Foo`. This is either a
565
564
// named constant or else it refers to an ADT variant
566
565
567
- let res = self . cx . typeck_results ( ) . qpath_res ( qpath, pat . hir_id ) ;
566
+ let res = self . cx . typeck_results ( ) . qpath_res ( qpath, * hir_id) ;
568
567
match res {
569
568
Res :: Def ( DefKind :: Const , _) | Res :: Def ( DefKind :: AssocConst , _) => {
570
569
// Named constants have to be equated with the value
@@ -1793,8 +1792,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1793
1792
}
1794
1793
}
1795
1794
1796
- PatKind :: Path ( _)
1797
- | PatKind :: Binding ( .., None )
1795
+ PatKind :: Binding ( .., None )
1798
1796
| PatKind :: Lit ( ..)
1799
1797
| PatKind :: Range ( ..)
1800
1798
| PatKind :: Never
0 commit comments