@@ -11,7 +11,7 @@ use rustc_ast::util::parser::ExprPrecedence;
1111use rustc_errors:: Applicability ;
1212use rustc_hir:: LangItem :: { OptionNone , OptionSome } ;
1313use 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 } ;
1515use rustc_lint:: LateContext ;
1616use rustc_span:: { SyntaxContext , sym} ;
1717
@@ -256,9 +256,11 @@ pub(super) fn try_parse_pattern<'tcx>(
256256 match pat. kind {
257257 PatKind :: Wild => Some ( OptionPat :: Wild ) ,
258258 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 ) ,
262264 PatKind :: TupleStruct ( ref qpath, [ pattern] , _)
263265 if is_res_lang_ctor ( cx, cx. qpath_res ( qpath, pat. hir_id ) , OptionSome ) && pat. span . ctxt ( ) == ctxt =>
264266 {
0 commit comments