Skip to content

uefi-macros: Use a more precise error span #679

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

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion uefi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ fn get_function_arg_name(f: &ItemFn, arg_index: usize, errors: &mut TokenStream2
Some(pat_ident.ident.clone())
} else {
// The argument is unnamed, i.e. `_`.
errors.append_all(err!(arg.span(), "Entry method's arguments must be named"));
errors.append_all(err!(
arg.pat.span(),
"Entry method's arguments must be named"
));
None
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion uefi-macros/tests/ui/entry_unnamed_image_arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error: Entry method's arguments must be named
--> tests/ui/entry_unnamed_image_arg.rs:8:22
|
8 | fn unnamed_image_arg(_: Handle, _st: SystemTable<Boot>) -> Status {
| ^^^^^^^^^
| ^
2 changes: 1 addition & 1 deletion uefi-macros/tests/ui/entry_unnamed_table_arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error: Entry method's arguments must be named
--> tests/ui/entry_unnamed_table_arg.rs:8:38
|
8 | fn unnamed_table_arg(_image: Handle, _: SystemTable<Boot>) -> Status {
| ^^^^^^^^^^^^^^^^^^^^
| ^