@@ -18,7 +18,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
1818use rustc_session:: lint:: builtin:: { DEPRECATED , DEPRECATED_IN_FUTURE , SOFT_UNSTABLE } ;
1919use rustc_session:: lint:: { BuiltinLintDiagnostics , Level , Lint , LintBuffer } ;
2020use rustc_session:: parse:: feature_err_issue;
21- use rustc_session:: { RustcVersion , Session } ;
21+ use rustc_session:: Session ;
2222use rustc_span:: symbol:: { sym, Symbol } ;
2323use rustc_span:: Span ;
2424use std:: num:: NonZeroU32 ;
@@ -125,19 +125,6 @@ pub fn report_unstable(
125125 }
126126}
127127
128- /// Checks whether an item marked with `deprecated(since="X")` is currently
129- /// deprecated (i.e., whether X is not greater than the current rustc version).
130- pub fn deprecation_in_effect ( depr : & Deprecation ) -> bool {
131- match depr. since {
132- Some ( DeprecatedSince :: RustcVersion ( since) ) => since <= RustcVersion :: CURRENT ,
133- Some ( DeprecatedSince :: Future ) => false ,
134- // The `since` field doesn't have semantic purpose without `#![staged_api]`.
135- Some ( DeprecatedSince :: Symbol ( _) ) => true ,
136- // Assume deprecation is in effect if "since" field is missing.
137- None => true ,
138- }
139- }
140-
141128pub fn deprecation_suggestion (
142129 diag : & mut Diagnostic ,
143130 kind : & str ,
@@ -191,7 +178,7 @@ pub fn deprecation_message_and_lint(
191178 kind : & str ,
192179 path : & str ,
193180) -> ( String , & ' static Lint ) {
194- let is_in_effect = deprecation_in_effect ( depr) ;
181+ let is_in_effect = depr. is_in_effect ( ) ;
195182 (
196183 deprecation_message ( is_in_effect, depr. since , depr. note , kind, path) ,
197184 deprecation_lint ( is_in_effect) ,
@@ -363,7 +350,7 @@ impl<'tcx> TyCtxt<'tcx> {
363350 // Calculating message for lint involves calling `self.def_path_str`.
364351 // Which by default to calculate visible path will invoke expensive `visible_parent_map` query.
365352 // So we skip message calculation altogether, if lint is allowed.
366- let is_in_effect = deprecation_in_effect ( depr_attr) ;
353+ let is_in_effect = depr_attr. is_in_effect ( ) ;
367354 let lint = deprecation_lint ( is_in_effect) ;
368355 if self . lint_level_at_node ( lint, id) . 0 != Level :: Allow {
369356 let def_path = with_no_trimmed_paths ! ( self . def_path_str( def_id) ) ;
0 commit comments