From 55e853da518e94ebf7b03a156712b0f2a94a0176 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Fri, 7 Aug 2026 18:55:03 +0200 Subject: [PATCH 1/2] openbsd: add value to `target_env` for versioning - Add value to `target_env` of OpenBSD targets to allow keeping track of the latest release supported by each target. - Add documentation for maintaining this value for future OpenBSD releases. --- compiler/rustc_target/src/spec/base/openbsd.rs | 3 ++- compiler/rustc_target/src/spec/mod.rs | 1 + src/doc/rustc/src/platform-support/openbsd.md | 17 ++++++++++++++++- src/librustdoc/clean/cfg.rs | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_target/src/spec/base/openbsd.rs b/compiler/rustc_target/src/spec/base/openbsd.rs index 84395a407895a..957e1020faa94 100644 --- a/compiler/rustc_target/src/spec/base/openbsd.rs +++ b/compiler/rustc_target/src/spec/base/openbsd.rs @@ -1,8 +1,9 @@ -use crate::spec::{FramePointer, Os, RelroLevel, TargetOptions, TlsModel, cvs}; +use crate::spec::{Env, FramePointer, Os, RelroLevel, TargetOptions, TlsModel, cvs}; pub(crate) fn opts() -> TargetOptions { TargetOptions { os: Os::OpenBsd, + env: Env::OpenBsdCurrent, dynamic_linking: true, families: cvs!["unix"], has_rpath: true, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 1f17173953643..4fe8d068ed080 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2045,6 +2045,7 @@ crate::target_spec_enum! { Nto71 = "nto71", Nto71IoSock = "nto71_iosock", Ohos = "ohos", + OpenBsdCurrent = "openbsd8.0", Relibc = "relibc", Sgx = "sgx", Sim = "sim", diff --git a/src/doc/rustc/src/platform-support/openbsd.md b/src/doc/rustc/src/platform-support/openbsd.md index e6fb23ca9eefd..27574d468983b 100644 --- a/src/doc/rustc/src/platform-support/openbsd.md +++ b/src/doc/rustc/src/platform-support/openbsd.md @@ -19,6 +19,22 @@ The target names follow this format: `$ARCH-unknown-openbsd`, where `$ARCH` spec Note that all OS versions are *major* even if using X.Y notation (`6.8` and `6.9` are different major versions) and could be binary incompatibles (with breaking changes). + + +> [!IMPORTANT] +> Note these targets encode the latest OpenBSD version that supported +> them. In most cases, this means the version to be released once +> OpenBSD `-current` is made into a new `-release` release. ## Target Maintainers @@ -30,7 +46,6 @@ Further contacts: Fallback to ports@openbsd.org, OpenBSD third parties public mailing-list (with openbsd developers readers) - ## Requirements These targets are natively compiled and could be cross-compiled. diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 04dd0eaf22899..c32e3890fdda3 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -723,6 +723,7 @@ fn human_readable_target_env(env: Symbol) -> Option<&'static str> { Nto71 => "QNX SDP 7.1", Nto71IoSock => "QNX SDP 7.1 with io-sock", Ohos => "OpenHarmony", + OpenBsdCurrent => "OpenBSD -current (8.0)", P1 => "WASIp1", P2 => "WASIp2", P3 => "WASIp3", From 97a77ad42128d28c03fd24bd6153d78f04bc98f3 Mon Sep 17 00:00:00 2001 From: Adam Martinez <149513579+dybucc@users.noreply.github.com> Date: Mon, 10 Aug 2026 13:47:57 +0200 Subject: [PATCH 2/2] ui_tests: update expected `target_env` values Update expected values for `target_env` with the new `-current` OpenBSD version that is now encoded in their `target_env`. --- tests/ui/check-cfg/well-known-values.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 693833decc971..adcd9814e5a1f 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` + = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `openbsd7.9`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`