Skip to content

Commit 19e642c

Browse files
committed
AI advice about unsupported arch error
1 parent 31867f1 commit 19e642c

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

clang-installer/src/downloader/static_dist.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! A module to download static binaries from cpp-linter/clang-tools-static-binaries.
22
33
use std::{
4+
env::consts::{ARCH, OS},
45
fs,
56
ops::RangeInclusive,
67
path::{Path, PathBuf},
@@ -26,8 +27,10 @@ pub enum StaticDistDownloadError {
2627
#[error("The requested version does not match any available versions")]
2728
UnsupportedVersion,
2829

29-
/// The static binaries are only built for x86_64 (amd64) architecture.
30-
#[error("The static binaries are only built for x86_64 (amd64) architecture")]
30+
/// The static binaries are only built for
31+
/// x86_64 and aarch64 architecture on Linux MacOS, and
32+
/// Windows (not aarch64 for Windows currently).
33+
#[error("The static binaries are not built for {OS} {ARCH} architecture")]
3134
UnsupportedArchitecture,
3235

3336
/// Failed to parse a URL.
@@ -98,11 +101,13 @@ impl StaticDistDownloader {
98101
#[cfg(any(
99102
// Windows support is only for x86_64 architecture (for now)
100103
all(target_os = "windows", not(target_arch = "x86_64")),
101-
// Non-Windows platforms support only x86_64 and aarch64 architectures
104+
// Linux and macOS support only x86_64 and aarch64 architectures
102105
all(
103-
unix,
106+
any(target_os = "linux", target_os = "macos"),
104107
not(any(target_arch = "x86_64", target_arch = "aarch64"))
105-
)
108+
),
109+
// Any OS other than Windows, Linux, or macOS is unsupported
110+
not(any(target_os = "windows", target_os = "linux", target_os = "macos")),
106111
))]
107112
return Err(StaticDistDownloadError::UnsupportedArchitecture);
108113

0 commit comments

Comments
 (0)