Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/deprecation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<S: Stage> SingleAttributeParser<S> for DeprecatedParser {
ArgParser::List(list) => {
for param in list.mixed() {
let Some(param) = param.meta_item() else {
cx.adcx().unexpected_literal(param.span());
cx.adcx().expected_not_literal(param.span());
return None;
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
let mut import_name_type = None;
for item in items.mixed() {
let Some(item) = item.meta_item() else {
cx.adcx().unexpected_literal(item.span());
cx.adcx().expected_not_literal(item.span());
continue;
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<S: Stage> SingleAttributeParser<S> for CollapseDebugInfoParser {
return None;
};
let Some(mi) = single.meta_item() else {
cx.adcx().unexpected_literal(single.span());
cx.adcx().expected_not_literal(single.span());
return None;
};
if let Err(err) = mi.args().no_args() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn parse_derive_like<S: Stage>(
return None;
};
let Some(trait_attr) = trait_attr.meta_item() else {
cx.adcx().unexpected_literal(trait_attr.span());
cx.adcx().expected_not_literal(trait_attr.span());
return None;
};
let Some(trait_ident) = trait_attr.path().word() else {
Expand All @@ -98,7 +98,7 @@ fn parse_derive_like<S: Stage>(
let mut attributes = ThinVec::new();
if let Some(attrs) = items.next() {
let Some(attr_list) = attrs.meta_item() else {
cx.adcx().unexpected_literal(attrs.span());
cx.adcx().expected_not_literal(attrs.span());
return None;
};
if !attr_list.path().word_is(sym::attributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ impl<S: Stage> CombineAttributeParser<S> for RustcLayoutParser {
let mut result = Vec::new();
for item in items.mixed() {
let Some(arg) = item.meta_item() else {
cx.adcx().unexpected_literal(item.span());
cx.adcx().expected_not_literal(item.span());
continue;
};
let Some(ident) = arg.ident() else {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub(crate) fn parse_stability<S: Stage>(
for param in list.mixed() {
let param_span = param.span();
let Some(param) = param.meta_item() else {
cx.adcx().unexpected_literal(param.span());
cx.adcx().expected_not_literal(param.span());
return None;
};

Expand Down Expand Up @@ -390,7 +390,7 @@ pub(crate) fn parse_unstability<S: Stage>(

for param in list.mixed() {
let Some(param) = param.meta_item() else {
cx.adcx().unexpected_literal(param.span());
cx.adcx().expected_not_literal(param.span());
return None;
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/test_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<S: Stage> SingleAttributeParser<S> for TestRunnerParser {
};

let Some(meta) = single.meta_item() else {
cx.adcx().unexpected_literal(single.span());
cx.adcx().expected_not_literal(single.span());
return None;
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcSkipDuringMethodDispatchParser
}
for arg in args.mixed() {
let Some(arg) = arg.meta_item() else {
cx.adcx().unexpected_literal(arg.span());
cx.adcx().expected_not_literal(arg.span());
continue;
};
if let Err(span) = arg.args().no_args() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,8 @@ where

/// An error that should be emitted when a [`MetaItemOrLitParser`](crate::parser::MetaItemOrLitParser)
/// was expected *not* to be a literal, but instead a meta item.
pub(crate) fn unexpected_literal(&mut self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::UnexpectedLiteral)
pub(crate) fn expected_not_literal(&mut self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedNotLiteral)
}

pub(crate) fn expected_single_argument(&mut self, span: Span) -> ErrorGuaranteed {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ pub(crate) enum AttributeParseErrorReason<'a> {
},
ExpectedNameValueOrNoArgs,
ExpectedNonEmptyStringLiteral,
UnexpectedLiteral,
ExpectedNotLiteral,
ExpectedNameValue(Option<Symbol>),
DuplicateKey(Symbol),
ExpectedSpecificArgument {
Expand Down Expand Up @@ -799,7 +799,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
diag.span_label(self.span, format!("found `{key}` used as a key more than once"));
diag.code(E0538);
}
AttributeParseErrorReason::UnexpectedLiteral => {
AttributeParseErrorReason::ExpectedNotLiteral => {
diag.span_label(self.span, "didn't expect a literal here");
diag.code(E0565);
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ symbols! {
new_upper_exp,
new_upper_hex,
next,
niko,
nll,
no,
no_builtins,
Expand Down
Loading