-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
proc-macro derive panicked #44523
Comments
cc @dtolnay -- maybe a serde bug? |
I have no idea how to tell. On 11/17/2016 serde-rs/serde#623 says that "This is #37788 for which a fix has merged into Rust and will be in tomorrow's nightly." I am using stable, but a change from last November should have made it into stable by now. |
pub struct RoutingTableEntry {
index: TableIndex,
uuid: Uuid,
may_send: bool,
inuse: bool,
parent: PortNo,
mask: Mask,
other_indices: [TableIndex; MAX_PORTS.v as usize],
} The array length expression here requires you to enable the You can get this to work as is by enabling the relevant feature in Cargo.toml: syn = { version = "0.11", features = ["full"] } Or without that, you can factor the length expression into a standalone constant: const OTHER_INDICES_LEN: usize = MAX_PORTS.v as usize;
pub struct RoutingTableEntry {
other_indices: [TableIndex; OTHER_INDICES_LEN],
} Or factor out the entire array type: type OtherIndices = [TableIndex; MAX_PORTS.v as usize];
pub struct RoutingTableEntry {
other_indices: OtherIndices,
} |
Thanks for the prompt response. I never would have figured that out. In the spirit of Rust's excellent compiler errors, I wonder if the error message include something like
|
I don't believe this is a rust compiler bug; I don't think we can make that suggestion on our side (since this is a failure on serde's side). Closing. It's possible Serde can make that suggestion in the |
Facing a similar issue as above but I am not using this package. Issue might be caused by some other package but I am finding it difficult to find the error: [dependencies] Error messsage : Same as @alanhkarp |
The following compiles without the Serialize or Deserialize in derive. Note that all variables are Copy. I am running macOS Sierra Version 10.12.16 on a MacBook Pro with a 2.2 Ghz Intel Core i7.
cargo run
Compiling multicell v0.1.0 (file:///Users/alan/Documents/Eclipse/multicell)
error: proc-macro derive panicked
--> src/routing_table_entry.rs:9:41
|
9 | #[derive(Debug, Copy, Clone, Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: message: called
Result::unwrap()
on anErr
value: "failed to parse derive input: "pub struct RoutingTableEntry {\n index: TableIndex,\n uuid: Uuid,\n may_send: bool,\n inuse: bool,\n parent: PortNo,\n mask: Mask,\n other_indices: [TableIndex; MAX_PORTS.v as usize],\n}""error: Could not compile
multicell
.To learn more, run the command again with --verbose.
rustc --version --verbose routing_table_entry.rs
rustc 1.15.1 (021bd29 2017-02-08)
binary: rustc
commit-hash: 021bd29
commit-date: 2017-02-08
host: x86_64-apple-darwin
release: 1.15.1
LLVM version: 3.9
cargo run --verbose
Fresh cfg-if v0.1.1
Fresh itoa v0.3.1
Fresh unicode-xid v0.0.4
Fresh serde v0.9.11
Fresh dtoa v0.4.1
Fresh num-traits v0.1.37
Fresh libc v0.2.21
Fresh rustc-demangle v0.1.4
Fresh crossbeam v0.2.10
Fresh quick-error v1.2.0
Fresh quote v0.3.15
Fresh synom v0.11.3
Fresh serde_json v0.9.9
Fresh rand v0.3.15
Fresh backtrace v0.3.2
Fresh syn v0.11.9
Fresh eval v0.4.0
Fresh uuid v0.4.0
Fresh error-chain v0.10.0
Fresh serde_codegen_internals v0.14.1
Fresh serde_derive v0.9.11
Compiling multicell v0.1.0 (file:///Users/alan/Documents/Eclipse/multicell)
Running
rustc --crate-name multicell src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=c3754c3b59b444a8 -C extra-filename=-c3754c3b59b444a8 --out-dir /Users/alan/Documents/Eclipse/multicell/target/debug/deps -L dependency=/Users/alan/Documents/Eclipse/multicell/target/debug/deps --extern serde_json=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde_json-3d75a8ee8aa27a6a.rlib --extern eval=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libeval-19007993aba8ae97.rlib --extern error_chain=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/liberror_chain-dc31d088e7e1eb1e.rlib --extern crossbeam=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libcrossbeam-49604b5af8766723.rlib --extern serde_derive=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde_derive-c205a175c33019f9.dylib --extern rand=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/librand-e7e80d6f8d47bbec.rlib --extern uuid=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libuuid-461871f5c8ab3856.rlib --extern serde=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde-0dc9e96503d8d5e9.rlib --extern multicell=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libmulticell-cd67f32b1d3caf8c.rlib
error: proc-macro derive panicked
--> src/routing_table_entry.rs:9:41
|
9 | #[derive(Debug, Copy, Clone, Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: message: called
Result::unwrap()
on anErr
value: "failed to parse derive input: "pub struct RoutingTableEntry {\n index: TableIndex,\n uuid: Uuid,\n may_send: bool,\n inuse: bool,\n parent: PortNo,\n mask: Mask,\n other_indices: [TableIndex; MAX_PORTS.v as usize],\n}""error: Could not compile
multicell
.Caused by:
process didn't exit successfully:
rustc --crate-name multicell src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=c3754c3b59b444a8 -C extra-filename=-c3754c3b59b444a8 --out-dir /Users/alan/Documents/Eclipse/multicell/target/debug/deps -L dependency=/Users/alan/Documents/Eclipse/multicell/target/debug/deps --extern serde_json=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde_json-3d75a8ee8aa27a6a.rlib --extern eval=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libeval-19007993aba8ae97.rlib --extern error_chain=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/liberror_chain-dc31d088e7e1eb1e.rlib --extern crossbeam=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libcrossbeam-49604b5af8766723.rlib --extern serde_derive=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde_derive-c205a175c33019f9.dylib --extern rand=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/librand-e7e80d6f8d47bbec.rlib --extern uuid=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libuuid-461871f5c8ab3856.rlib --extern serde=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libserde-0dc9e96503d8d5e9.rlib --extern multicell=/Users/alan/Documents/Eclipse/multicell/target/debug/deps/libmulticell-cd67f32b1d3caf8c.rlib
(exit code: 101)The text was updated successfully, but these errors were encountered: