@@ -6,15 +6,14 @@ use rustc_errors::Applicability;
66use rustc_hir:: def_id:: DefId ;
77use rustc_hir:: intravisit:: { walk_expr, walk_fn, walk_item, FnKind , Visitor } ;
88use rustc_hir:: {
9- self as hir, BlockCheckMode , BodyId , Constness , Expr , ExprKind , FnDecl , Impl , Item , ItemKind , UnsafeSource ,
10- Unsafety ,
9+ self as hir, BlockCheckMode , BodyId , Expr , ExprKind , FnDecl , Impl , Item , ItemKind , UnsafeSource , Unsafety ,
1110} ;
1211use rustc_lint:: { LateContext , LateLintPass } ;
1312use rustc_middle:: hir:: nested_filter;
1413use rustc_middle:: traits:: Reveal ;
1514use rustc_middle:: ty:: {
16- self , BoundConstness , ClauseKind , GenericArgKind , GenericParamDefKind , ImplPolarity , ParamEnv , ToPredicate ,
17- TraitPredicate , Ty , TyCtxt ,
15+ self , ClauseKind , GenericArgKind , GenericParamDefKind , ImplPolarity , ParamEnv , ToPredicate , TraitPredicate , Ty ,
16+ TyCtxt ,
1817} ;
1918use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
2019use rustc_span:: def_id:: LocalDefId ;
@@ -346,9 +345,10 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
346345 if !is_copy ( cx, ty) {
347346 if ty_subs. non_erasable_generics ( ) . next ( ) . is_some ( ) {
348347 let has_copy_impl = cx. tcx . all_local_trait_impls ( ( ) ) . get ( & copy_id) . map_or ( false , |impls| {
349- impls
350- . iter ( )
351- . any ( |& id| matches ! ( cx. tcx. type_of( id) . instantiate_identity( ) . kind( ) , ty:: Adt ( adt, _) if ty_adt. did( ) == adt. did( ) ) )
348+ impls. iter ( ) . any ( |& id| {
349+ matches ! ( cx. tcx. type_of( id) . instantiate_identity( ) . kind( ) , ty:: Adt ( adt, _)
350+ if ty_adt. did( ) == adt. did( ) )
351+ } )
352352 } ) ;
353353 if !has_copy_impl {
354354 return ;
@@ -507,7 +507,6 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
507507 if let ClauseKind :: Trait ( p) = p. kind ( ) . skip_binder ( )
508508 && p. trait_ref . def_id == eq_trait_id
509509 && let ty:: Param ( self_ty) = p. trait_ref . self_ty ( ) . kind ( )
510- && p. constness == BoundConstness :: NotConst
511510 {
512511 // Flag types which already have an `Eq` bound.
513512 params[ self_ty. index as usize ] . 1 = false ;
@@ -519,13 +518,11 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
519518 params. iter ( ) . filter ( |& & ( _, needs_eq) | needs_eq) . map ( |& ( param, _) | {
520519 ClauseKind :: Trait ( TraitPredicate {
521520 trait_ref : ty:: TraitRef :: new ( tcx, eq_trait_id, [ tcx. mk_param_from_def ( param) ] ) ,
522- constness : BoundConstness :: NotConst ,
523521 polarity : ImplPolarity :: Positive ,
524522 } )
525523 . to_predicate ( tcx)
526524 } ) ,
527525 ) ) ,
528526 Reveal :: UserFacing ,
529- Constness :: NotConst ,
530527 )
531528}
0 commit comments