Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meta] update MSRV to 1.75, turn on asm support unconditionally #267

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 0 additions & 27 deletions common-build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions probe-test-attr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

use serde::Serialize;

/// By deriving the `serde::Serialize` trait, the `Arg` struct can be used as an argument to a
Expand Down
10 changes: 0 additions & 10 deletions probe-test-build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=test.d");
Builder::new("test.d").build().unwrap();
}
3 changes: 0 additions & 3 deletions probe-test-build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

use std::thread::sleep;
use std::time::Duration;

Expand Down
3 changes: 0 additions & 3 deletions probe-test-macro/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

use std::thread::sleep;
use std::time::Duration;

Expand Down
2 changes: 0 additions & 2 deletions tests/argument-types/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
use serde::Serialize;

/// Most struct or tuple types implementing serde::Serialize may be used in probes.
Expand Down
10 changes: 0 additions & 10 deletions tests/does-it-work/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=test.d");
Builder::new("test.d").build().unwrap();
}
2 changes: 0 additions & 2 deletions tests/does-it-work/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
#![allow(non_snake_case)]

use usdt::register_probes;
Expand Down
10 changes: 0 additions & 10 deletions tests/empty/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=provider.d");
Builder::new("provider.d")
.build()
Expand Down
2 changes: 0 additions & 2 deletions tests/empty/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
#![deny(warnings)]

use usdt::register_probes;
Expand Down
2 changes: 0 additions & 2 deletions tests/fake-cmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
#![deny(warnings)]

fn main() {
Expand Down
10 changes: 0 additions & 10 deletions tests/fake-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=test.d");
Builder::new("test.d").build().unwrap();
}
2 changes: 0 additions & 2 deletions tests/fake-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
#![deny(warnings)]

pub use usdt::register_probes;
Expand Down
3 changes: 0 additions & 3 deletions tests/modules/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

mod inner;

fn main() {
Expand Down
10 changes: 0 additions & 10 deletions tests/rename-builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=test.d");
Builder::new("test.d").module("still_test").build().unwrap();
}
2 changes: 0 additions & 2 deletions tests/rename-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
include!(concat!(env!("OUT_DIR"), "/test.rs"));

fn main() {
Expand Down
3 changes: 0 additions & 3 deletions tests/rename/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

#[usdt::provider(provider = "something", probe_format = "probe_{probe}")]
mod probes {
fn something() {}
Expand Down
3 changes: 0 additions & 3 deletions tests/test-json/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

use serde::{Serialize, Serializer};

// Expected error message from serialization failure
Expand Down
3 changes: 0 additions & 3 deletions tests/test-unique-id/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

#[usdt::provider]
mod with_ids {
use usdt::UniqueId;
Expand Down
3 changes: 0 additions & 3 deletions tests/usize/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

#[usdt::provider]
mod usize__test {
fn emit_usize(_: usize) {}
Expand Down
10 changes: 0 additions & 10 deletions tests/zero-arg-probe/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ use usdt::Builder;
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_need_feat_asm");
}
#[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_feat_asm_sym");
}

println!("cargo:rerun-if-changed=test.d");
Builder::new("test.d").build().unwrap();
}
2 changes: 0 additions & 2 deletions tests/zero-arg-probe/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
#![deny(warnings)]

use usdt::register_probes;
Expand Down
51 changes: 3 additions & 48 deletions usdt-impl/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,57 +28,12 @@ enum Backend {
fn main() {
println!("cargo:rerun-if-changed=build.rs");

// `asm` feature was stabilized in 1.59
let have_stable_asm = version_check::is_min_version("1.59").unwrap_or(false);
// `asm_sym` feature was stabilized in 1.66
let have_stable_asm_sym = version_check::is_min_version("1.66").unwrap_or(false);

// Are we being built with a compiler which allows feature flags (nightly)
let is_nightly = version_check::is_feature_flaggable().unwrap_or(false);

let feat_asm = env::var_os("CARGO_FEATURE_ASM").is_some();
let feat_strict_asm = env::var_os("CARGO_FEATURE_STRICT_ASM").is_some();

let backend = match env::var("CARGO_CFG_TARGET_OS").ok().as_deref() {
Some("macos") if feat_asm => {
if have_stable_asm && have_stable_asm_sym {
Backend::Linker
} else if feat_strict_asm || is_nightly {
if !have_stable_asm {
println!("cargo:rustc-cfg=usdt_need_feat_asm");
}
if !have_stable_asm_sym {
println!("cargo:rustc-cfg=usdt_need_feat_asm_sym");
}
Backend::Linker
} else {
Backend::NoOp
}
}
Some("illumos") | Some("solaris") if feat_asm => {
if have_stable_asm {
Backend::Standard
} else if feat_strict_asm || is_nightly {
println!("cargo:rustc-cfg=usdt_need_feat_asm");
Backend::Standard
} else {
Backend::NoOp
}
}
_ => {
if !have_stable_asm {
println!("cargo:rustc-cfg=usdt_need_feat_asm");
}
Backend::NoOp
}
Some("macos") => Backend::Linker,
Some("illumos") | Some("solaris") => Backend::Standard,
_ => Backend::NoOp,
};

// Since visibility of the `asm!()` macro differs between the nightly feature and the
// stabilized version, the consumer requires information about its availability
if have_stable_asm {
println!("cargo:rustc-cfg=usdt_stable_asm");
}

match backend {
Backend::NoOp => {
println!("cargo:rustc-cfg=usdt_backend_noop");
Expand Down
3 changes: 0 additions & 3 deletions usdt-impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(usdt_need_feat_asm, feature(asm))]
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]

use serde::Deserialize;
use std::cell::RefCell;
use thiserror::Error;
Expand Down
5 changes: 1 addition & 4 deletions usdt-impl/src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ fn compile_probe(
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
compile_error!("USDT only supports x86_64 and AArch64 architectures");

#[cfg(usdt_stable_asm)]
let asm_macro = quote! { std::arch::asm };
#[cfg(not(usdt_stable_asm))]
let asm_macro = quote! { asm };
let asm_macro = quote! { ::std::arch::asm };

let impl_block = quote! {
extern "C" {
Expand Down
5 changes: 1 addition & 4 deletions usdt-impl/src/no-linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ fn compile_probe(
let (unpacked_args, in_regs) = common::construct_probe_args(&probe.types);
let is_enabled_rec = emit_probe_record(&provider.name, &probe.name, None);
let probe_rec = emit_probe_record(&provider.name, &probe.name, Some(&probe.types));
#[cfg(usdt_stable_asm)]
let asm_macro = quote! { std::arch::asm };
#[cfg(not(usdt_stable_asm))]
let asm_macro = quote! { asm };
let asm_macro = quote! { ::std::arch::asm };

let impl_block = quote! {
{
Expand Down
2 changes: 1 addition & 1 deletion usdt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "Apache-2.0"
description = "Dust your Rust with USDT probes"
repository = "https://github.com/oxidecomputer/usdt.git"
rust-version = "1.63.0"
rust-version = "1.75.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting here, rather than lines 32-35, because GH review is bad...

We should be able to get rid of the asm feature in the child crates (usdt-impl, usdt-macro, usdt-attr-macro), I think? Leaving it at the top level makes sense, so that consumers are not forced to update their consumption until such time that we cut a version for breaking changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good point. I wasn't actually sure whether those features were private or not so I left them in place. Sounds like it's just usdt that's public, and the rest are private.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all the crates besides usdt are private implementation details, so I agree with Patrick, it'd be good to remove them. When we do get around to cutting a v0.6.0 and dropping the public features, we can close #57.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped non-public features, and added a comment.

# NOTE: The use of path and version dependencies is deliberate and load-bearing.
#
Expand Down