diff --git a/src/lints/attribute_proc_macro_missing.ron b/src/lints/attribute_proc_macro_missing.ron index d20e807b..af58a149 100644 --- a/src/lints/attribute_proc_macro_missing.ron +++ b/src/lints/attribute_proc_macro_missing.ron @@ -12,7 +12,13 @@ SemverQuery( item { ... on AttributeProcMacro { visibility_limit @filter(op: "=", value: ["$public"]) - name @output @tag + name @output + + importable_path { + path @output @tag + public_api @filter(op: "=", value: ["$true"]) + } + span_: span @optional { filename @output begin_line @output @@ -24,7 +30,10 @@ SemverQuery( item { ... on AttributeProcMacro { visibility_limit @filter(op: "=", value: ["$public"]) - name @filter(op: "=", value: ["%name"]) + + importable_path { + path @filter(op: "=", value: ["%path"]) + } } } } @@ -33,6 +42,7 @@ SemverQuery( arguments: { "public": "public", "zero": 0, + "true": true, }, error_message: "A previously available attribute macro has been removed, breaking code that uses attribute syntax on annotated items.", per_result_error_template: Some("macro #[{{name}}] in {{span_filename}}:{{span_begin_line}}"), diff --git a/src/lints/derive_helper_attr_removed.ron b/src/lints/derive_helper_attr_removed.ron index 94f267e8..a3d91acd 100644 --- a/src/lints/derive_helper_attr_removed.ron +++ b/src/lints/derive_helper_attr_removed.ron @@ -11,9 +11,14 @@ SemverQuery( baseline { item { ... on DeriveProcMacro { - name @output @tag + name @output visibility_limit @filter(op: "=", value: ["$public"]) + importable_path { + path @output @tag + public_api @filter(op: "=", value: ["$true"]) + } + helper_attribute { helper_name: name @output @tag } @@ -28,9 +33,12 @@ SemverQuery( current { item { ... on DeriveProcMacro { - name @filter(op: "=", value: ["%name"]) visibility_limit @filter(op: "=", value: ["$public"]) + importable_path { + path @filter(op: "=", value: ["%path"]) + } + helper_attribute @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) { name @filter(op: "=", value: ["%helper_name"]) } @@ -42,6 +50,7 @@ SemverQuery( arguments: { "public": "public", "zero": 0, + "true": true, }, error_message: "A helper attribute was removed from a derive proc macro, which will prevent downstream code using this attribute with #[derive] invocations from compiling.", per_result_error_template: Some("helper attribute #[{{helper_name}}] removed from derive macro {{name}} in {{span_filename}}:{{span_begin_line}}"), diff --git a/src/lints/derive_proc_macro_missing.ron b/src/lints/derive_proc_macro_missing.ron index b8dcbb53..873a25f7 100644 --- a/src/lints/derive_proc_macro_missing.ron +++ b/src/lints/derive_proc_macro_missing.ron @@ -11,9 +11,14 @@ SemverQuery( baseline { item { ... on DeriveProcMacro { - macro_name: name @output @tag + macro_name: name @output visibility_limit @filter(op: "=", value: ["$public"]) + importable_path { + path @output @tag + public_api @filter(op: "=", value: ["$true"]) + } + span_: span @optional { filename @output begin_line @output @@ -25,7 +30,10 @@ SemverQuery( item { ... on DeriveProcMacro { visibility_limit @filter(op: "=", value: ["$public"]) - name @filter(op: "=", value: ["%macro_name"]) + + importable_path { + path @filter(op: "=", value: ["%path"]) + } } } } @@ -34,6 +42,7 @@ SemverQuery( arguments: { "public": "public", "zero": 0, + "true": true, }, error_message: "A derive macro has been removed. Type definitions using #[derive(...)] with this macro will fail to compile.", per_result_error_template: Some("macro {{macro_name}} in {{span_filename}}:{{span_begin_line}}"), diff --git a/src/lints/function_like_proc_macro_missing.ron b/src/lints/function_like_proc_macro_missing.ron index 19bc61b6..87578d66 100644 --- a/src/lints/function_like_proc_macro_missing.ron +++ b/src/lints/function_like_proc_macro_missing.ron @@ -11,9 +11,14 @@ SemverQuery( baseline { item { ... on FunctionLikeProcMacro { - macro_name: name @output @tag + macro_name: name @output visibility_limit @filter(op: "=", value: ["$public"]) - + + importable_path { + path @output @tag + public_api @filter(op: "=", value: ["$true"]) + } + # Get span info from the baseline for error reporting span_: span @optional { filename @output @@ -22,11 +27,13 @@ SemverQuery( } } } - + current @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) { item { ... on FunctionLikeProcMacro { - name @filter(op: "=", value: ["%macro_name"]) + importable_path { + path @filter(op: "=", value: ["%path"]) + } } } } @@ -35,6 +42,7 @@ SemverQuery( arguments: { "public": "public", "zero": 0, + "true": true, }, error_message: "A function-like procedural macro has been removed. Any code that invokes this macro will fail to compile.", per_result_error_template: Some("macro {{macro_name}} in file {{span_filename}}:{{span_begin_line}}"), diff --git a/test_outputs/query_execution/attribute_proc_macro_missing.snap b/test_outputs/query_execution/attribute_proc_macro_missing.snap index 57ed9eb8..4187a3b8 100644 --- a/test_outputs/query_execution/attribute_proc_macro_missing.snap +++ b/test_outputs/query_execution/attribute_proc_macro_missing.snap @@ -7,6 +7,10 @@ snapshot_kind: text "./test_crates/attribute_proc_macro_missing/": [ { "name": String("logging"), + "path": List([ + String("attribute_proc_macro_missing"), + String("logging"), + ]), "span_begin_line": Uint64(4), "span_filename": String("src/lib.rs"), }, diff --git a/test_outputs/query_execution/derive_helper_attr_removed.snap b/test_outputs/query_execution/derive_helper_attr_removed.snap index 9befdb26..9eb1bce5 100644 --- a/test_outputs/query_execution/derive_helper_attr_removed.snap +++ b/test_outputs/query_execution/derive_helper_attr_removed.snap @@ -8,6 +8,10 @@ snapshot_kind: text { "helper_name": String("helper"), "name": String("MyDerive"), + "path": List([ + String("derive_helper_attr_removed"), + String("MyDerive"), + ]), "span_begin_line": Uint64(5), "span_filename": String("src/lib.rs"), }, diff --git a/test_outputs/query_execution/derive_proc_macro_missing.snap b/test_outputs/query_execution/derive_proc_macro_missing.snap index 388ec32b..96484da2 100644 --- a/test_outputs/query_execution/derive_proc_macro_missing.snap +++ b/test_outputs/query_execution/derive_proc_macro_missing.snap @@ -7,6 +7,10 @@ snapshot_kind: text "./test_crates/derive_proc_macro_missing/": [ { "macro_name": String("MyDerive"), + "path": List([ + String("derive_proc_macro_missing"), + String("MyDerive"), + ]), "span_begin_line": Uint64(4), "span_filename": String("src/lib.rs"), }, diff --git a/test_outputs/query_execution/function_like_proc_macro_missing.snap b/test_outputs/query_execution/function_like_proc_macro_missing.snap index 49b3d242..d321532a 100644 --- a/test_outputs/query_execution/function_like_proc_macro_missing.snap +++ b/test_outputs/query_execution/function_like_proc_macro_missing.snap @@ -7,6 +7,10 @@ snapshot_kind: text "./test_crates/function_like_proc_macro_missing/": [ { "macro_name": String("make_answer"), + "path": List([ + String("function_like_proc_macro_missing"), + String("make_answer"), + ]), "span_begin_line": Uint64(4), "span_filename": String("src/lib.rs"), },