@@ -99,7 +99,6 @@ pub use expectation::Expectation;
99
99
pub use fn_ctxt:: * ;
100
100
use hir:: def:: CtorOf ;
101
101
pub use inherited:: { Inherited , InheritedBuilder } ;
102
- use rustc_middle:: middle:: stability:: report_unstable;
103
102
104
103
use crate :: astconv:: AstConv ;
105
104
use crate :: check:: gather_locals:: GatherLocalsVisitor ;
@@ -667,19 +666,32 @@ fn missing_items_must_implement_one_of_err(
667
666
fn default_body_is_unstable (
668
667
tcx : TyCtxt < ' _ > ,
669
668
impl_span : Span ,
670
- _item_did : DefId ,
669
+ item_did : DefId ,
671
670
feature : Symbol ,
672
671
reason : Option < Symbol > ,
673
672
issue : Option < NonZeroU32 > ,
674
- is_soft : bool ,
675
673
) {
676
- let soft_handler = |lint , span , msg : & _ | {
677
- tcx . struct_span_lint_hir ( lint , hir :: CRATE_HIR_ID , span , |lint| {
678
- lint . build ( msg ) . emit ( ) ;
679
- } )
674
+ let missing_item_name = & tcx . associated_item ( item_did ) . name ;
675
+ let use_of_unstable_library_feature_note = match reason {
676
+ Some ( r ) => format ! ( "use of unstable library feature '{feature}': {r}" ) ,
677
+ None => format ! ( "use of unstable library feature '{feature}'" ) ,
680
678
} ;
681
679
682
- report_unstable ( tcx. sess , feature, reason, issue, None , is_soft, impl_span, soft_handler)
680
+ let mut err = struct_span_err ! (
681
+ tcx. sess,
682
+ impl_span,
683
+ E0046 ,
684
+ "not all trait items implemented, missing: `{missing_item_name}`" ,
685
+ ) ;
686
+ err. note ( format ! ( "default implementation of `{missing_item_name}` is unstable" ) ) ;
687
+ err. note ( use_of_unstable_library_feature_note) ;
688
+ rustc_session:: parse:: add_feature_diagnostics_for_issue (
689
+ & mut err,
690
+ & tcx. sess . parse_sess ,
691
+ feature,
692
+ rustc_feature:: GateIssue :: Library ( issue) ,
693
+ ) ;
694
+ err. emit ( ) ;
683
695
}
684
696
685
697
/// Re-sugar `ty::GenericPredicates` in a way suitable to be used in structured suggestions.
0 commit comments