Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upNo more syntex #940
Conversation
highfive
assigned
emilio
Aug 31, 2017
highfive
added
the
S-awaiting-review
label
Aug 31, 2017
This comment has been minimized.
This comment has been minimized.
fitzgen
force-pushed the
fitzgen:no-syntex
branch
2 times, most recently
from
d5f4753
to
d130bf6
Sep 1, 2017
emilio
reviewed
Sep 4, 2017
|
So, looks pretty reasonable. If I understand it well, we're running Is that right? If so, I think we should document that. |
| pub fn link_name(name: &str) -> quote::Tokens { | ||
| // This is ridiculous, but rustfmt doesn't seem to be formatting | ||
| // `link_name` attributes very well, so we jump through these formatting | ||
| // hoops to make it work. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fitzgen
Sep 5, 2017
Author
Member
I've filed a handful of bugs upstream, and they've all been fixed now, so this comment might actually be out of date. I'll double check.
| .lit() | ||
| .byte_str(string), | ||
| ) | ||
| let b = quote::ByteStr(&string); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yes, it will be automatically installed by the I'll document it in |
This comment has been minimized.
This comment has been minimized.
|
|
highfive
added
the
S-needs-rebase
label
Sep 5, 2017
This comment has been minimized.
This comment has been minimized.
re-r? @emilio |
This comment has been minimized.
This comment has been minimized.
|
Oops, just saw I need to rebase now. |
fitzgen
force-pushed the
fitzgen:no-syntex
branch
from
43806e3
to
21f8bf8
Sep 5, 2017
This comment has been minimized.
This comment has been minimized.
|
Ok, rebased. |
emilio
reviewed
Sep 6, 2017
|
Looks ok, but I don't feel like updating nightly / rustfmt on behalf of the user is right... :/ |
|
|
||
| ``` | ||
| $ rustup update nightly | ||
| $ rustup run nightly cargo install -f rustfmt-nightly |
This comment has been minimized.
This comment has been minimized.
emilio
Sep 6, 2017
Collaborator
What happens when rustfmt changes the default formatting? All our CI breaks until we update them? That seems not great :(
This comment has been minimized.
This comment has been minimized.
fitzgen
Sep 6, 2017
Author
Member
Nope, because both the generated bindings and the expectations are run through rustfmt before being compared.
| // Because `rustfmt` needs to match its exact nightly version, we update | ||
| // both at the same time. | ||
|
|
||
| let status = process::Command::new("rustup") |
This comment has been minimized.
This comment has been minimized.
emilio
Sep 6, 2017
Collaborator
It definitely feels wrong to update the nightly in behalf of the user.
This comment has been minimized.
This comment has been minimized.
fitzgen
Sep 6, 2017
Author
Member
Unfortunately, this is the only way for the latest rustfmt to work :-/
| assert!(status.success(), "should run `rustup update nightly` OK"); | ||
|
|
||
| let status = process::Command::new("rustup") | ||
| .args(&["run", "nightly", "cargo", "install", "-f", "rustfmt-nightly"]) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
(Of course this is just for contributors, but still) |
This comment has been minimized.
This comment has been minimized.
|
Oh, also @glyn reported when building on top of this branch that he got unexpected test expectation changes, so we should probably get that sorted out. |
This comment has been minimized.
This comment has been minimized.
|
@glyn, do you have the latest |
This comment has been minimized.
This comment has been minimized.
|
|
highfive
added
the
S-needs-rebase
label
Sep 6, 2017
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Aha! You need to use |
fitzgen
added some commits
Aug 23, 2017
fitzgen
added some commits
Sep 1, 2017
fitzgen
force-pushed the
fitzgen:no-syntex
branch
from
21f8bf8
to
46f74c1
Sep 7, 2017
emilio
approved these changes
Sep 7, 2017
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r=emilio |
This comment has been minimized.
This comment has been minimized.
|
|
highfive
added
S-awaiting-merge
and removed
S-awaiting-review
S-needs-rebase
labels
Sep 7, 2017
This comment has been minimized.
This comment has been minimized.
bors-servo
added a commit
that referenced
this pull request
Sep 7, 2017
This comment has been minimized.
This comment has been minimized.
|
|
bors-servo
merged commit 46f74c1
into
rust-lang:master
Sep 7, 2017
highfive
removed
the
S-awaiting-merge
label
Sep 7, 2017
This comment has been minimized.
This comment has been minimized.
|
@fitzgen |
fitzgen commentedAug 31, 2017
There are a few commits in this PR, but the big one is the commit that goes
syntex->quotefor code generation. I've included a copy of its commit message below.I tried to verify that it works with the stylo build still, but there were some issues, and then I checked with master, and that wasn't working either. So now I'm C-Reducing the failures on master and figured that this is at least ready for feedback in the meantime.
r? @emilio
The
syntexcrate is unmaintained. It is slow to build, and additionally it requires that we pre-processsrc/codegen/mod.rsbefore we build thebindgencrate.The
quotecrate provides similar quasi-quoting functionality, is maintained, and builds faster. It doesn't have a typed API or builders, however; it only deals with tokens.Before this commit:
After this commit:
Build time is cut in half! But what about run time?
Before this commit:
After this commit:
So it appears to be about 20ms slower at generating Stylo bindings, but I suspect this is well within the noise.
Finally, this also lets us remove that nasty
mem::transmuteinsidebindgen::ir::BindgenContext::genthat was used for the oldsyntexcontext. NowBindgenContextdoesn't have a lifetime parameter either. This should make it easier to revisit doing our analyses in parallel withrayon, since that context was one of the things that made it hard forBindgenContextto implementSync.Fixes #925