@@ -29,6 +29,7 @@ use rustc_errors::DiagCtxtHandle;
2929use rustc_feature:: Features ;
3030use rustc_parse:: validate_attr;
3131use rustc_session:: Session ;
32+ use rustc_session:: config:: SymbolManglingVersion ;
3233use rustc_session:: lint:: builtin:: {
3334 DEPRECATED_WHERE_CLAUSE_LOCATION , MISSING_ABI , MISSING_UNSAFE_ON_EXTERN ,
3435 PATTERNS_IN_FNS_WITHOUT_BODY ,
@@ -82,6 +83,8 @@ struct AstValidator<'a> {
8283 /// Used to ban explicit safety on foreign items when the extern block is not marked as unsafe.
8384 extern_mod_safety : Option < Safety > ,
8485
86+ is_interface : bool ,
87+
8588 lint_buffer : & ' a mut LintBuffer ,
8689}
8790
@@ -922,7 +925,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
922925
923926 let is_intrinsic =
924927 item. attrs . iter ( ) . any ( |a| a. name_or_empty ( ) == sym:: rustc_intrinsic) ;
925- if body. is_none ( ) && !is_intrinsic {
928+ if body. is_none ( ) && !is_intrinsic && ! self . is_interface {
926929 self . dcx ( ) . emit_err ( errors:: FnWithoutBody {
927930 span : item. span ,
928931 replace_span : self . ending_semi_or_hi ( item. span ) ,
@@ -1110,6 +1113,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11101113 } ) ;
11111114 }
11121115 }
1116+ ItemKind :: ExternDynCrate ( _) => {
1117+ if self . sess . opts . get_symbol_mangling_version ( ) != SymbolManglingVersion :: V0 {
1118+ self . dcx ( )
1119+ . emit_err ( errors:: WrongManglingSchemeForExternDyn { span : item. span } ) ;
1120+ }
1121+ }
11131122 _ => { }
11141123 }
11151124
@@ -1419,7 +1428,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
14191428 } ) ;
14201429 }
14211430 AssocItemKind :: Fn ( box Fn { body, .. } ) => {
1422- if body. is_none ( ) {
1431+ if body. is_none ( ) && ! self . is_interface {
14231432 self . dcx ( ) . emit_err ( errors:: AssocFnWithoutBody {
14241433 span : item. span ,
14251434 replace_span : self . ending_semi_or_hi ( item. span ) ,
@@ -1669,6 +1678,7 @@ pub fn check_crate(
16691678 sess : & Session ,
16701679 features : & Features ,
16711680 krate : & Crate ,
1681+ is_interface : bool ,
16721682 lints : & mut LintBuffer ,
16731683) -> bool {
16741684 let mut validator = AstValidator {
@@ -1680,6 +1690,7 @@ pub fn check_crate(
16801690 outer_impl_trait : None ,
16811691 disallow_tilde_const : Some ( TildeConstReason :: Item ) ,
16821692 extern_mod_safety : None ,
1693+ is_interface,
16831694 lint_buffer : lints,
16841695 } ;
16851696 visit:: walk_crate ( & mut validator, krate) ;
0 commit comments