Skip to content

Commit

Permalink
Upgrade to Trustfall v0.8 and trustfall_rustdoc v0.17. (#992)
Browse files Browse the repository at this point in the history
* Upgrade to Trustfall v0.8 and trustfall_rustdoc v0.17.

* Update queries to account for full type printing.

Instead of `std::marker::PhantomData` we now print
`std::marker::PhantomData<&'static str>` for example.
  • Loading branch information
obi1kenobi authored Nov 9, 2024
1 parent 07b9638 commit 0a8123d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 91 deletions.
113 changes: 30 additions & 83 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ exclude = [".github/", "brand/", "scripts/", "test_crates/", "test_outputs/", "t
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
trustfall = "0.7.1"
trustfall_rustdoc = { version = "0.16.4", default-features = false, features = ["v30", "v32", "v33", "v34", "v35", "v36", "rayon", "rustc-hash"] }
trustfall = "0.8.0"
trustfall_rustdoc = { version = "0.17.0", default-features = false, features = ["v30", "v32", "v33", "v34", "v35", "v36", "rayon", "rustc-hash"] }
clap = { version = "4.5.17", features = ["derive", "cargo"] }
serde_json = "1.0.128"
anyhow = "1.0.89"
Expand Down
6 changes: 3 additions & 3 deletions src/lints/enum_repr_transparent_removed.ron
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repr(transparent) was removed from an enum. This can cause its memory layout to
breaking FFI use cases.
Unlike with structs, repr(transparent) is always part of the ABI for enums since
all variants inherit the visibility of their parent type. Note that
all variants inherit the visibility of their parent type. Note that
> [repr(transparent)] can only be used on single-variant enum with a single non-zero-sized field
> (there may be additional zero-sized fields). [...]
https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
Expand Down Expand Up @@ -53,7 +53,7 @@ To avoid false-positives, this query is restricted to checking only enums that i
field @fold @transform(op: "count") @filter(op: "=", value: ["$one"]) {
raw_type @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
... on ResolvedPathType {
name @filter(op: "one_of", value: ["$phantom_data"])
name @filter(op: "regex", value: ["$phantom_data"])
}
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@ To avoid false-positives, this query is restricted to checking only enums that i
"public": "public",
"repr": "repr",
"transparent": "transparent",
"phantom_data": ["core::marker::PhantomData", "std::marker::PhantomData"],
"phantom_data": "(?:core|std)::marker::PhantomData<",
"true": true,
"one": 1,
"zero": 0,
Expand Down
6 changes: 3 additions & 3 deletions src/lints/struct_repr_transparent_removed.ron
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To avoid false-positives, this query is restricted to checking only structs that
field @fold @transform(op: "count") @filter(op: "=", value: ["$one"]) {
raw_type @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
... on ResolvedPathType {
name @filter(op: "one_of", value: ["$phantom_data"])
name @filter(op: "regex", value: ["$phantom_data"])
}
}
}
Expand All @@ -74,7 +74,7 @@ To avoid false-positives, this query is restricted to checking only structs that
raw_type @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
... on ResolvedPathType {
name @filter(op: "one_of", value: ["$phantom_data"])
name @filter(op: "regex", value: ["$phantom_data"])
}
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ To avoid false-positives, this query is restricted to checking only structs that
"public": "public",
"repr": "repr",
"transparent": "transparent",
"phantom_data": ["core::marker::PhantomData", "std::marker::PhantomData"],
"phantom_data": "(?:core|std)::marker::PhantomData<",
"true": true,
"one": 1,
"zero": 0,
Expand Down

0 comments on commit 0a8123d

Please sign in to comment.