Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion aya-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,21 @@ pub fn build_ebpf<'a>(
&target,
]);

if channel == Channel::Nightly {
// RUSTC_BOOTSTRAP controls whether unstable features (-Z flags) are available:
// "1" – enable for all crates
// "<crate>" – enable only for the named crate
// "-1" – force stable behavior even on nightly (explicit opt-out)
// (unset/other) – follow the actual compiler channel
// See: https://doc.rust-lang.org/beta/unstable-book/compiler-environment-variables/RUSTC_BOOTSTRAP.html
let rustc_bootstrap = env::var("RUSTC_BOOTSTRAP").unwrap_or_default();
let use_build_std = if rustc_bootstrap == "-1" {
false
} else if rustc_bootstrap == "1" || rustc_bootstrap == name {
true
} else {
channel == Channel::Nightly
};
if use_build_std {
cmd.args(["-Z", "build-std=core"]);
}

Expand Down