|
1 |
| -use rustc_feature::{AttributeTemplate, template}; |
2 |
| -use rustc_hir::attrs::{AttributeKind, DeprecatedSince, Deprecation}; |
3 |
| -use rustc_hir::{MethodKind, Target}; |
4 |
| -use rustc_span::{Span, Symbol, sym}; |
| 1 | +use rustc_hir::attrs::{DeprecatedSince, Deprecation}; |
5 | 2 |
|
| 3 | +use super::prelude::*; |
6 | 4 | use super::util::parse_version;
|
7 |
| -use super::{AttributeOrder, OnDuplicate, SingleAttributeParser}; |
8 |
| -use crate::context::MaybeWarn::{Allow, Error}; |
9 |
| -use crate::context::{AcceptContext, AllowedTargets, Stage}; |
10 |
| -use crate::parser::ArgParser; |
11 |
| -use crate::session_diagnostics; |
| 5 | +use crate::session_diagnostics::{ |
| 6 | + DeprecatedItemSuggestion, InvalidSince, MissingNote, MissingSince, |
| 7 | +}; |
| 8 | + |
12 | 9 | pub(crate) struct DeprecationParser;
|
13 | 10 |
|
14 | 11 | fn get<S: Stage>(
|
@@ -102,7 +99,7 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
|
102 | 99 | }
|
103 | 100 | Some(name @ sym::suggestion) => {
|
104 | 101 | if !features.deprecated_suggestion() {
|
105 |
| - cx.emit_err(session_diagnostics::DeprecatedItemSuggestion { |
| 102 | + cx.emit_err(DeprecatedItemSuggestion { |
106 | 103 | span: param.span(),
|
107 | 104 | is_nightly: cx.sess().is_nightly_build(),
|
108 | 105 | details: (),
|
@@ -144,18 +141,18 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
|
144 | 141 | } else if let Some(version) = parse_version(since) {
|
145 | 142 | DeprecatedSince::RustcVersion(version)
|
146 | 143 | } else {
|
147 |
| - cx.emit_err(session_diagnostics::InvalidSince { span: cx.attr_span }); |
| 144 | + cx.emit_err(InvalidSince { span: cx.attr_span }); |
148 | 145 | DeprecatedSince::Err
|
149 | 146 | }
|
150 | 147 | } else if is_rustc {
|
151 |
| - cx.emit_err(session_diagnostics::MissingSince { span: cx.attr_span }); |
| 148 | + cx.emit_err(MissingSince { span: cx.attr_span }); |
152 | 149 | DeprecatedSince::Err
|
153 | 150 | } else {
|
154 | 151 | DeprecatedSince::Unspecified
|
155 | 152 | };
|
156 | 153 |
|
157 | 154 | if is_rustc && note.is_none() {
|
158 |
| - cx.emit_err(session_diagnostics::MissingNote { span: cx.attr_span }); |
| 155 | + cx.emit_err(MissingNote { span: cx.attr_span }); |
159 | 156 | return None;
|
160 | 157 | }
|
161 | 158 |
|
|
0 commit comments