Description
Description
Encode and decode macro in parity-scale-codec-derive 3.7.1 fails to compile following type:
#[repr(u32)]
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode)]
enum DigestItemType {
Other = 0u32,
Consensus = 4u32,
Seal = 5u32,
PreRuntime = 6u32,
RuntimeEnvironmentUpdated = 8u32,
}
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
, found u32
|
help: change the type of the numeric literal from u32
to usize
|
9 | Consensus = 4usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:10:12
|
10 | Seal = 5u32,
| ^^^^ expected usize
, found u32
|
help: change the type of the numeric literal from u32
to usize
|
10 | Seal = 5usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:11:18
|
11 | PreRuntime = 6u32,
| ^^^^ expected usize
, found u32
|
help: change the type of the numeric literal from u32
to usize
|
11 | PreRuntime = 6usize,
| ~~~~~
error[E0308]: mismatched types
--> src/main.rs:12:33
|
12 | RuntimeEnvironmentUpdated = 8u32,
| ^^^^ expected usize
, found u32
|
help: change the type of the numeric literal from u32
to usize
|
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 errors
Working version
parity-scale-codec = { version = "=3.6.12", features = ["derive"] }
parity-scale-codec-derive = "=3.6.12"