From 00079dc08c1b0091dbd140b61d6da3d7b8dd7258 Mon Sep 17 00:00:00 2001 From: Florian Bartels Date: Fri, 29 Nov 2024 16:30:11 +0100 Subject: [PATCH] Use default value if QNX_TARGET is not set --- .../src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs | 2 +- tests/assembly/targets/targets-elf.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs index 4595bcb50ae6b..9bbe9b777d8e8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { // More information: // https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html fn get_iosock_param() -> &'static str { - let target_dir = std::env::var("QNX_TARGET").expect("Environment variable QNX_TARGET is set"); + let target_dir = std::env::var("QNX_TARGET").unwrap_or_else(|_| "PLEASE_SET_ENV_VAR_QNX_TARGET".into()); let linker_param = format!("-L{target_dir}/aarch64le/io-sock/lib"); linker_param.leak() diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 3fb06edba4833..d14df425f6685 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -58,8 +58,8 @@ //@ [aarch64_unknown_nto_qnx710] compile-flags: --target aarch64-unknown-nto-qnx710 //@ [aarch64_unknown_nto_qnx710] needs-llvm-components: aarch64 //@ revisions: aarch64_unknown_nto_qnx710_iosock -//@ [aarch64_unknown_nto_qnx710] compile-flags: --target aarch64-unknown-nto-qnx710_iosock -//@ [aarch64_unknown_nto_qnx710] needs-llvm-components: aarch64 +//@ [aarch64_unknown_nto_qnx710_iosock] compile-flags: --target aarch64-unknown-nto-qnx710_iosock +//@ [aarch64_unknown_nto_qnx710_iosock] needs-llvm-components: aarch64 //@ revisions: aarch64_unknown_openbsd //@ [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd //@ [aarch64_unknown_openbsd] needs-llvm-components: aarch64