@@ -12,11 +12,10 @@ use rustc_hir::def_id::DefId;
1212use rustc_hir:: {
1313 BodyId , Expr , ExprKind , HirId , Impl , ImplItem , ImplItemKind , Item , ItemKind , Node , TraitItem , TraitItemKind , UnOp ,
1414} ;
15- use rustc_infer:: traits:: specialization_graph;
1615use rustc_lint:: { LateContext , LateLintPass , Lint } ;
1716use rustc_middle:: mir:: interpret:: { ConstValue , ErrorHandled } ;
1817use rustc_middle:: ty:: adjustment:: Adjust ;
19- use rustc_middle:: ty:: { self , AssocKind , Const , Ty } ;
18+ use rustc_middle:: ty:: { self , Const , Ty } ;
2019use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
2120use rustc_span:: { InnerSpan , Span , DUMMY_SP } ;
2221use rustc_typeck:: hir_ty_to_ty;
@@ -293,8 +292,10 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
293292 // Lint a trait impl item only when the definition is a generic type,
294293 // assuming an assoc const is not meant to be an interior mutable type.
295294 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;
298299 if cx
299300 . tcx
300301 . layout_of( cx. tcx. param_env( of_trait_def_id) . and(
@@ -303,7 +304,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
303304 // and, in that case, the definition is *not* generic.
304305 cx. tcx. normalize_erasing_regions(
305306 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) ,
307308 ) ,
308309 ) )
309310 . is_err( ) ;
0 commit comments