Skip to content

Commit 18d8866

Browse files
committed
Add avr_target_feature
1 parent 9f32ccf commit 18d8866

File tree

6 files changed

+46
-2
lines changed

6 files changed

+46
-2
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ declare_features! (
318318
(unstable, aarch64_ver_target_feature, "1.27.0", Some(44839)),
319319
(unstable, apx_target_feature, "1.88.0", Some(139284)),
320320
(unstable, arm_target_feature, "1.27.0", Some(44839)),
321+
(unstable, avr_target_feature, "CURRENT_RUSTC_VERSION", Some(146889)),
321322
(unstable, bpf_target_feature, "1.54.0", Some(44839)),
322323
(unstable, csky_target_feature, "1.73.0", Some(44839)),
323324
(unstable, ermsb_target_feature, "1.49.0", Some(44839)),

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ symbols! {
551551
autodiff_reverse,
552552
automatically_derived,
553553
available_externally,
554+
avr_target_feature,
554555
avx,
555556
avx10_target_feature,
556557
avx512_target_feature,

compiler/rustc_target/src/target_features.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,28 @@ static M68K_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
884884
// tidy-alphabetical-end
885885
];
886886

887+
static AVR_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
888+
// tidy-alphabetical-start
889+
("addsubiw", Unstable(sym::avr_target_feature), &[]),
890+
("break", Unstable(sym::avr_target_feature), &[]),
891+
("eijmpcall", Unstable(sym::avr_target_feature), &[]),
892+
("elpm", Unstable(sym::avr_target_feature), &[]),
893+
("elpmx", Unstable(sym::avr_target_feature), &[]),
894+
("ijmpcall", Unstable(sym::avr_target_feature), &[]),
895+
("jmpcall", Unstable(sym::avr_target_feature), &[]),
896+
("lowbytefirst", Unstable(sym::avr_target_feature), &[]),
897+
("lpm", Unstable(sym::avr_target_feature), &[]),
898+
("lpmx", Unstable(sym::avr_target_feature), &[]),
899+
("movw", Unstable(sym::avr_target_feature), &[]),
900+
("mul", Unstable(sym::avr_target_feature), &[]),
901+
("rmw", Unstable(sym::avr_target_feature), &[]),
902+
("spm", Unstable(sym::avr_target_feature), &[]),
903+
("spmx", Unstable(sym::avr_target_feature), &[]),
904+
("sram", Unstable(sym::avr_target_feature), &[]),
905+
("tinyencoding", Unstable(sym::avr_target_feature), &[]),
906+
// tidy-alphabetical-end
907+
];
908+
887909
/// When rustdoc is running, provide a list of all known features so that all their respective
888910
/// primitives may be documented.
889911
///
@@ -905,6 +927,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
905927
.chain(IBMZ_FEATURES)
906928
.chain(SPARC_FEATURES)
907929
.chain(M68K_FEATURES)
930+
.chain(AVR_FEATURES)
908931
.cloned()
909932
.map(|(f, s, _)| (f, s))
910933
}
@@ -972,6 +995,7 @@ impl Target {
972995
"s390x" => IBMZ_FEATURES,
973996
"sparc" | "sparc64" => SPARC_FEATURES,
974997
"m68k" => M68K_FEATURES,
998+
"avr" => AVR_FEATURES,
975999
_ => &[],
9761000
}
9771001
}
@@ -989,7 +1013,7 @@ impl Target {
9891013
"sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI,
9901014
"hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI,
9911015
"mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI,
992-
"nvptx64" | "bpf" | "m68k" => &[], // no vector ABI
1016+
"nvptx64" | "bpf" | "m68k" | "avr" => &[], // no vector ABI
9931017
"csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI,
9941018
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
9951019
// when passing args in vector registers.

tests/ui/check-cfg/target_feature.stderr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
1414
`7e10`
1515
`a`
1616
`aclass`
17+
`addsubiw`
1718
`adx`
1819
`aes`
1920
`altivec`
@@ -58,6 +59,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
5859
`bf16`
5960
`bmi1`
6061
`bmi2`
62+
`break`
6163
`bti`
6264
`bulk-memory`
6365
`c`
@@ -84,6 +86,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
8486
`e2`
8587
`ecv`
8688
`edsp`
89+
`eijmpcall`
90+
`elpm`
91+
`elpmx`
8792
`elrw`
8893
`enhanced-sort`
8994
`ermsb`
@@ -134,6 +139,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
134139
`hvx-length128b`
135140
`hwdiv`
136141
`i8mm`
142+
`ijmpcall`
137143
`isa-68000`
138144
`isa-68010`
139145
`isa-68020`
@@ -142,6 +148,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
142148
`isa-68060`
143149
`isa-68881`
144150
`isa-68882`
151+
`jmpcall`
145152
`jsconv`
146153
`kl`
147154
`lahfsahf`
@@ -152,6 +159,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
152159
`ld-seq-sa`
153160
`leoncasa`
154161
`lor`
162+
`lowbytefirst`
163+
`lpm`
164+
`lpmx`
155165
`lse`
156166
`lse128`
157167
`lse2`
@@ -173,11 +183,13 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
173183
`mops`
174184
`movbe`
175185
`movrs`
186+
`movw`
176187
`mp`
177188
`mp1e2`
178189
`msa`
179190
`msync`
180191
`mte`
192+
`mul`
181193
`multivalue`
182194
`mutable-globals`
183195
`neon`
@@ -242,6 +254,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
242254
`reference-types`
243255
`relax`
244256
`relaxed-simd`
257+
`rmw`
245258
`rtm`
246259
`rva23u64`
247260
`sb`
@@ -294,6 +307,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
294307
`sme2p1`
295308
`soft-float`
296309
`spe`
310+
`spm`
311+
`spmx`
312+
`sram`
297313
`ssbs`
298314
`sse`
299315
`sse2`
@@ -318,6 +334,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
318334
`tbm`
319335
`thumb-mode`
320336
`thumb2`
337+
`tinyencoding`
321338
`tme`
322339
`transactional-execution`
323340
`trust`

tests/ui/target-feature/gate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// gate-test-sparc_target_feature
2121
// gate-test-x87_target_feature
2222
// gate-test-m68k_target_feature
23+
// gate-test-avr_target_feature
2324

2425
#[target_feature(enable = "x87")]
2526
//~^ ERROR: currently unstable

tests/ui/target-feature/gate.stderr

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

0 commit comments

Comments
 (0)