Show a better error on wrong struct size#62
Open
hecatia-elegua wants to merge 1 commit into
Open
Conversation
Collaborator
|
nice. I love that the location of the error ends up being the |
9528b98 to
547e55a
Compare
pickx
approved these changes
Jul 23, 2023
Owner
Author
Collaborator
seeing the same thing here. I guess the location does not end up being the attribute.strange that when consts are used in this position, they generate "erroneous constant" info instead of an error. |
Owner
Author
|
trying to get professional help now: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.22note.3A.20erroneous.20constant.20used.22/near/430142304 |
riking
reviewed
Apr 1, 2024
| /// This is used in `bitsize.rs` gen, for showing a compile error. | ||
| /// Only needed because const contexts can't use `format!` and `COMPUTED_SIZE` is not a plain number. | ||
| /// `evaluation of `bilge::AssertEquals::<19, 18>::EQUAL` failed` will tell you what's wrong. | ||
| pub struct AssertEquals<const COMPUTED_SIZE: usize, const DECLARED_SIZE: usize>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Should be tested on a free standing project with both stable and nightly, since in-project I sometimes just saw "evaluation of constant value failed", which is not that helpful.