Auto merge of #142921 - JonathanBrouwer:rustc_attributes_parser, r=oli-obk

Port `#[rustc_layout_scalar_valid_range_start/end]` to the new attrib…

Ports `rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@jdonszelmann`
This commit is contained in:
bors
2025-07-01 08:33:00 +00:00
14 changed files with 146 additions and 69 deletions

View File

@@ -510,6 +510,7 @@ pub(crate) struct NakedFunctionIncompatibleAttribute {
pub(crate) enum AttributeParseErrorReason {
ExpectedNoArgs,
ExpectedStringLiteral { byte_string: Option<Span> },
ExpectedIntegerLiteral,
ExpectedAtLeastOneArgument,
ExpectedSingleArgument,
ExpectedList,
@@ -550,6 +551,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
diag.span_label(self.span, "expected a string literal here");
}
}
AttributeParseErrorReason::ExpectedIntegerLiteral => {
diag.span_label(self.span, "expected an integer literal here");
}
AttributeParseErrorReason::ExpectedSingleArgument => {
diag.span_label(self.span, "expected a single argument here");
diag.code(E0805);