I am looking at
ext/build.rs and I am not sure what it does. I've tried commenting out it's method (
cargo check passed successfully after that. Is this something related to old syntax-based compiler plugins, which we want to remove anyway? Could we get rid of this thing or trim it down? ^^ cc @simulacrum, I think you've recently touched this code
I believe it's the helper code that's used by the built-in derives and macros for expansion...
Probably some of it isn't necessarily currently used though (not sure if I'd delete it; we might want it again)
@matklad hm, actually, that module might be entirely unused now
aha, no, I do get at least one error if I delete it entirely...
and if you commment it out, there's a bunch of usages
deriving/generic/mod.rs for one
I guess, long term, we want to transition built-in macros to token model and remove the thing?
hm, probably? It seems like most of it is basically just helpers -- probably replaceable with e.g.
quote! or something like it from syn
I suspect it's probably mostly removable today
and it can definitely be decoupled from ExtCtxt I think
@matklad Do you ask for just "cleanup" or with some goal in mind?
yeah I'd probably leave it for now -- we can move it into src/libsyntax_ext though as free standing functions, though it's probably just needless churn
(but which probably would be required for long-term goal of syntax librarification: seems like making sure that everything uses token streams as much as possible should make extraction easier, as token streams are much simpler than AST)
I think a good first step to removing it would be to 'inline' portions of it -- particularly where it's pretty useless
e.g. most of the attr methods are just calling
attr::<same name>(<same args>) which is largely unnecessary IMO
@matklad If you don't mind, I could take a look at some clean up to it?
@simulacrum sure, feel free do go ahead! I've just read this by accident: the thing I really want to do is to make sure that macro by example doesn't loose jointness info
(poking into various bits of libsyntax make me feel like those blind philosophers touching an elephant, but with a yak instead of an elephant)
The goal is to eventually migrate built-in macros in
libsytnax_ext to token-based model and use some form of
quote! for building their output (probably generating internal libsyntax
TokenStream, rather than
proc_macro::TokenStream, at least for a start.)
After that we'll be able to remove
syntax/ext/build.rs, which kind of serves the same goal as
quote!, but in AST-based world.