@@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
17
17
use rustc_session:: parse:: feature_err;
18
18
use rustc_span:: { sym, Span , Symbol } ;
19
19
20
- use crate :: errors:: { ConstImplConstTrait , ExprNotAllowedInContext } ;
20
+ use crate :: errors:: ExprNotAllowedInContext ;
21
21
22
22
/// An expression that is not *always* legal in a const context.
23
23
#[ derive( Clone , Copy ) ]
@@ -196,26 +196,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
196
196
self . tcx . hir ( )
197
197
}
198
198
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
-
219
199
fn visit_anon_const ( & mut self , anon : & ' tcx hir:: AnonConst ) {
220
200
let kind = Some ( hir:: ConstContext :: Const ) ;
221
201
self . recurse_into ( kind, None , |this| intravisit:: walk_anon_const ( this, anon) ) ;
0 commit comments