rustc_target: move comment to macro

Avoid duplicating this comment in preparation for adding more enums.
This commit is contained in:
Tamir Duberstein 2025-11-06 22:51:07 -05:00
parent 25d319a0f6
commit c6f924c182
No known key found for this signature in database
2 changed files with 8 additions and 7 deletions

View file

@ -137,6 +137,14 @@ macro_rules! target_spec_enum {
$( #[$variant_attr:meta] )*
$Variant,
)*
/// The vast majority of the time, the compiler deals with a fixed
/// set of values, so it is convenient for them to be represented in
/// an enum. However, it is possible to have arbitrary values in a
/// target JSON file (which can be parsed when `--target` is
/// specified). This might occur, for example, for an out-of-tree
/// codegen backend that supports a value (e.g. architecture or OS)
/// that rustc currently doesn't know about. This variant exists as
/// an escape hatch for such cases.
$( #[$other_variant_attr] )*
$OtherVariant(crate::spec::StaticCow<str>),
}

View file

@ -1884,13 +1884,6 @@ crate::target_spec_enum! {
X86_64 = "x86_64",
Xtensa = "xtensa",
}
/// The vast majority of the time, the compiler deals with a fixed set of
/// target architectures, so it is convenient for them to be represented in
/// an enum. However, it is possible to have arbitrary values for the "arch"
/// field in a target JSON file (which can be parsed when `--target` is
/// specified). This might occur, for example, for an out-of-tree codegen
/// backend that supports an architecture that rustc currently doesn't know
/// about. This variant exists as an escape hatch for such cases.
other_variant = Unknown;
}