diff --git a/tools/runtime-codegen/Cargo.lock b/tools/runtime-codegen/Cargo.lock index bcce1e5589..1dddbb4afb 100644 --- a/tools/runtime-codegen/Cargo.lock +++ b/tools/runtime-codegen/Cargo.lock @@ -1204,7 +1204,7 @@ dependencies = [ "blake2", "file-guard", "fs-err", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quote", "syn 2.0.118", @@ -2634,6 +2634,16 @@ dependencies = [ "syn 2.0.118", ] +[[package]] +name = "prettyplease" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" +dependencies = [ + "proc-macro2", + "syn 3.0.1", +] + [[package]] name = "primitive-types" version = "0.13.1" @@ -2879,10 +2889,11 @@ dependencies = [ "color-eyre", "indoc", "parity-scale-codec", - "prettyplease", + "prettyplease 0.3.0", "proc-macro2", "subxt-codegen", "subxt-utils-fetchmetadata", + "syn 3.0.1", "wasm-loader", "wasm-testbed", ] diff --git a/tools/runtime-codegen/Cargo.toml b/tools/runtime-codegen/Cargo.toml index 3ca509a14d..4a9e4f26c3 100644 --- a/tools/runtime-codegen/Cargo.toml +++ b/tools/runtime-codegen/Cargo.toml @@ -16,9 +16,11 @@ clap = { version = "4.5.3", features = ["derive", "cargo"] } codec = { package = "parity-scale-codec", version = "3.7.4", features = ["derive"] } color-eyre = "0.6.1" indoc = "2.0.5" -prettyplease = "0.2.20" +prettyplease = "0.3.0" proc-macro2 = "1.0.56" subxt-codegen = { version = "0.44.0" } subxt-utils-fetchmetadata = { version = "0.44.0", features = ["url"] } +# Must stay on the same major as `prettyplease`'s `syn`, see `print_runtime`. +syn = { version = "3.0.0", features = ["full", "parsing"] } wasm-loader = { git = "https://github.com/chevdor/subwasm", branch = "master" } wasm-testbed = { git = "https://github.com/chevdor/subwasm", branch = "master" } diff --git a/tools/runtime-codegen/src/main.rs b/tools/runtime-codegen/src/main.rs index 9e09e31857..496848f05f 100644 --- a/tools/runtime-codegen/src/main.rs +++ b/tools/runtime-codegen/src/main.rs @@ -78,7 +78,10 @@ impl TypeSubstitute { } fn print_runtime(runtime_api: proc_macro2::TokenStream) { - let syn_tree = syn::parse_file(&runtime_api.to_string()).unwrap(); + // `prettyplease` builds on `syn` 3, while `subxt-codegen` still exposes `syn` 2 types. Both + // versions are in the tree, so parse with our own `syn` (`::syn`, the 3.x one) instead of the + // re-export used everywhere else in this file. + let syn_tree = ::syn::parse_file(&runtime_api.to_string()).unwrap(); let pretty_runtime_api = prettyplease::unparse(&syn_tree); indoc::printdoc!(