Skip to content

Commit 682d7af

Browse files
--wip-- [skip ci]
1 parent 54bfae9 commit 682d7af

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

crates/divan_compat/macros/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ proc-macro-crate = "3.2.0"
2626
proc-macro2 = "1"
2727
quote = { version = "1", default-features = false }
2828
# Versions prior to *.18 fail to parse empty attribute metadata.
29-
# syn = { version = "^2.0.18", default-features = false, features = ["full", "clone-impls", "parsing", "printing", "proc-macro"] }
30-
syn = { version = "^2.0.18", default-features = true, features = [
31-
"extra-traits",
29+
syn = { version = "^2.0.18", default-features = false, features = [
30+
"full",
31+
"clone-impls",
32+
"parsing",
33+
"printing",
34+
"proc-macro",
3235
] }

crates/divan_compat/macros/src/lib.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,28 @@ pub fn bench_compat(attr: TokenStream, item: TokenStream) -> TokenStream {
3131

3232
for arg in parsed_args.args {
3333
match &arg {
34-
NameValue(MetaNameValue { path, .. }) if path.is_ident("crate") => {
35-
return quote! {
36-
compile_error!("`crate` argument is not supported with codspeed_divan_compat");
34+
NameValue(MetaNameValue { path, .. }) => {
35+
match path.get_ident() {
36+
Some("crate") => {
37+
return quote! {
38+
compile_error!("`crate` argument is not supported with bench_compat");
39+
}
40+
.into();
41+
}
42+
Some("types") => {
43+
return quote! {
44+
compile_error!("`types` argument is not supported with bench_compat");
45+
}
46+
.into();
47+
}
48+
Some("min_time")
49+
| Some("max_time")
50+
| Some("sample_size")
51+
| Some("sample_count")
52+
| Some("skip_ext_time") => {
53+
// These arguments are ignored in instrumented mode
54+
}
3755
}
38-
.into();
39-
}
40-
NameValue(MetaNameValue { path, .. }) if path.is_ident("types") => {
41-
return quote! {
42-
compile_error!("`type` argument is not yet supported with codspeed_divan_compat");
43-
}
44-
.into();
45-
}
46-
NameValue(MetaNameValue { path, .. })
47-
if path.is_ident("min_time")
48-
|| path.is_ident("max_time")
49-
|| path.is_ident("sample_size")
50-
|| path.is_ident("sample_count")
51-
|| path.is_ident("skip_ext_time") =>
52-
{
53-
// These arguments are ignored in instrumented mode
5456
}
5557
_ => filtered_args.push(arg),
5658
}

crates/divan_compat/src/compat/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Used by generated code from the macro `codspeed_divan_compat_macros::bench_compat`
22
#[doc(hidden)]
3-
#[path = "private.rs"]
43
pub mod __private {
54
pub use super::{
65
bench::{BenchArgs, BenchOptions},

0 commit comments

Comments
 (0)