Skip to content
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

salsa::tracked proc-macro on fns/impls should handle invalid inputs #580

Open
nikomatsakis opened this issue Sep 27, 2024 · 1 comment
Open
Labels
good first issue Good for newcomers
Milestone

Comments

@nikomatsakis
Copy link
Member

The #[salsa::tracked] macro, when applied to an impl or function, first attempts to just parse the entire thing with syn. It should handle malformed inputs by just echoing the existing tokens directly back to the user. Right now it doesn't do that and it causes rust-analyzer to not be able to work with incomplete code. I'm not sure if spitting back the tokens would be better but I bet it would.

@nikomatsakis nikomatsakis added the good first issue Good for newcomers label Sep 27, 2024
@nikomatsakis nikomatsakis added this to the Salsa 3.0 milestone Sep 27, 2024
@nikomatsakis
Copy link
Member Author

Mentoring instructions

This is the code that needs to be modified

pub(crate) fn tracked(
args: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let item = syn::parse_macro_input!(input as Item);

that last line which invokes the macro should be altered to manually parse and recover from errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant