Skip to content

Commit 3e9a223

Browse files
authored
Rollup merge of #104523 - flba-eb:fix_nto_target_name, r=wesleywiser
Don't use periods in target names Using a period in the target name can cause issues in e.g. cargo, see also https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Running.20tests.20on.20remote.20target
2 parents e4d1fe7 + 9c3555d commit 3e9a223

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,8 @@ supported_targets! {
12501250

12511251
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
12521252

1253-
("aarch64-unknown-nto-qnx7.1.0", aarch64_unknown_nto_qnx_710),
1254-
("x86_64-pc-nto-qnx7.1.0", x86_64_pc_nto_qnx710),
1253+
("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx_710),
1254+
("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710),
12551255
}
12561256

12571257
/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>

src/doc/rustc/src/platform-support.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ target | std | host | notes
214214
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
215215
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
216216
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
217-
[`aarch64-unknown-nto-qnx7.1.0`](platform-support/nto-qnx.md) | ? | | ARM64 QNX Neutrino 7.1 RTOS |
217+
[`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ? | | ARM64 QNX Neutrino 7.1 RTOS |
218218
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
219219
`aarch64-unknown-hermit` | ✓ | | ARM64 HermitCore
220220
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
@@ -305,7 +305,7 @@ target | std | host | notes
305305
`x86_64-apple-ios-macabi` | ✓ | | Apple Catalyst on x86_64
306306
`x86_64-apple-tvos` | * | | x86 64-bit tvOS
307307
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator
308-
[`x86_64-pc-nto-qnx7.1.0`](platform-support/nto-qnx.md) | ? | | x86 64-bit QNX Neutrino 7.1 RTOS |
308+
[`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ? | | x86 64-bit QNX Neutrino 7.1 RTOS |
309309
[`x86_64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
310310
`x86_64-pc-windows-msvc` | * | | 64-bit Windows XP support
311311
`x86_64-sun-solaris` | ? | | Deprecated target for 64-bit Solaris 10/11, illumos

src/doc/rustc/src/platform-support/nto-qnx.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ Run the following:
9393

9494
```bash
9595
env \
96-
CC_aarch64-unknown-nto-qnx7.1.0="qcc" \
97-
CFLAGS_aarch64-unknown-nto-qnx7.1.0="-Vgcc_ntoaarch64le_cxx" \
98-
CXX_aarch64-unknown-nto-qnx7.1.0="qcc" \
99-
AR_aarch64_unknown_nto_qnx7.1.0="ntoaarch64-ar" \
100-
CC_x86_64-pc-nto-qnx7.1.0="qcc" \
101-
CFLAGS_x86_64-pc-nto-qnx7.1.0="-Vgcc_ntox86_64_cxx" \
102-
CXX_x86_64-pc-nto-qnx7.1.0="qcc" \
103-
AR_x86_64_pc_nto_qnx7.1.0="ntox86_64-ar" \
104-
./x.py build --target aarch64-unknown-nto-qnx7.1.0 --target x86_64-pc-nto-qnx7.1.0 --target x86_64-unknown-linux-gnu rustc library/core library/alloc/
96+
CC_aarch64-unknown-nto-qnx710="qcc" \
97+
CFLAGS_aarch64-unknown-nto-qnx710="-Vgcc_ntoaarch64le_cxx" \
98+
CXX_aarch64-unknown-nto-qnx710="qcc" \
99+
AR_aarch64_unknown_nto_qnx710="ntoaarch64-ar" \
100+
CC_x86_64-pc-nto-qnx710="qcc" \
101+
CFLAGS_x86_64-pc-nto-qnx710="-Vgcc_ntox86_64_cxx" \
102+
CXX_x86_64-pc-nto-qnx710="qcc" \
103+
AR_x86_64_pc_nto_qnx710="ntox86_64-ar" \
104+
./x.py build --target aarch64-unknown-nto-qnx710 --target x86_64-pc-nto-qnx710 --target x86_64-unknown-linux-gnu rustc library/core library/alloc/
105105
```
106106

107107
## Building Rust programs

src/doc/rustc/src/target-tier-policy.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ approved by the appropriate team for that shared code before acceptance.
158158
the name of the target makes people extremely likely to form incorrect
159159
beliefs about what it targets, the name should be changed or augmented to
160160
disambiguate it.
161+
- If possible, use only letters, numbers, dashes and underscores for the name.
162+
Periods (`.`) are known to cause issues in Cargo.
161163
- Tier 3 targets may have unusual requirements to build or use, but must not
162164
create legal issues or impose onerous legal terms for the Rust project or for
163165
Rust developers or users.

src/tools/tier-check/src/main.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,23 @@ fn main() {
4444
target, filename, src
4545
);
4646
}
47-
if !missing.is_empty() || !extra.is_empty() {
47+
// Check target names for unwanted characters like `.` that can cause problems e.g. in Cargo.
48+
// See also Tier 3 target policy.
49+
// If desired, target names can ignore this check.
50+
let ignore_target_names =
51+
vec!["thumbv8m.base-none-eabi", "thumbv8m.main-none-eabi", "thumbv8m.main-none-eabihf"];
52+
let mut invalid_target_name_found = false;
53+
for target in &target_list {
54+
if !ignore_target_names.contains(target)
55+
&& !target.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')
56+
{
57+
invalid_target_name_found = true;
58+
eprintln!(
59+
"error: Target name `{target}` contains other characters than ASCII alphanumeric (a-z, A-Z, 0-9), dash (-) or underscore (_)."
60+
);
61+
}
62+
}
63+
if !missing.is_empty() || !extra.is_empty() || invalid_target_name_found {
4864
std::process::exit(1);
4965
}
5066
}

0 commit comments

Comments
 (0)