Skip to content

Improve error message when arguments aren't passed to a type #67

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

Closed
jam1garner opened this issue Sep 30, 2021 · 1 comment
Closed

Improve error message when arguments aren't passed to a type #67

jam1garner opened this issue Sep 30, 2021 · 1 comment
Assignees

Comments

@jam1garner
Copy link
Owner

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:

  1. 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
  2. better span information to point to the field in question
csnover added a commit to csnover/binrw that referenced this issue Aug 31, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 31, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 31, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
@csnover csnover self-assigned this Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 4, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 6, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 6, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 11, 2022
csnover added a commit to csnover/binrw that referenced this issue Sep 11, 2022
@csnover
Copy link
Collaborator

csnover commented Sep 21, 2023

I think this is resolved as well as it can be for the moment. There is a UI test for this now and hack traits Required and MissingArgsDirective to give hints about what is wrong.

@csnover csnover closed this as completed Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants