Stop using the old validate_attr logic for stability attributes
This commit is contained in:
parent
20aa182235
commit
af06bb925f
3 changed files with 47 additions and 14 deletions
|
|
@ -74,8 +74,15 @@ impl<S: Stage> AttributeParser<S> for StabilityParser {
|
|||
template!(NameValueStr: "deprecation message"),
|
||||
|this, cx, args| {
|
||||
reject_outside_std!(cx);
|
||||
this.allowed_through_unstable_modules =
|
||||
args.name_value().and_then(|i| i.value_as_str())
|
||||
let Some(nv) = args.name_value() else {
|
||||
cx.expected_name_value(cx.attr_span, None);
|
||||
return;
|
||||
};
|
||||
let Some(value_str) = nv.value_as_str() else {
|
||||
cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
|
||||
return;
|
||||
};
|
||||
this.allowed_through_unstable_modules = Some(value_str);
|
||||
},
|
||||
),
|
||||
];
|
||||
|
|
@ -247,7 +254,12 @@ pub(crate) fn parse_stability<S: Stage>(
|
|||
let mut feature = None;
|
||||
let mut since = None;
|
||||
|
||||
for param in args.list()?.mixed() {
|
||||
let ArgParser::List(list) = args else {
|
||||
cx.expected_list(cx.attr_span);
|
||||
return None;
|
||||
};
|
||||
|
||||
for param in list.mixed() {
|
||||
let param_span = param.span();
|
||||
let Some(param) = param.meta_item() else {
|
||||
cx.emit_err(session_diagnostics::UnsupportedLiteral {
|
||||
|
|
@ -322,7 +334,13 @@ pub(crate) fn parse_unstability<S: Stage>(
|
|||
let mut is_soft = false;
|
||||
let mut implied_by = None;
|
||||
let mut old_name = None;
|
||||
for param in args.list()?.mixed() {
|
||||
|
||||
let ArgParser::List(list) = args else {
|
||||
cx.expected_list(cx.attr_span);
|
||||
return None;
|
||||
};
|
||||
|
||||
for param in list.mixed() {
|
||||
let Some(param) = param.meta_item() else {
|
||||
cx.emit_err(session_diagnostics::UnsupportedLiteral {
|
||||
span: param.span(),
|
||||
|
|
|
|||
|
|
@ -285,6 +285,9 @@ pub fn check_builtin_meta_item(
|
|||
| sym::rustc_do_not_implement_via_object
|
||||
| sym::rustc_coinductive
|
||||
| sym::const_trait
|
||||
| sym::stable
|
||||
| sym::unstable
|
||||
| sym::rustc_allowed_through_unstable_modules
|
||||
| sym::rustc_specialization_trait
|
||||
| sym::rustc_unsafe_specialization_marker
|
||||
| sym::rustc_allow_incoherent_impl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue