|
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>( |
@@ -100,7 +97,7 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser { |
100 | 97 | } |
101 | 98 | Some(name @ sym::suggestion) => { |
102 | 99 | if !features.deprecated_suggestion() { |
103 | | - cx.emit_err(session_diagnostics::DeprecatedItemSuggestion { |
| 100 | + cx.emit_err(DeprecatedItemSuggestion { |
104 | 101 | span: param.span(), |
105 | 102 | is_nightly: cx.sess().is_nightly_build(), |
106 | 103 | details: (), |
@@ -142,18 +139,18 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecationParser { |
142 | 139 | } else if let Some(version) = parse_version(since) { |
143 | 140 | DeprecatedSince::RustcVersion(version) |
144 | 141 | } else { |
145 | | - cx.emit_err(session_diagnostics::InvalidSince { span: cx.attr_span }); |
| 142 | + cx.emit_err(InvalidSince { span: cx.attr_span }); |
146 | 143 | DeprecatedSince::Err |
147 | 144 | } |
148 | 145 | } else if is_rustc { |
149 | | - cx.emit_err(session_diagnostics::MissingSince { span: cx.attr_span }); |
| 146 | + cx.emit_err(MissingSince { span: cx.attr_span }); |
150 | 147 | DeprecatedSince::Err |
151 | 148 | } else { |
152 | 149 | DeprecatedSince::Unspecified |
153 | 150 | }; |
154 | 151 |
|
155 | 152 | if is_rustc && note.is_none() { |
156 | | - cx.emit_err(session_diagnostics::MissingNote { span: cx.attr_span }); |
| 153 | + cx.emit_err(MissingNote { span: cx.attr_span }); |
157 | 154 | return None; |
158 | 155 | } |
159 | 156 |
|
|
0 commit comments