Skip to content

Commit 2c66cb8

Browse files
committed
refactor(dist/triple): move known triples to dist::triple::known
1 parent 40fbf42 commit 2c66cb8

File tree

2 files changed

+46
-48
lines changed

2 files changed

+46
-48
lines changed

src/dist/triple.rs

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,7 @@
11
use once_cell::sync::Lazy;
22
use regex::Regex;
33

4-
// These lists contain the targets known to rustup, and used to build
5-
// the PartialTargetTriple.
6-
7-
static LIST_ARCHS: &[&str] = &[
8-
"i386",
9-
"i586",
10-
"i686",
11-
"x86_64",
12-
"arm",
13-
"armv7",
14-
"armv7s",
15-
"aarch64",
16-
"mips",
17-
"mipsel",
18-
"mips64",
19-
"mips64el",
20-
"powerpc",
21-
"powerpc64",
22-
"powerpc64le",
23-
"riscv64gc",
24-
"s390x",
25-
"loongarch64",
26-
];
27-
static LIST_OSES: &[&str] = &[
28-
"pc-windows",
29-
"unknown-linux",
30-
"apple-darwin",
31-
"unknown-netbsd",
32-
"apple-ios",
33-
"linux",
34-
"rumprun-netbsd",
35-
"unknown-freebsd",
36-
"unknown-illumos",
37-
];
38-
static LIST_ENVS: &[&str] = &[
39-
"gnu",
40-
"gnux32",
41-
"msvc",
42-
"gnueabi",
43-
"gnueabihf",
44-
"gnuabi64",
45-
"androideabi",
46-
"android",
47-
"musl",
48-
];
4+
pub mod known;
495

506
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
517
pub struct PartialTargetTriple {
@@ -71,9 +27,9 @@ impl PartialTargetTriple {
7127
static RE: Lazy<Regex> = Lazy::new(|| {
7228
Regex::new(&format!(
7329
r"^(?:-({}))?(?:-({}))?(?:-({}))?$",
74-
LIST_ARCHS.join("|"),
75-
LIST_OSES.join("|"),
76-
LIST_ENVS.join("|")
30+
known::LIST_ARCHS.join("|"),
31+
known::LIST_OSES.join("|"),
32+
known::LIST_ENVS.join("|")
7733
))
7834
.unwrap()
7935
});

src/dist/triple/known.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
pub static LIST_ARCHS: &[&str] = &[
2+
"i386",
3+
"i586",
4+
"i686",
5+
"x86_64",
6+
"arm",
7+
"armv7",
8+
"armv7s",
9+
"aarch64",
10+
"mips",
11+
"mipsel",
12+
"mips64",
13+
"mips64el",
14+
"powerpc",
15+
"powerpc64",
16+
"powerpc64le",
17+
"riscv64gc",
18+
"s390x",
19+
"loongarch64",
20+
];
21+
pub static LIST_OSES: &[&str] = &[
22+
"pc-windows",
23+
"unknown-linux",
24+
"apple-darwin",
25+
"unknown-netbsd",
26+
"apple-ios",
27+
"linux",
28+
"rumprun-netbsd",
29+
"unknown-freebsd",
30+
"unknown-illumos",
31+
];
32+
pub static LIST_ENVS: &[&str] = &[
33+
"gnu",
34+
"gnux32",
35+
"msvc",
36+
"gnueabi",
37+
"gnueabihf",
38+
"gnuabi64",
39+
"androideabi",
40+
"android",
41+
"musl",
42+
];

0 commit comments

Comments
 (0)