Skip to content

Commit

Permalink
Update 2 syn (#1557)
Browse files Browse the repository at this point in the history
We have not been receiving updates to syn for a while, because we are on
syn 1 still. Update to syn 2 and lift it into the workspace, which
requires revamping how several `proc_macro_attribute`s are parsed. In
the process, sprinkle pgrx-sql-entity-graph with paranoid amounts of
`track_caller`, expects, and compound errors on the unhappy path, to try
to make the code start producing useful error spans.

Then also drop unused features from some of our dependencies to
completely erase syn 1 from the dependency tree. We don't meddle with
any compressible sections, because we just look at exported symbols, not
debuginfo, so I believe this is inconsequential. It's acceptable to
revert that part of this change, however, if it doesn't actually work.

Removes 4 crates from the dependency tree

The syn changes include:
- `syn::LifetimeDef` is now `LifetimeParam`
- `syn::ImplItem::Method` is now `syn::ImplItem::Fn`
- `syn::ImplItemMethod` is now `syn::ImplItemFn`
- Type ascription && `syn::Expr::Type` no longer exist
- `syn::MetaNameValue` replaces its `lit` field with `value`, as it
accepts non-literals
- `syn::GenericArgument::Binding` is now `GenericArgument::AssocType`
- `syn::Attribute` hid its `path` field as `.path()`
- `syn::Attribute` hid its `token` field, so there is only `ToTokens`
- `syn::Attribute` changed how it structures access to its args. We now
parse inner args of a `syn::Attribute` for our proc-macro attributes
like `#[pg_operator]`, without considering parentheses.
  • Loading branch information
workingjubilee authored Feb 14, 2024
1 parent 6c4a3c1 commit c165735
Show file tree
Hide file tree
Showing 24 changed files with 180 additions and 213 deletions.
81 changes: 15 additions & 66 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ cargo_toml = "0.16" # used for building projects
eyre = "0.6.9" # simplifies error-handling
libc = "0.2" # FFI compat
owo-colors = "3.5" # for output highlighting
proc-macro2 = { version = "1.0.78", features = [ "span-locations" ] }
quote = "1.0.33"
regex = "1.1" # used for build/test
syn = { version = "2", features = [ "extra-traits", "full", "parsing" ] }
thiserror = "1"
unescape = "0.1.0" # for escaped-character-handling
url = "2.4.1" # the non-existent std::web
Expand Down
6 changes: 3 additions & 3 deletions cargo-pgrx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ tempfile = "3.8.0"
toml = "0.8.2" # our config files

# SQL schema generation
object = "0.32.1"
proc-macro2 = { version = "1.0.69", features = [ "span-locations" ] }
quote = "1.0.33"
object = { version = "0.32.1", default-features = false, features = [ "std" ] }
proc-macro2.workspace = true
quote.workspace = true

# emit better diagnostics
color-eyre = "0.6.2"
Expand Down
6 changes: 3 additions & 3 deletions pgrx-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ no-schema-generation = ["pgrx-sql-entity-graph/no-schema-generation"]
[dependencies]
pgrx-sql-entity-graph.workspace = true

proc-macro2 = "1.0.69"
quote = "1.0.33"
syn = { version = "1.0.109", features = [ "extra-traits", "full", "fold", "parsing" ] }
proc-macro2.workspace = true
quote.workspace = true
syn.workspace = true


[dev-dependencies]
Expand Down
Loading

0 comments on commit c165735

Please sign in to comment.