-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Improved spans for generated code and error messages #4015
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededlang
Description
Anchor generates a lot of code in the #[program] macro. When the user code contains errors, the resulting error messages are unhelpful:
--> programs/test-instruction-validation/src/lib.rs:7:1
|
7 | #[program]
| ^^^^^^^^^^ expected `u8` here based on `#[instruction(...)]` attribute, found `u64`As they point to the program macro instead of the relevant code.
This can be improved by replacing uses of quote!{} with quote_spanned!, to ensure the generated code corresponds to the correct code location.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededlang