gccrs: attributes: Handle external tool annotations like rustfmt::

gcc/rust/ChangeLog:

	* util/rust-attribute-values.h: Add RUSTFMT value.
	* util/rust-attributes.cc: Define the attribute.
	* util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant.
	* expand/rust-macro-builtins.cc: Fix formatting.
This commit is contained in:
Arthur Cohen 2025-04-09 15:17:38 +02:00
parent 9ed95c0697
commit 73d72498f9
4 changed files with 8 additions and 3 deletions

View file

@ -83,7 +83,6 @@ const BiMap<std::string, BuiltinMacro> MacroBuiltin::builtins = {{
{"Ord", BuiltinMacro::Ord},
{"PartialOrd", BuiltinMacro::PartialOrd},
{"Hash", BuiltinMacro::Hash},
}};
AST::MacroTranscriberFunc

View file

@ -83,6 +83,8 @@ public:
static constexpr auto &FUNDAMENTAL = "fundamental";
static constexpr auto &NON_EXHAUSTIVE = "non_exhaustive";
static constexpr auto &RUSTFMT = "rustfmt";
};
} // namespace Values
} // namespace Rust

View file

@ -94,7 +94,8 @@ static const BuiltinAttrDefinition __definitions[]
{Attrs::RUSTC_ON_UNIMPLEMENTED, STATIC_ANALYSIS},
{Attrs::FUNDAMENTAL, TYPE_CHECK},
{Attrs::NON_EXHAUSTIVE, TYPE_CHECK}};
{Attrs::NON_EXHAUSTIVE, TYPE_CHECK},
{Attrs::RUSTFMT, EXTERNAL}};
BuiltinAttributeMappings *
BuiltinAttributeMappings::get ()

View file

@ -40,7 +40,10 @@ enum CompilerPass
HIR_LOWERING,
TYPE_CHECK,
STATIC_ANALYSIS,
CODE_GENERATION
CODE_GENERATION,
// External Rust tooling attributes, like #[rustfmt::skip]
EXTERNAL,
// Do we need to add something here for const fns?
};