@@ -102,11 +102,11 @@ use rustc_hir::hir_id::{HirIdMap, HirIdSet};
102102use rustc_hir:: intravisit:: { walk_expr, FnKind , Visitor } ;
103103use rustc_hir:: LangItem :: { OptionNone , OptionSome , ResultErr , ResultOk } ;
104104use rustc_hir:: {
105- self as hir, def, Arm , ArrayLen , BindingMode , Block , BlockCheckMode , Body , ByRef , Closure , ConstContext ,
106- Destination , Expr , ExprField , ExprKind , FnDecl , FnRetTy , GenericArgs , HirId , Impl , ImplItem , ImplItemKind ,
107- ImplItemRef , Item , ItemKind , LangItem , LetStmt , MatchSource , Mutability , Node , OwnerId , OwnerNode , Param , Pat ,
108- PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitItem , TraitItemKind , TraitItemRef , TraitRef ,
109- TyKind , UnOp ,
105+ self as hir, def, Arm , ArrayLen , BindingMode , Block , BlockCheckMode , Body , ByRef , Closure , ConstArgKind ,
106+ ConstContext , Destination , Expr , ExprField , ExprKind , FnDecl , FnRetTy , GenericArgs , HirId , Impl , ImplItem ,
107+ ImplItemKind , ImplItemRef , Item , ItemKind , LangItem , LetStmt , MatchSource , Mutability , Node , OwnerId , OwnerNode ,
108+ Param , Pat , PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitItem , TraitItemKind , TraitItemRef ,
109+ TraitRef , TyKind , UnOp ,
110110} ;
111111use rustc_lexer:: { tokenize, TokenKind } ;
112112use rustc_lint:: { LateContext , Level , Lint , LintContext } ;
@@ -904,7 +904,9 @@ pub fn is_default_equivalent(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
904904 } ,
905905 ExprKind :: Tup ( items) | ExprKind :: Array ( items) => items. iter ( ) . all ( |x| is_default_equivalent ( cx, x) ) ,
906906 ExprKind :: Repeat ( x, ArrayLen :: Body ( len) ) => {
907- if let ExprKind :: Lit ( const_lit) = cx. tcx . hir ( ) . body ( len. body ) . value . kind
907+ #[ allow( irrefutable_let_patterns) ] // FIXME
908+ if let ConstArgKind :: Anon ( anon_const) = len. kind
909+ && let ExprKind :: Lit ( const_lit) = cx. tcx . hir ( ) . body ( anon_const. body ) . value . kind
908910 && let LitKind :: Int ( v, _) = const_lit. node
909911 && v <= 32
910912 && is_default_equivalent ( cx, x)
@@ -933,7 +935,9 @@ fn is_default_equivalent_from(cx: &LateContext<'_>, from_func: &Expr<'_>, arg: &
933935 } ) => return sym. is_empty ( ) && is_path_lang_item ( cx, ty, LangItem :: String ) ,
934936 ExprKind :: Array ( [ ] ) => return is_path_diagnostic_item ( cx, ty, sym:: Vec ) ,
935937 ExprKind :: Repeat ( _, ArrayLen :: Body ( len) ) => {
936- if let ExprKind :: Lit ( const_lit) = cx. tcx . hir ( ) . body ( len. body ) . value . kind
938+ #[ allow( irrefutable_let_patterns) ] // FIXME
939+ if let ConstArgKind :: Anon ( anon_const) = len. kind
940+ && let ExprKind :: Lit ( const_lit) = cx. tcx . hir ( ) . body ( anon_const. body ) . value . kind
937941 && let LitKind :: Int ( v, _) = const_lit. node
938942 {
939943 return v == 0 && is_path_diagnostic_item ( cx, ty, sym:: Vec ) ;
0 commit comments