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

#[document_codes] attribute macro #8

Closed
zkat opened this issue Aug 16, 2021 · 2 comments
Closed

#[document_codes] attribute macro #8

zkat opened this issue Aug 16, 2021 · 2 comments

Comments

@zkat
Copy link
Owner

zkat commented Aug 16, 2021

So it turns out that derive macros can't expand anything in-place: they can only generate new code in a completely different area.

We need a #[document_codes] attribute macro that you can slap at the toplevel of anything using the Diagnostic derive, which goes through and adds #[doc(alias = "my::code::here")] to the error struct or enum, in the appropriate places.

This might be tricky because you're injecting stuff in the middle of a tokenstream, but maybe it's easier than it sounds?

@zkat zkat mentioned this issue Aug 16, 2021
12 tasks
@zkat
Copy link
Owner Author

zkat commented Aug 22, 2021

Update: This isn't possible on stable Rust yet (booo).

Tracking issue for stabilization: rust-lang/rust#81119

@zkat
Copy link
Owner Author

zkat commented Aug 23, 2021

You know what? I'm just gonna scrap this idea for the foreseeable future, seeing as we have url(...) (and particulaly url(docsrs) now. Wee

@zkat zkat closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant