@@ -6,15 +6,14 @@ use rustc_errors::Applicability;
6
6
use rustc_hir:: def_id:: DefId ;
7
7
use rustc_hir:: intravisit:: { walk_expr, walk_fn, walk_item, FnKind , Visitor } ;
8
8
use 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 ,
11
10
} ;
12
11
use rustc_lint:: { LateContext , LateLintPass } ;
13
12
use rustc_middle:: hir:: nested_filter;
14
13
use rustc_middle:: traits:: Reveal ;
15
14
use 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 ,
18
17
} ;
19
18
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
20
19
use rustc_span:: def_id:: LocalDefId ;
@@ -346,9 +345,10 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
346
345
if !is_copy ( cx, ty) {
347
346
if ty_subs. non_erasable_generics ( ) . next ( ) . is_some ( ) {
348
347
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
+ } )
352
352
} ) ;
353
353
if !has_copy_impl {
354
354
return ;
@@ -507,7 +507,6 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
507
507
if let ClauseKind :: Trait ( p) = p. kind ( ) . skip_binder ( )
508
508
&& p. trait_ref . def_id == eq_trait_id
509
509
&& let ty:: Param ( self_ty) = p. trait_ref . self_ty ( ) . kind ( )
510
- && p. constness == BoundConstness :: NotConst
511
510
{
512
511
// Flag types which already have an `Eq` bound.
513
512
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) ->
519
518
params. iter ( ) . filter ( |& & ( _, needs_eq) | needs_eq) . map ( |& ( param, _) | {
520
519
ClauseKind :: Trait ( TraitPredicate {
521
520
trait_ref : ty:: TraitRef :: new ( tcx, eq_trait_id, [ tcx. mk_param_from_def ( param) ] ) ,
522
- constness : BoundConstness :: NotConst ,
523
521
polarity : ImplPolarity :: Positive ,
524
522
} )
525
523
. to_predicate ( tcx)
526
524
} ) ,
527
525
) ) ,
528
526
Reveal :: UserFacing ,
529
- Constness :: NotConst ,
530
527
)
531
528
}
0 commit comments