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

Make libsyntax available on crates.io #45859

Closed
nrc opened this issue Nov 8, 2017 · 6 comments
Closed

Make libsyntax available on crates.io #45859

nrc opened this issue Nov 8, 2017 · 6 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-help-wanted Call for participation: Help is requested to fix this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nrc
Copy link
Member

nrc commented Nov 8, 2017

This has previously been attempted (see #41732 for example) with the goal of making libsyntax a stable crate. That turned out to be difficult (although it might be easier now since some work has been done in this area). It would be useful to be able to use libsyntax via crates.io, and if it is nightly-only, I think this should not be too difficult.

Ideally, a bot would publish once per week or even every day.

The motivation here is so that rustfmt can use the crates.io version of libsyntax and then it would not be broken (which in turn breaks the RLS) every time there is a breaking change to libsyntax (which is fairly often, it turns out).

cc @alexcrichton @Mark-Simulacrum

@nrc nrc added A-build E-help-wanted Call for participation: Help is requested to fix this issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Nov 8, 2017
@CodeSandwich
Copy link

If API got compiler agnostic and somewhat stable, could libsyntax be used in procedural macros as Syn alternative? I imagine, that it would make macro's compatibility with user code forever on par with rustc (at least in version chosen as dependency), no more Syn chasing syntax changes?

@nrc
Copy link
Member Author

nrc commented Dec 15, 2017

If API got compiler agnostic and somewhat stable

This is a far more ambitious goal and would take a lot more effort. I'm not entirely sure if it is even possible either - the goals are very different (stable API vs always evolving API and 'just a parser' vs an entire compiler frontend).

@topecongiro
Copy link
Contributor

We have rustc-ap-syntax crate.

@nrc
Copy link
Member Author

nrc commented Jan 12, 2018

This is basically done now, but I think @alexcrichton had some smaller things he thought could be addressed.

@alexcrichton
Copy link
Member

Yes I've set this up to be automatically published via this script which is just running locally on my machine. There's a few issues I think we'll want to change though:

  • First the call to __build_diagnostic_array! needs to work outside the context of the build system. Right now it requires a few env vars to be defined but we should either lift that restriction (make it a noop if they're not defined) or conditionally only compile it in for rustc itself.
  • Next libsyntax links to the std_unicode crate which has functions governed under the rustc_private feature gate. That means libsyntax doesn't actually mention the feature gate because in rustc it's compiled with -Z force-unstable-if-unmarked. What we should do, however, is reserve the feature gate rustc_private exclusively for the compiler and rename the features in std_unicode.

After that the auto-publish script purely only has to edit the Cargo.toml which it'll always have to do anyway. I don't think we'll get away from that difficulty in publishing for quite some time. The next steps would be to compile libsyntax on stable (at least conditionally). That's farther out though and less necessary for immediate steps.

@jkordish jkordish added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jan 25, 2018
@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-build labels Apr 21, 2019
@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Aug 4, 2019
@Mark-Simulacrum
Copy link
Member

I believe both of the issue above have been resolved (unicode_internals is the feature gate, and the environment variable is no longer needed) so I'm going to close this as we can likely eliminate the hacks in the autopublisher at any point pretty much (I've gone ahead and filed alexcrichton/rustc-auto-publish#10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-help-wanted Call for participation: Help is requested to fix this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants