Skip to content
Merged
Show file tree
Hide file tree
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: 9 additions & 7 deletions dropshot/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Oxide Computer Company
// Copyright 2023 Oxide Computer Company
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,12 +16,14 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");

if version_check::is_min_version("1.59").unwrap_or(false) {
println!("cargo:rustc-cfg=usdt_stable_asm");
if !version_check::is_min_version("1.59").unwrap_or(false) {
println!("cargo:rustc-cfg=usdt_need_asm");
}

// Once asm_sym is stablilized, add an additional check so that those
// building on macos can use the stable toolchain with any hassle.
//
// A matching rust-cfg option named `usdt_stable_asm_sym` seems appropriate.
#[cfg(target_os = "macos")]
if version_check::supports_feature("asm_sym").unwrap_or(false)
&& !version_check::is_min_version("1.67").unwrap_or(false)
{
println!("cargo:rustc-cfg=usdt_need_asm_sym");
}
}
21 changes: 9 additions & 12 deletions dropshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,12 @@
//! See the [`RequestInfo`] and [`ResponseInfo`] types for a complete listing
//! of what's available.
//!
//! These probes are implemented via the [`usdt`] crate. They require a nightly
//! toolchain if built on MacOS (which requires the unstable `asm_sym` feature).
//! Otherwise a stable compiler >= v1.59 is required in order to present the
//! necessary features. Given these constraints, usdt functionality is behind
//! the feature flag `"usdt-probes"`.
//! These probes are implemented via the [`usdt`] crate. They may require a
//! nightly toolchain if built on macOS prior to Rust version 1.66. Otherwise a
//! stable compiler >= v1.59 is required in order to present the necessary
//! features. Given these constraints, USDT functionality is behind the feature
//! flag `"usdt-probes"`, which may become a default feature of this crate in
//! future releases.
//!
//! > *Important:* The probes are internally registered with the DTrace kernel
//! module, making them visible via `dtrace(1M)`. This is done when an `HttpServer`
Expand Down Expand Up @@ -540,15 +541,11 @@
// Clippy's style advice is definitely valuable, but not worth the trouble for
// automated enforcement.
#![allow(clippy::style)]
// The `usdt` crate requires nightly, enabled if our consumer is enabling
// The `usdt` crate may requires nightly, enabled if our consumer is enabling
// DTrace probes.
#![cfg_attr(all(feature = "usdt-probes", not(usdt_stable_asm)), feature(asm))]
#![cfg_attr(all(feature = "usdt-probes", usdt_need_asm), feature(asm))]
#![cfg_attr(
all(
feature = "usdt-probes",
target_os = "macos",
not(usdt_stable_asm_sym)
),
all(feature = "usdt-probes", target_os = "macos", usdt_need_asm_sym),
feature(asm_sym)
)]

Expand Down