-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derive encode/decode compile error[E0308]: mismatched types #686
Comments
Seems caused by this PR: #653 . Investigating why. |
It's because of the consteval check on the literals, thr code expects usize, but got u32 instead. Ie we need to do a check for syn::LitNum for thr suffix and assign type accordingly, otherwise use usize |
I believe I have a solution for this; will open a quick PR to check. I'd suggest yanking this release now (if not done already) and doing a new one with the fix merged. |
Ok, thank you ! Will yank this release. |
I hope this PR will fix it: #687 |
@dlamar228 thank you for the report ! The fix was merged and we published release 3.7.2 . Please let us know if any other issue arises |
Description
Encode and decode macro in parity-scale-codec-derive 3.7.1 fails to compile following type:
Logs
cargo c Compiling proc-macro2 v1.0.93 Compiling unicode-ident v1.0.15 Compiling equivalent v1.0.1 Compiling hashbrown v0.15.2 Compiling rustversion v1.0.19 Compiling winnow v0.6.24 Compiling toml_datetime v0.6.8 Compiling unicode-xid v0.2.6 Compiling serde v1.0.217 Checking byte-slice-cast v1.2.2 Checking arrayvec v0.7.6 Compiling indexmap v2.7.1 Compiling quote v1.0.38 Compiling parity-scale-codec v3.7.1 Compiling syn v2.0.96 Compiling const_format_proc_macros v0.2.34 Checking const_format v0.2.34 Compiling toml_edit v0.22.22 Compiling proc-macro-crate v3.2.0 Compiling impl-trait-for-tuples v0.2.3 Compiling parity-scale-codec-derive v3.7.1 Checking test-sub v0.1.0 (/media/ubuntu/porn30/asd/kuber-atleta/test-sub) error[E0308]: mismatched types --> src/main.rs:8:13 | 8 | Other = 0u32, | ^^^^ expected `usize`, found `u32` | help: change the type of the numeric literal from `u32` to `usize` | 8 | Other = 0usize, | ~~~~~
error[E0308]: mismatched types
--> src/main.rs:9:17
|
9 | Consensus = 4u32,
| ^^^^ expected
usize
, foundu32
|
help: change the type of the numeric literal from
u32
tousize
|
9 | Consensus = 4usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:10:12
|
10 | Seal = 5u32,
| ^^^^ expected
usize
, foundu32
|
help: change the type of the numeric literal from
u32
tousize
|
10 | Seal = 5usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:11:18
|
11 | PreRuntime = 6u32,
| ^^^^ expected
usize
, foundu32
|
help: change the type of the numeric literal from
u32
tousize
|
11 | PreRuntime = 6usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:12:33
|
12 | RuntimeEnvironmentUpdated = 8u32,
| ^^^^ expected
usize
, foundu32
|
help: change the type of the numeric literal from
u32
tousize
|
12 | RuntimeEnvironmentUpdated = 8usize,
| ~~~~~
For more information about this error, try
rustc --explain E0308
.error: could not compile
test-sub
(bin "test-sub") due to 10 previous errorsWorking version
The text was updated successfully, but these errors were encountered: