-
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
Fix error message on invalid field names for a struct variant #20084
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
ffd612e
to
4e1bba0
Compare
None => | ||
format!("structure `{}` has no field named `{}`", | ||
actual, | ||
token::get_ident(field.ident.node)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put a block around this format!
invocation if you're going to stagger it like that?
53e0a53
to
b220925
Compare
b220925
to
c9010bf
Compare
actual, variant_type.name.as_str(), | ||
token::get_ident(field.ident.node)) | ||
} | ||
None => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd have been nice to have a test for this case as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... it's true. I'll add it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the case is already provided by the existing test cases(struct-fields-too-many.rs and issue-4736.rs), so I think it would not be necessary to add another one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's provided, but it's still nice to have it in the same issue-19922.rs
file as a quick proof that this works for the other cases. Sorry, I should have phrased my previous comment better :)
Fixes #19922.