@@ -11,7 +11,7 @@ use rustc_ast::util::parser::ExprPrecedence;
11
11
use rustc_errors:: Applicability ;
12
12
use rustc_hir:: LangItem :: { OptionNone , OptionSome } ;
13
13
use rustc_hir:: def:: Res ;
14
- use rustc_hir:: { BindingMode , Expr , ExprKind , HirId , Mutability , Pat , PatKind , Path , QPath } ;
14
+ use rustc_hir:: { BindingMode , Expr , ExprKind , HirId , Mutability , Pat , PatExpr , PatExprKind , PatKind , Path , QPath } ;
15
15
use rustc_lint:: LateContext ;
16
16
use rustc_span:: { SyntaxContext , sym} ;
17
17
@@ -256,9 +256,11 @@ pub(super) fn try_parse_pattern<'tcx>(
256
256
match pat. kind {
257
257
PatKind :: Wild => Some ( OptionPat :: Wild ) ,
258
258
PatKind :: Ref ( pat, _) => f ( cx, pat, ref_count + 1 , ctxt) ,
259
- PatKind :: Path ( ref qpath) if is_res_lang_ctor ( cx, cx. qpath_res ( qpath, pat. hir_id ) , OptionNone ) => {
260
- Some ( OptionPat :: None )
261
- } ,
259
+ PatKind :: Expr ( PatExpr {
260
+ kind : PatExprKind :: Path ( qpath) ,
261
+ hir_id,
262
+ ..
263
+ } ) if is_res_lang_ctor ( cx, cx. qpath_res ( qpath, * hir_id) , OptionNone ) => Some ( OptionPat :: None ) ,
262
264
PatKind :: TupleStruct ( ref qpath, [ pattern] , _)
263
265
if is_res_lang_ctor ( cx, cx. qpath_res ( qpath, pat. hir_id ) , OptionSome ) && pat. span . ctxt ( ) == ctxt =>
264
266
{
0 commit comments