Skip to content

Commit 43b6ef1

Browse files
committed
feat: add changes from this pr: rust-lang/rust#128283
1 parent 974d720 commit 43b6ef1

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/bootstrap/src/core/config/config.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,11 @@ impl TargetSelection {
514514
pub fn is_windows(&self) -> bool {
515515
self.contains("windows")
516516
}
517+
518+
/// Path to the file defining the custom target, if any.
519+
pub fn filepath(&self) -> Option<&Path> {
520+
self.file.as_ref().map(Path::new)
521+
}
517522
}
518523

519524
impl fmt::Display for TargetSelection {
@@ -2388,7 +2393,11 @@ impl Config {
23882393
.get(&target)
23892394
.and_then(|t| t.split_debuginfo)
23902395
.or_else(|| {
2391-
if self.build == target { self.rust_split_debuginfo_for_build_triple } else { None }
2396+
if self.build == target {
2397+
self.rust_split_debuginfo_for_build_triple
2398+
} else {
2399+
None
2400+
}
23922401
})
23932402
.unwrap_or_else(|| SplitDebuginfo::default_for_platform(target))
23942403
}

src/bootstrap/src/core/sanity.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ than building it.
262262

263263
if !has_target {
264264
// This might also be a custom target, so check the target file that could have been specified by the user.
265-
if let Some(custom_target_path) = env::var_os("RUST_TARGET_PATH") {
265+
if target.filepath().is_some_and(|p| p.exists()) {
266+
has_target = true;
267+
} else if let Some(custom_target_path) = env::var_os("RUST_TARGET_PATH") {
266268
let mut target_filename = OsString::from(&target_str);
267269
// Target filename ends with `.json`.
268270
target_filename.push(".json");
@@ -277,8 +279,12 @@ than building it.
277279

278280
if !has_target {
279281
panic!(
280-
"No such target exists in the target list,
281-
specify a correct location of the JSON specification file for custom targets!"
282+
"No such target exists in the target list,\n\
283+
make sure to correctly specify the location \
284+
of the JSON specification file \
285+
for custom targets!\n\
286+
Use BOOTSTRAP_SKIP_TARGET_SANITY=1 to \
287+
bypass this check."
282288
);
283289
}
284290
}

tests/ui/check-cfg/well-known-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
230230
LL | target_vendor = "_UNEXPECTED_VALUE",
231231
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232232
|
233-
= note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
233+
= note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `succinct`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
234234
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
235235

236236
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`

0 commit comments

Comments
 (0)