@@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
1717use rustc_session:: parse:: feature_err;
1818use rustc_span:: { sym, Span , Symbol } ;
1919
20- use crate :: errors:: { ConstImplConstTrait , ExprNotAllowedInContext } ;
20+ use crate :: errors:: ExprNotAllowedInContext ;
2121
2222/// An expression that is not *always* legal in a const context.
2323#[ derive( Clone , Copy ) ]
@@ -196,26 +196,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
196196 self . tcx . hir ( )
197197 }
198198
199- fn visit_item ( & mut self , item : & ' tcx hir:: Item < ' tcx > ) {
200- let tcx = self . tcx ;
201- if let hir:: ItemKind :: Impl ( hir:: Impl {
202- constness : hir:: Constness :: Const ,
203- of_trait : Some ( trait_ref) ,
204- ..
205- } ) = item. kind
206- && let Some ( def_id) = trait_ref. trait_def_id ( )
207- {
208- let source_map = tcx. sess . source_map ( ) ;
209- if !tcx. has_attr ( def_id, sym:: const_trait) {
210- tcx. sess . emit_err ( ConstImplConstTrait {
211- span : source_map. guess_head_span ( item. span ) ,
212- def_span : source_map. guess_head_span ( tcx. def_span ( def_id) ) ,
213- } ) ;
214- }
215- }
216- intravisit:: walk_item ( self , item) ;
217- }
218-
219199 fn visit_anon_const ( & mut self , anon : & ' tcx hir:: AnonConst ) {
220200 let kind = Some ( hir:: ConstContext :: Const ) ;
221201 self . recurse_into ( kind, None , |this| intravisit:: walk_anon_const ( this, anon) ) ;
0 commit comments