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..fd53509598675 100644 --- a/src/doc/rustc/src/platform-support/openbsd.md +++ b/src/doc/rustc/src/platform-support/openbsd.md @@ -19,6 +19,18 @@ 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] +> These targets, if supported by the next OpenBSD `-current` release +> channel, need to update the `rustc_target::spec::Env` type under +> `compiler/` in the `rust-lang/rust` repository whenever a new +> OpenBSD version is released. +> +> That should reflect the `-current` release channel, which is always +> one version above the latest `-release` channel version. +> +> One must also update the `src/librustdoc/clean.rs` file with the +> relevant formatted string providing a public view of this +> `target_env` value. ## Target Maintainers @@ -30,7 +42,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", 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`