@@ -836,13 +836,9 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
836836 check_const ( ccx, & expr, trait_item. id )
837837 }
838838 hir:: MethodTraitItem ( ref sig, Some ( ref body) ) => {
839- check_trait_fn_not_const ( ccx, trait_item. span , sig. constness ) ;
840-
841839 check_bare_fn ( ccx, & sig. decl , body, trait_item. id ) ;
842840 }
843- hir:: MethodTraitItem ( ref sig, None ) => {
844- check_trait_fn_not_const ( ccx, trait_item. span , sig. constness ) ;
845- }
841+ hir:: MethodTraitItem ( _, None ) |
846842 hir:: ConstTraitItem ( _, None ) |
847843 hir:: TypeTraitItem ( ..) => {
848844 // Nothing to do.
@@ -854,22 +850,6 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
854850 }
855851}
856852
857- fn check_trait_fn_not_const < ' a , ' tcx > ( ccx : & CrateCtxt < ' a , ' tcx > ,
858- span : Span ,
859- constness : hir:: Constness )
860- {
861- match constness {
862- hir:: Constness :: NotConst => {
863- // good
864- }
865- hir:: Constness :: Const => {
866- struct_span_err ! ( ccx. tcx. sess, span, E0379 , "trait fns cannot be declared const" )
867- . span_label ( span, & format ! ( "trait fns cannot be const" ) )
868- . emit ( )
869- }
870- }
871- }
872-
873853fn check_on_unimplemented < ' a , ' tcx > ( ccx : & CrateCtxt < ' a , ' tcx > ,
874854 def_id : DefId ,
875855 item : & hir:: Item ) {
@@ -1027,9 +1007,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10271007 err. emit ( )
10281008 }
10291009 }
1030- hir:: ImplItemKind :: Method ( ref sig, ref body) => {
1031- check_trait_fn_not_const ( ccx, impl_item. span , sig. constness ) ;
1032-
1010+ hir:: ImplItemKind :: Method ( _, ref body) => {
10331011 let impl_method = match ty_impl_item {
10341012 ty:: MethodTraitItem ( ref mti) => mti,
10351013 _ => span_bug ! ( impl_item. span, "non-method impl-item for method" )
0 commit comments