@@ -12,11 +12,10 @@ use rustc_hir::def_id::DefId;
12
12
use rustc_hir:: {
13
13
BodyId , Expr , ExprKind , HirId , Impl , ImplItem , ImplItemKind , Item , ItemKind , Node , TraitItem , TraitItemKind , UnOp ,
14
14
} ;
15
- use rustc_infer:: traits:: specialization_graph;
16
15
use rustc_lint:: { LateContext , LateLintPass , Lint } ;
17
16
use rustc_middle:: mir:: interpret:: { ConstValue , ErrorHandled } ;
18
17
use rustc_middle:: ty:: adjustment:: Adjust ;
19
- use rustc_middle:: ty:: { self , AssocKind , Const , Ty } ;
18
+ use rustc_middle:: ty:: { self , Const , Ty } ;
20
19
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
21
20
use rustc_span:: { InnerSpan , Span , DUMMY_SP } ;
22
21
use rustc_typeck:: hir_ty_to_ty;
@@ -293,8 +292,10 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
293
292
// Lint a trait impl item only when the definition is a generic type,
294
293
// assuming an assoc const is not meant to be an interior mutable type.
295
294
if let Some ( of_trait_def_id) = of_trait_ref. trait_def_id( ) ;
296
- if let Some ( of_assoc_item) = specialization_graph:: Node :: Trait ( of_trait_def_id)
297
- . item( cx. tcx, impl_item. ident, AssocKind :: Const , of_trait_def_id) ;
295
+ if let Some ( of_assoc_item) = cx
296
+ . tcx
297
+ . associated_item( impl_item. def_id)
298
+ . trait_item_def_id;
298
299
if cx
299
300
. tcx
300
301
. layout_of( cx. tcx. param_env( of_trait_def_id) . and(
@@ -303,7 +304,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
303
304
// and, in that case, the definition is *not* generic.
304
305
cx. tcx. normalize_erasing_regions(
305
306
cx. tcx. param_env( of_trait_def_id) ,
306
- cx. tcx. type_of( of_assoc_item. def_id ) ,
307
+ cx. tcx. type_of( of_assoc_item) ,
307
308
) ,
308
309
) )
309
310
. is_err( ) ;
0 commit comments