@@ -18,7 +18,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
18
18
use rustc_session:: lint:: builtin:: { DEPRECATED , DEPRECATED_IN_FUTURE , SOFT_UNSTABLE } ;
19
19
use rustc_session:: lint:: { BuiltinLintDiagnostics , Level , Lint , LintBuffer } ;
20
20
use rustc_session:: parse:: feature_err_issue;
21
- use rustc_session:: { RustcVersion , Session } ;
21
+ use rustc_session:: Session ;
22
22
use rustc_span:: symbol:: { sym, Symbol } ;
23
23
use rustc_span:: Span ;
24
24
use std:: num:: NonZeroU32 ;
@@ -125,19 +125,6 @@ pub fn report_unstable(
125
125
}
126
126
}
127
127
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
-
141
128
pub fn deprecation_suggestion (
142
129
diag : & mut Diagnostic ,
143
130
kind : & str ,
@@ -191,7 +178,7 @@ pub fn deprecation_message_and_lint(
191
178
kind : & str ,
192
179
path : & str ,
193
180
) -> ( String , & ' static Lint ) {
194
- let is_in_effect = deprecation_in_effect ( depr) ;
181
+ let is_in_effect = depr. is_in_effect ( ) ;
195
182
(
196
183
deprecation_message ( is_in_effect, depr. since , depr. note , kind, path) ,
197
184
deprecation_lint ( is_in_effect) ,
@@ -363,7 +350,7 @@ impl<'tcx> TyCtxt<'tcx> {
363
350
// Calculating message for lint involves calling `self.def_path_str`.
364
351
// Which by default to calculate visible path will invoke expensive `visible_parent_map` query.
365
352
// 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 ( ) ;
367
354
let lint = deprecation_lint ( is_in_effect) ;
368
355
if self . lint_level_at_node ( lint, id) . 0 != Level :: Allow {
369
356
let def_path = with_no_trimmed_paths ! ( self . def_path_str( def_id) ) ;
0 commit comments