binrw
binrw copied to clipboard
Improve error message when arguments aren't passed to a type
If you miss a count
attribute on a Vec right now you get the following:
error[E0277]: the trait bound `VecArgs<()>: Default` is not satisfied
--> src/segment.rs:34:10
|
34 | #[derive(BinRead)]
| ^^^^^^^ the trait `Default` is not implemented for `VecArgs<()>`
|
note: required by `std::default::Default::default`
--> /home/life/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/default.rs:116:5
|
116 | fn default() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `BinRead` (in Nightly builds, run with -Z macro-backtrace for more info)
this is not good enough to lead users to how to fix their error. Needs improvement.
Needs:
- a more specialized message. there's likely some trick to get this error to display the name of a trait or something that gives more information in the form of a NameLikeThisWhichTellsYouWhatsGoingOn
- better span information to point to the field in question