@@ -11,7 +11,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
1111use rustc_hir:: { self as hir, ConstStability , DefaultBodyStability , HirId , Stability } ;
1212use rustc_macros:: { Decodable , Encodable , HashStable , Subdiagnostic } ;
1313use rustc_session:: Session ;
14- use rustc_session:: lint:: builtin:: { DEPRECATED , DEPRECATED_IN_FUTURE , SOFT_UNSTABLE } ;
14+ use rustc_session:: lint:: builtin:: { DEPRECATED , DEPRECATED_IN_FUTURE } ;
1515use rustc_session:: lint:: { BuiltinLintDiag , DeprecatedSinceKind , Level , Lint } ;
1616use rustc_session:: parse:: feature_err_issue;
1717use rustc_span:: { Span , Symbol , sym} ;
@@ -68,9 +68,7 @@ pub fn report_unstable(
6868 reason : Option < Symbol > ,
6969 issue : Option < NonZero < u32 > > ,
7070 suggestion : Option < ( Span , String , String , Applicability ) > ,
71- is_soft : bool ,
7271 span : Span ,
73- soft_handler : impl FnOnce ( & ' static Lint , Span , String ) ,
7472 kind : UnstableKind ,
7573) {
7674 let qual = match kind {
@@ -83,18 +81,14 @@ pub fn report_unstable(
8381 None => format ! ( "use of unstable{qual} library feature `{feature}`" ) ,
8482 } ;
8583
86- if is_soft {
87- soft_handler ( SOFT_UNSTABLE , span, msg)
88- } else {
89- let mut err = feature_err_issue ( sess, feature, span, GateIssue :: Library ( issue) , msg) ;
90- if let Some ( ( inner_types, msg, sugg, applicability) ) = suggestion {
91- err. span_suggestion ( inner_types, msg, sugg, applicability) ;
92- }
93- if let UnstableKind :: Const ( kw) = kind {
94- err. span_label ( kw, "trait is not stable as const yet" ) ;
95- }
96- err. emit ( ) ;
84+ let mut err = feature_err_issue ( sess, feature, span, GateIssue :: Library ( issue) , msg) ;
85+ if let Some ( ( inner_types, msg, sugg, applicability) ) = suggestion {
86+ err. span_suggestion ( inner_types, msg, sugg, applicability) ;
9787 }
88+ if let UnstableKind :: Const ( kw) = kind {
89+ err. span_label ( kw, "trait is not stable as const yet" ) ;
90+ }
91+ err. emit ( ) ;
9892}
9993
10094fn deprecation_lint ( is_in_effect : bool ) -> & ' static Lint {
@@ -266,7 +260,6 @@ pub enum EvalResult {
266260 reason : Option < Symbol > ,
267261 issue : Option < NonZero < u32 > > ,
268262 suggestion : Option < ( Span , String , String , Applicability ) > ,
269- is_soft : bool ,
270263 } ,
271264 /// The item does not have the `#[stable]` or `#[unstable]` marker assigned.
272265 Unmarked ,
@@ -386,7 +379,7 @@ impl<'tcx> TyCtxt<'tcx> {
386379
387380 match stability {
388381 Some ( Stability {
389- level : hir:: StabilityLevel :: Unstable { reason, issue, is_soft , implied_by, .. } ,
382+ level : hir:: StabilityLevel :: Unstable { reason, issue, implied_by, .. } ,
390383 feature,
391384 ..
392385 } ) => {
@@ -428,13 +421,7 @@ impl<'tcx> TyCtxt<'tcx> {
428421 }
429422
430423 let suggestion = suggestion_for_allocator_api ( self , def_id, span, feature) ;
431- EvalResult :: Deny {
432- feature,
433- reason : reason. to_opt_reason ( ) ,
434- issue,
435- suggestion,
436- is_soft,
437- }
424+ EvalResult :: Deny { feature, reason : reason. to_opt_reason ( ) , issue, suggestion }
438425 }
439426 Some ( _) => {
440427 // Stable APIs are always ok to call and deprecated APIs are
@@ -469,7 +456,7 @@ impl<'tcx> TyCtxt<'tcx> {
469456
470457 match stability {
471458 Some ( DefaultBodyStability {
472- level : hir:: StabilityLevel :: Unstable { reason, issue, is_soft , .. } ,
459+ level : hir:: StabilityLevel :: Unstable { reason, issue, .. } ,
473460 feature,
474461 } ) => {
475462 if span. allows_unstable ( feature) {
@@ -485,7 +472,6 @@ impl<'tcx> TyCtxt<'tcx> {
485472 reason : reason. to_opt_reason ( ) ,
486473 issue,
487474 suggestion : None ,
488- is_soft,
489475 }
490476 }
491477 Some ( _) => {
@@ -563,30 +549,18 @@ impl<'tcx> TyCtxt<'tcx> {
563549 allow_unstable : AllowUnstable ,
564550 unmarked : impl FnOnce ( Span , DefId ) ,
565551 ) -> bool {
566- let soft_handler = |lint, span, msg : String | {
567- self . emit_node_span_lint (
568- lint,
569- id. unwrap_or ( hir:: CRATE_HIR_ID ) ,
570- span,
571- rustc_errors:: DiagDecorator ( |lint| {
572- lint. primary_message ( msg) ;
573- } ) ,
574- ) ;
575- } ;
576552 let eval_result =
577553 self . eval_stability_allow_unstable ( def_id, id, span, method_span, allow_unstable) ;
578554 let is_allowed = matches ! ( eval_result, EvalResult :: Allow ) ;
579555 match eval_result {
580556 EvalResult :: Allow => { }
581- EvalResult :: Deny { feature, reason, issue, suggestion, is_soft } => report_unstable (
557+ EvalResult :: Deny { feature, reason, issue, suggestion } => report_unstable (
582558 self . sess ,
583559 feature,
584560 reason,
585561 issue,
586562 suggestion,
587- is_soft,
588563 span,
589- soft_handler,
590564 UnstableKind :: Regular ,
591565 ) ,
592566 EvalResult :: Unmarked => unmarked ( span, def_id) ,
@@ -623,12 +597,10 @@ impl<'tcx> TyCtxt<'tcx> {
623597
624598 match stability {
625599 Some ( ConstStability {
626- level : hir:: StabilityLevel :: Unstable { reason, issue, is_soft , implied_by, .. } ,
600+ level : hir:: StabilityLevel :: Unstable { reason, issue, implied_by, .. } ,
627601 feature,
628602 ..
629603 } ) => {
630- assert ! ( !is_soft) ;
631-
632604 if span. allows_unstable ( feature) {
633605 debug ! ( "body stability: skipping span={:?} since it is internal" , span) ;
634606 return ;
@@ -652,9 +624,7 @@ impl<'tcx> TyCtxt<'tcx> {
652624 reason. to_opt_reason ( ) ,
653625 issue,
654626 None ,
655- false ,
656627 span,
657- |_, _, _| { } ,
658628 UnstableKind :: Const ( const_kw_span) ,
659629 ) ;
660630 }
0 commit comments