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
18 changes: 9 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0
toolchain: 1.88.0
components: rustfmt
- run: cargo fmt -- --check

Expand All @@ -28,7 +28,7 @@ jobs:
matrix:
os: [ "macos-15", "ubuntu-24.04-arm", "ubuntu-latest" ]
# Test on MSRV and stable.
toolchain: [ "1.85.0", "stable" ]
toolchain: [ "1.88.0", "stable" ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [ "1.85.0", "stable", "nightly-2025-01-01" ]
toolchain: [ "1.88.0", "stable", "nightly-2025-05-05" ]
steps:
- uses: actions/checkout@v4
- name: Test on FreeBSD
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
matrix:
os: [ "macos-15", "ubuntu-24.04-arm", "ubuntu-latest" ]
# Test on the pinned rust-toolchain version.
toolchain: [ "1.85.0" ]
toolchain: [ "1.88.0" ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand All @@ -101,7 +101,7 @@ jobs:
matrix:
os: [ "windows-latest" ]
# Test on MSRV and stable.
toolchain: [ "1.85.0", "stable" ]
toolchain: [ "1.88.0", "stable" ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -151,9 +151,9 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-01-01
toolchain: nightly-2025-05-05
- run: >
cargo +nightly-2025-01-01 test
cargo +nightly-2025-05-05 test
--release
--verbose
--workspace
Expand All @@ -171,9 +171,9 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-01-01
toolchain: nightly-2025-05-05
- run: >
cargo +nightly-2025-01-01 test
cargo +nightly-2025-05-05 test
--release
--verbose
--workspace
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dusty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.2.0"
edition = "2021"
description = "Tool to inspect USDT probe records in object files"
license = "Apache-2.0"
rust-version = "1.85.0"
rust-version = "1.88.0"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
#
# NOTE: This toolchain is also specified within .github/workflows/rust.yml
# If you update it here, update that file too.
channel = "1.85.0"
channel = "1.88.0"
profile = "default"
4 changes: 2 additions & 2 deletions tests/compile-errors/src/no-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ error: proc macro panicked
|
= help: message: Could not read D source file "../../../tests/compile-errors/providers/type-mismatch.d" in "$WORKSPACE/target/tests/trybuild/compile-errors"

error[E0433]: failed to resolve: use of undeclared crate or module `mismatch`
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mismatch`
--> src/no-closure.rs:19:5
|
19 | mismatch::bad!(arg);
| ^^^^^^^^ use of undeclared crate or module `mismatch`
| ^^^^^^^^ use of unresolved module or unlinked crate `mismatch`
8 changes: 4 additions & 4 deletions tests/compile-errors/src/relative-import.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: Use-statements in USDT macros cannot contain relative imports (`super`), because the generated macros may be called from anywhere in a crate. Consider using `crate` instead.
--> $DIR/relative-import.rs:24:9
--> src/relative-import.rs:24:9
|
24 | use super::Expected;
| ^^^^^

error[E0433]: failed to resolve: use of undeclared crate or module `my_provider`
--> $DIR/relative-import.rs:29:5
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_provider`
--> src/relative-import.rs:29:5
|
29 | my_provider::my_probe!(|| Different { x: 0 });
| ^^^^^^^^^^^ use of undeclared crate or module `my_provider`
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `my_provider`
4 changes: 2 additions & 2 deletions tests/compile-errors/src/type-mismatch.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ error: proc macro panicked
|
= help: message: Could not read D source file "../../../tests/compile-errors/providers/type-mismatch.d" in "$WORKSPACE/target/tests/trybuild/compile-errors"

error[E0433]: failed to resolve: use of undeclared crate or module `mismatch`
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mismatch`
--> src/type-mismatch.rs:19:5
|
19 | mismatch::bad!(|| (bad));
| ^^^^^^^^ use of undeclared crate or module `mismatch`
| ^^^^^^^^ use of unresolved module or unlinked crate `mismatch`
4 changes: 2 additions & 2 deletions tests/compile-errors/src/unsupported-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ error: proc macro panicked
|
= help: message: Could not read D source file "../../../tests/compile-errors/providers/unsupported-type.d" in "$WORKSPACE/target/tests/trybuild/compile-errors"

error[E0433]: failed to resolve: use of undeclared crate or module `unsupported`
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unsupported`
--> src/unsupported-type.rs:19:5
|
19 | unsupported::bad!(|| (bad));
| ^^^^^^^^^^^ use of undeclared crate or module `unsupported`
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `unsupported`
2 changes: 1 addition & 1 deletion tests/test-unique-id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ usdt = { path = "../../usdt" }
usdt-tests-common = { path = "../../usdt-tests-common" }

[dev-dependencies]
subprocess = "0.2"
subprocess = "1.0"
24 changes: 13 additions & 11 deletions tests/test-unique-id/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ mod tests {
.arg("-q")
.arg("-n")
.arg(r#"with_ids*:::waypoint_from_thread { printf("%u\n", arg0); exit(0); }"#)
.stdin(subprocess::NullFile)
.stdin(subprocess::Redirection::Null)
.stderr(subprocess::Redirection::Pipe)
.stdout(subprocess::Redirection::Pipe)
.popen()
.start()
.expect("Failed to run DTrace");
thread::sleep(Duration::from_millis(1000));
let id = UniqueId::new();
Expand All @@ -78,24 +78,25 @@ mod tests {
thr.join().unwrap();

const TIMEOUT: Duration = Duration::from_secs(10);
let mut comm = dtrace.communicate_start(None).limit_time(TIMEOUT);
let mut comm = dtrace
.communicate()
.expect("failed to get communicator with subprocess")
.limit_time(TIMEOUT);
if dtrace
.wait_timeout(TIMEOUT)
.expect("DTrace command failed")
.is_none()
{
std::process::Command::new(sudo)
.arg("kill")
.arg(format!("{}", dtrace.pid().unwrap()))
.arg(format!("{}", dtrace.pid()))
.spawn()
.expect("Failed to spawn kill")
.wait()
.expect("Failed to kill DTrace subprocess");
panic!("DTrace didn't exit within timeout of {:?}", TIMEOUT);
}
let (stdout, stderr) = comm.read_string().expect("Failed to read DTrace output");
let stdout = stdout.unwrap_or_else(|| String::from("<EMPTY>"));
let stderr = stderr.unwrap_or_else(|| String::from("<EMPTY>"));
let actual_id: u64 = stdout.trim().parse().unwrap_or_else(|_| {
panic!(
concat!(
Expand Down Expand Up @@ -151,7 +152,7 @@ mod tests {
.arg(std::process::id().to_string())
.stderr(subprocess::Redirection::Pipe)
.stdout(subprocess::Redirection::Pipe)
.popen()
.start()
.expect("Failed to run bpftrace");
thread::sleep(Duration::from_millis(1000));
let id = UniqueId::new();
Expand All @@ -162,24 +163,25 @@ mod tests {
thr.join().unwrap();

const TIMEOUT: Duration = Duration::from_secs(10);
let mut comm = bpftrace.communicate_start(None).limit_time(TIMEOUT);
let mut comm = bpftrace
.communicate()
.expect("failed to get communicator with subprocess")
.limit_time(TIMEOUT);
if bpftrace
.wait_timeout(TIMEOUT)
.expect("bpftrace command failed")
.is_none()
{
std::process::Command::new(root_command())
.arg("kill")
.arg(format!("{}", bpftrace.pid().unwrap()))
.arg(format!("{}", bpftrace.pid()))
.spawn()
.expect("Failed to spawn kill")
.wait()
.expect("Failed to kill bpftrace subprocess");
panic!("bpftrace didn't exit within timeout of {:?}", TIMEOUT);
}
let (stdout, stderr) = comm.read_string().expect("Failed to read bpftrace output");
let stdout = stdout.unwrap_or_else(|| String::from("<EMPTY>"));
let stderr = stderr.unwrap_or_else(|| String::from("<EMPTY>"));
eprintln!("stdout: {}", stdout.trim());
eprintln!("stderr: {}", stderr.trim());
let actual_id: u64 = stdout.trim().parse().unwrap_or_else(|_| {
Expand Down
14 changes: 10 additions & 4 deletions usdt-attr-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ fn parse_probe_argument(
Ok((None, DataType::UniqueId))
} else {
let check_fn = build_serializable_check_function(item, fn_index, arg_index);
Ok((Some(check_fn), DataType::Serializable(item.clone())))
Ok((
Some(check_fn),
DataType::Serializable(Box::new(item.clone())),
))
}
}
syn::Type::Ptr(ref pointer) => {
Expand Down Expand Up @@ -227,13 +230,16 @@ fn parse_probe_argument(
(None, DataType::Native(ty)) => Ok((None, DataType::Native(ty))),
_ => Ok((
Some(build_serializable_check_function(item, fn_index, arg_index)),
DataType::Serializable(item.clone()),
DataType::Serializable(Box::new(item.clone())),
)),
}
}
syn::Type::Array(_) | syn::Type::Slice(_) | syn::Type::Tuple(_) => {
let check_fn = build_serializable_check_function(item, fn_index, arg_index);
Ok((Some(check_fn), DataType::Serializable(item.clone())))
Ok((
Some(check_fn),
DataType::Serializable(Box::new(item.clone())),
))
}
_ => Err(syn::Error::new(
item.span(),
Expand Down Expand Up @@ -488,7 +494,7 @@ mod tests {
let ty = syn::parse_str(name).unwrap();
let out = parse_probe_argument(&ty, 0, 0).unwrap();
assert!(out.0.is_some());
assert_eq!(out.1, DataType::Serializable(ty));
assert_eq!(out.1, DataType::Serializable(Box::new(ty)));
if let (Some(chk), DataType::Serializable(ty)) = out {
println!("{}", quote! { #chk });
println!("{}", quote! { #ty });
Expand Down
2 changes: 1 addition & 1 deletion usdt-impl/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn construct_type_check(
.iter()
.map(|typ| match typ {
DataType::Serializable(ty) => {
match ty {
match &**ty {
syn::Type::Reference(reference) => {
if let Some(elem) = shared_slice_elem_type(reference) {
quote! { _: impl AsRef<[#elem]> }
Expand Down
6 changes: 3 additions & 3 deletions usdt-impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub fn compile_provider(
pub enum DataType {
Native(dtrace_parser::DataType),
UniqueId,
Serializable(syn::Type),
Serializable(Box<syn::Type>),
}

impl DataType {
Expand All @@ -165,7 +165,7 @@ impl DataType {
match self {
DataType::Native(ty) => syn::parse_str(&ty.to_rust_type()).unwrap(),
DataType::UniqueId => syn::parse_str("::usdt::UniqueId").unwrap(),
DataType::Serializable(ref inner) => inner.clone(),
DataType::Serializable(ref inner) => *inner.clone(),
}
}
}
Expand All @@ -178,7 +178,7 @@ impl From<dtrace_parser::DataType> for DataType {

impl From<&syn::Type> for DataType {
fn from(t: &syn::Type) -> Self {
DataType::Serializable(t.clone())
DataType::Serializable(Box::new(t.clone()))
}
}

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 = "Cross-platform Userland Statically Defined Tracing probes"
repository = "https://github.com/oxidecomputer/usdt.git"
rust-version = "1.85.0"
rust-version = "1.88.0"

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