-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Macro stuff #4687
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
base: main
Are you sure you want to change the base?
Macro stuff #4687
Conversation
374297d
to
77b8f63
Compare
@coolreader18 I like this patch so much even without parallel parts. Could you split this PR to 2 chunks one for refactoring and the other one for parallel compilation? |
derive-impl/src/compile_bytecode.rs
Outdated
let path = input.call(syn::Path::parse_mod_style)?; | ||
let eq_token: Token![=] = input.parse()?; | ||
let span = input.span(); | ||
fn parse_litstr(input: ParseStream) -> ParseResult<LitStr> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn parse_litstr(input: ParseStream) -> ParseResult<LitStr> { | |
fn parse_lit_str(input: ParseStream) -> ParseResult<LitStr> { |
derive-impl/src/compile_bytecode.rs
Outdated
} | ||
} | ||
|
||
impl Parse for PyCompileArgs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the motivation to this change?
derive-impl/src/util.rs
Outdated
fn cmp(&self, other: &Self) -> std::cmp::Ordering { | ||
Ord::cmp(&self.name, &other.name).then_with(|| { | ||
cmp_iters(self.cfgs.iter(), other.cfgs.iter(), |a, b| { | ||
crate::util::cmp_tokenstream(a.to_token_stream(), b.to_token_stream()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crate::util::cmp_tokenstream(a.to_token_stream(), b.to_token_stream()) | |
cmp_tokenstream(a.to_token_stream(), b.to_token_stream()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we get string from tokenstream and compare them? this is looking a bit too much.
} else { | ||
return Err(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
return Err(e); |
Ough now I wanna use |
now we use syn2. will this patch be revived? |
This is sorta a work in progress that's ready for review, mainly since I'm still not sure whether parallelizing
py_freeze!
is actually a good idea. My original idea was to just outputpy_compile!
invocations fromfreeze
and let rustc parallelize it for us, but it turns out it doesn't actually run proc macros in parallel, so.