Skip to content

Commit 51cbe87

Browse files
authored
[meta] update MSRV to 1.75, turn on asm support unconditionally (#267)
There were a lot of build flags working around asm incompatibilities. Now that inline asm has been stable for a while, we can rip it all out. Also update the MSRV to 1.75.
1 parent d4b8090 commit 51cbe87

File tree

51 files changed

+27
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+27
-409
lines changed

Cargo.lock

-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

-56
Original file line numberDiff line numberDiff line change
@@ -225,58 +225,6 @@ comes with significant tradeoffs. As such the current recommendation is:
225225
function calling it), and document to their users that this function should be called to
226226
guarantee that probes are registered.
227227

228-
## Notes
229-
230-
The `usdt` crate requires [inline asm][inline-asm], a feature stabilized in Rust 1.59.
231-
Prior to that version, a nightly toolchain was required to import the feature. For legacy
232-
convenience reasons, the crate contains also an empty, no-op implementation, which generates all the
233-
same probe macros, but with empty bodies (thus not requiring inline asm). This may be selected by
234-
passing the `--no-default-features` flag when building the crate, or by using `default-features =
235-
false` in the [`[dependencies]` table][feature-deps] of one's `Cargo.toml`.
236-
237-
Library developers may use `usdt` as an optional dependency, gated by a feature, for example
238-
named `usdt-probes` or similar. This feature would imply the `usdt/asm` feature, but the `usdt`
239-
crate could be used with the no-op implementation by default. For example, your `Cargo.toml`
240-
might contain
241-
242-
```
243-
[dependencies]
244-
usdt = { version = "*", optional = true, default-features = false }
245-
246-
# ... later
247-
248-
[features]
249-
usdt-probes = ["usdt/asm"]
250-
```
251-
252-
This allows users to opt into probes if they are using a suitably new toolchain, or and older
253-
nightly with the `asm` feature enabled on their project.
254-
255-
### The Rust `asm` feature
256-
257-
On toolchains prior to 1.59, inline asm was [not available][asm-issue] without the feature being
258-
enabled. This applies to code _calling_ the probe macros, in addition to `usdt` where they are
259-
implemented. Those generated probe macros must be in a module that is either built with a >=1.59
260-
toolchain or where the `feature(asm)` configuration is present.
261-
262-
263-
#### Toolchain versions and the `asm_sym` feature
264-
265-
On macOS (where the linker is involved in USDT probe creation) on toolchains prior to 1.66, the
266-
`asm_sym` feature is required (in addition to `asm` in nightly toolchains prior to November 2021;
267-
see [this issue][asm-feature-flags]). For such a toolchain, this feature can be included just on
268-
macOS e.g., with `#![cfg_attr(target_os = "macos", feature(asm_sym))]`, or unconditionally on all
269-
platforms.
270-
271-
The addition of the `asm_sym` feature presents an unfortunate problem. It is no longer possible to
272-
compile the `usdt` crate (or any crate defining probes) with a toolchain from before that feature
273-
was added _and_ after its addition. In the former case, we'd get errors about an unknown feature
274-
should we include the `asm_sym` feature, and we'd get errors about functionality behind a feature
275-
gate from later compilers should we omit the feature.
276-
277-
Fortunately with the stabilization of `asm_sym` in 1.66, using this crate should become much
278-
simpler.
279-
280228
## References
281229

282230
[1]: https://illumos.org/books/dtrace/chp-usdt.html#chp-usdt
@@ -285,7 +233,3 @@ simpler.
285233
[4]: https://docs.rs/serde_json/1.0.68/serde_json/fn.to_string.html
286234
[serde-json-error]: https://docs.serde.rs/serde_json/error/struct.Error.html
287235
[serde-runtime-fail]: https://github.com/serde-rs/serde/issues/1307
288-
[inline-asm]: https://github.com/rust-lang/rust/issues/72016
289-
[feature-deps]: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features
290-
[asm-issue]: https://github.com/rust-lang/rust/issues/72016
291-
[asm-feature-flags]: https://github.com/rust-lang/rust/pull/90348

common-build.rs

-27
This file was deleted.

dusty/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ publish = false
1010
[dependencies]
1111
clap = { version = "4.5.11", features = ["derive"] }
1212
dof = { path = "../dof", features = ["des"] }
13-
usdt = { path = "../usdt", features = ["asm"] }
13+
usdt = { path = "../usdt" }
1414
usdt-impl = { path = "../usdt-impl", features = ["des"] }

probe-test-attr/Cargo.toml

-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,3 @@ publish = false
77
[dependencies]
88
usdt = { path = "../usdt", default-features = false }
99
serde = "1"
10-
11-
[build-dependencies]
12-
version_check = "0.9.5"
13-
14-
[features]
15-
default = ["asm"]
16-
asm = ["usdt/asm"]

probe-test-attr/src/main.rs

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
#![cfg_attr(usdt_need_feat_asm, feature(asm))]
19-
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
20-
2118
use serde::Serialize;
2219

2320
/// By deriving the `serde::Serialize` trait, the `Arg` struct can be used as an argument to a

probe-test-build/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ usdt = { path = "../usdt", default-features = false }
99

1010
[build-dependencies]
1111
usdt = { path = "../usdt" }
12-
version_check = "0.9.5"
13-
14-
[features]
15-
default = ["asm"]
16-
asm = ["usdt/asm"]

probe-test-build/build.rs

-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ use usdt::Builder;
1717
fn main() {
1818
println!("cargo:rerun-if-changed=build.rs");
1919

20-
if !version_check::is_min_version("1.59").unwrap_or(false) {
21-
println!("cargo:rustc-cfg=usdt_need_feat_asm");
22-
}
23-
#[cfg(target_os = "macos")]
24-
if version_check::supports_feature("asm_sym").unwrap_or(false)
25-
&& !version_check::is_min_version("1.67").unwrap_or(false)
26-
{
27-
println!("cargo:rustc-cfg=usdt_need_feat_asm_sym");
28-
}
29-
3020
println!("cargo:rerun-if-changed=test.d");
3121
Builder::new("test.d").build().unwrap();
3222
}

probe-test-build/src/main.rs

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
#![cfg_attr(usdt_need_feat_asm, feature(asm))]
18-
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
19-
2017
use std::thread::sleep;
2118
use std::time::Duration;
2219

probe-test-macro/Cargo.toml

-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,3 @@ publish = false
66

77
[dependencies]
88
usdt = { path = "../usdt", default-features = false }
9-
10-
[build-dependencies]
11-
version_check = "0.9.5"
12-
13-
[features]
14-
default = ["asm"]
15-
asm = ["usdt/asm"]

probe-test-macro/src/main.rs

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
#![cfg_attr(usdt_need_feat_asm, feature(asm))]
18-
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
19-
2017
use std::thread::sleep;
2118
use std::time::Duration;
2219

tests/argument-types/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ publish = false
77
[dependencies]
88
usdt = { path = "../../usdt" }
99
serde = "1"
10-
11-
[build-dependencies]
12-
version_check = "0.9.5"

tests/argument-types/src/main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
#![cfg_attr(usdt_need_feat_asm, feature(asm))]
19-
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
2018
use serde::Serialize;
2119

2220
/// Most struct or tuple types implementing serde::Serialize may be used in probes.

tests/compile-errors/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ serde_json = "*"
1111

1212
[dev-dependencies]
1313
trybuild = "1.0.98"
14-
15-
[build-dependencies]
16-
version_check = "0.9.5"

tests/does-it-work/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ usdt-tests-common = { path = "../../usdt-tests-common" }
1010

1111
[build-dependencies]
1212
usdt = { path = "../../usdt" }
13-
version_check = "0.9.5"

tests/does-it-work/build.rs

-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ use usdt::Builder;
1717
fn main() {
1818
println!("cargo:rerun-if-changed=build.rs");
1919

20-
if !version_check::is_min_version("1.59").unwrap_or(false) {
21-
println!("cargo:rustc-cfg=usdt_need_feat_asm");
22-
}
23-
#[cfg(target_os = "macos")]
24-
if version_check::supports_feature("asm_sym").unwrap_or(false)
25-
&& !version_check::is_min_version("1.67").unwrap_or(false)
26-
{
27-
println!("cargo:rustc-cfg=usdt_need_feat_asm_sym");
28-
}
29-
3020
println!("cargo:rerun-if-changed=test.d");
3121
Builder::new("test.d").build().unwrap();
3222
}

tests/does-it-work/src/main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// See the License for the specific language governing permissions and
1717
// limitations under the License.
1818

19-
#![cfg_attr(usdt_need_feat_asm, feature(asm))]
20-
#![cfg_attr(usdt_need_feat_asm_sym, feature(asm_sym))]
2119
#![allow(non_snake_case)]
2220

2321
use usdt::register_probes;

tests/empty/Cargo.toml

-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,3 @@ default-features = false
1111
[build-dependencies.usdt]
1212
path = "../../usdt"
1313
default-features = false
14-
15-
[build-dependencies]
16-
version_check = "0.9.5"
17-
18-
[features]
19-
default = ["asm"]
20-
asm = ["usdt/asm"]

0 commit comments

Comments
 (0)