diff options
| author | bors <bors@rust-lang.org> | 2025-05-08 21:32:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-05-08 21:32:19 +0000 |
| commit | 667247db71ea18c4130dd018d060e7f09d589490 (patch) | |
| tree | 459db133cc02cf8f3dc686d3313c95ecb2a2fddc /compiler/rustc_attr_parsing/src/attributes/deprecation.rs | |
| parent | 50aa04180709189a03dde5fd1c05751b2625ed37 (diff) | |
| parent | 4e4d6ad43ccfd786881cc777addb129dd4f487e3 (diff) | |
| download | rust-667247db71ea18c4130dd018d060e7f09d589490.tar.gz rust-667247db71ea18c4130dd018d060e7f09d589490.zip | |
Auto merge of #140818 - matthiaskrgr:rollup-5eaotr2, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #140095 (Eliminate `word_and_empty` methods.) - #140341 (Clarify black_box warning a bit) - #140684 (Only include `dyn Trait<Assoc = ...>` associated type bounds for `Self: Sized` associated types if they are provided) - #140707 (Structurally normalize in range pattern checking in HIR typeck) - #140716 (Improve `-Zremap-path-scope` tests with dependency) - #140800 (Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux) - #140802 (Add release notes for 1.87.0) - #140811 (Enable triagebot note functionality for rust-lang/rust) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_attr_parsing/src/attributes/deprecation.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/deprecation.rs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/deprecation.rs b/compiler/rustc_attr_parsing/src/attributes/deprecation.rs index 7d1417446b2..fb3d5f57d4f 100644 --- a/compiler/rustc_attr_parsing/src/attributes/deprecation.rs +++ b/compiler/rustc_attr_parsing/src/attributes/deprecation.rs @@ -1,5 +1,4 @@ use rustc_attr_data_structures::{AttributeKind, DeprecatedSince, Deprecation}; -use rustc_span::symbol::Ident; use rustc_span::{Span, Symbol, sym}; use super::SingleAttributeParser; @@ -13,16 +12,13 @@ pub(crate) struct DeprecationParser; fn get( cx: &AcceptContext<'_>, - ident: Ident, + name: Symbol, param_span: Span, arg: &ArgParser<'_>, item: &Option<Symbol>, ) -> Option<Symbol> { if item.is_some() { - cx.emit_err(session_diagnostics::MultipleItem { - span: param_span, - item: ident.to_string(), - }); + cx.emit_err(session_diagnostics::MultipleItem { span: param_span, item: name.to_string() }); return None; } if let Some(v) = arg.name_value() { @@ -83,16 +79,16 @@ impl SingleAttributeParser for DeprecationParser { return None; }; - let (ident, arg) = param.word_or_empty(); + let ident_name = param.path_without_args().word_sym(); - match ident.name { - sym::since => { - since = Some(get(cx, ident, param_span, arg, &since)?); + match ident_name { + Some(name @ sym::since) => { + since = Some(get(cx, name, param_span, param.args(), &since)?); } - sym::note => { - note = Some(get(cx, ident, param_span, arg, ¬e)?); + Some(name @ sym::note) => { + note = Some(get(cx, name, param_span, param.args(), ¬e)?); } - sym::suggestion => { + Some(name @ sym::suggestion) => { if !features.deprecated_suggestion() { cx.emit_err(session_diagnostics::DeprecatedItemSuggestion { span: param_span, @@ -101,12 +97,12 @@ impl SingleAttributeParser for DeprecationParser { }); } - suggestion = Some(get(cx, ident, param_span, arg, &suggestion)?); + suggestion = Some(get(cx, name, param_span, param.args(), &suggestion)?); } _ => { cx.emit_err(session_diagnostics::UnknownMetaItem { span: param_span, - item: ident.to_string(), + item: param.path_without_args().to_string(), expected: if features.deprecated_suggestion() { &["since", "note", "suggestion"] } else { |
