Skip to content

Commit 56b8e66

Browse files
committed
Add m68k_target_feature
1 parent b57d93d commit 56b8e66

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

compiler/rustc_feature/src/unstable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ declare_features! (
332332
(unstable, hexagon_target_feature, "1.27.0", Some(44839)),
333333
(unstable, lahfsahf_target_feature, "1.78.0", Some(44839)),
334334
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
335+
(unstable, m68k_target_feature, "CURRENT_RUSTC_VERSION", Some(134328)),
335336
(unstable, mips_target_feature, "1.27.0", Some(44839)),
336337
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
337338
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ symbols! {
11901190
loongarch_target_feature,
11911191
loop_break_value,
11921192
lt,
1193+
m68k_target_feature,
11931194
macro_at_most_once_rep,
11941195
macro_attributes_in_derive_output,
11951196
macro_escape,

compiler/rustc_target/src/target_features.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,20 @@ const SPARC_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
668668
// tidy-alphabetical-end
669669
];
670670

671+
const M68K_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
672+
// tidy-alphabetical-start
673+
("isa-68000", unstable(sym::m68k_target_feature), &[]),
674+
("isa-68010", unstable(sym::m68k_target_feature), &["isa-68000"]),
675+
("isa-68020", unstable(sym::m68k_target_feature), &["isa-68010"]),
676+
("isa-68030", unstable(sym::m68k_target_feature), &["isa-68020"]),
677+
("isa-68040", unstable(sym::m68k_target_feature), &["isa-68030", "isa-68882"]),
678+
("isa-68060", unstable(sym::m68k_target_feature), &["isa-68040"]),
679+
// FPU
680+
("isa-68881", unstable(sym::m68k_target_feature), &[]),
681+
("isa-68882", unstable(sym::m68k_target_feature), &["isa-68881"]),
682+
// tidy-alphabetical-end
683+
];
684+
671685
/// When rustdoc is running, provide a list of all known features so that all their respective
672686
/// primitives may be documented.
673687
///
@@ -687,6 +701,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, StabilityUncom
687701
.chain(LOONGARCH_FEATURES)
688702
.chain(IBMZ_FEATURES)
689703
.chain(SPARC_FEATURES)
704+
.chain(M68K_FEATURES)
690705
.cloned()
691706
.map(|(f, s, _)| (f, s))
692707
}
@@ -734,6 +749,7 @@ impl Target {
734749
"loongarch64" => LOONGARCH_FEATURES,
735750
"s390x" => IBMZ_FEATURES,
736751
"sparc" | "sparc64" => SPARC_FEATURES,
752+
"m68k" => M68K_FEATURES,
737753
_ => &[],
738754
}
739755
}
@@ -751,7 +767,7 @@ impl Target {
751767
"sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI,
752768
"hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI,
753769
"mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI,
754-
"bpf" => &[], // no vector ABI
770+
"bpf" | "m68k" => &[], // no vector ABI
755771
"csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI,
756772
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
757773
// when passing args in vector registers.

tests/ui/check-cfg/target_feature.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
118118
`hvx-length128b`
119119
`hwdiv`
120120
`i8mm`
121+
`isa-68000`
122+
`isa-68010`
123+
`isa-68020`
124+
`isa-68030`
125+
`isa-68040`
126+
`isa-68060`
127+
`isa-68881`
128+
`isa-68882`
121129
`jsconv`
122130
`lahfsahf`
123131
`lasx`

tests/ui/target-feature/gate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// gate-test-s390x_target_feature
2626
// gate-test-sparc_target_feature
2727
// gate-test-x87_target_feature
28+
// gate-test-m68k_target_feature
2829

2930
#[target_feature(enable = "avx512bw")]
3031
//~^ ERROR: currently unstable

tests/ui/target-feature/gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the target feature `avx512bw` is currently unstable
2-
--> $DIR/gate.rs:29:18
2+
--> $DIR/gate.rs:30:18
33
|
44
LL | #[target_feature(enable = "avx512bw")]
55
| ^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)