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

Consider building rust with Cargo #16091

Closed
alexcrichton opened this issue Jul 29, 2014 · 9 comments
Closed

Consider building rust with Cargo #16091

alexcrichton opened this issue Jul 29, 2014 · 9 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@alexcrichton
Copy link
Member

In #2237 it was resolved to rewrite the build system in Rust, but that never ended up happening. It was later decided that we should build Rust with rustpkg, but that also ended up not happening. As a natural continuation of said issue we should consider building Rust with Cargo.

There are certainly some difficulties in doing this, some of which I can think of are:

  • If cargo isn't built as part of the build process, changing the meaning of CLI flags may be tricky (over time)
  • Is cargo's configuration flexible enough to encode the bootstrapping process?
  • Is going through this change worth the effort?

This is most certainly a low priority issue, I believe building servo with Cargo to be a better milestone than building Rust.

@omasanori
Copy link
Contributor

Indeed it might be P-low but I'm really excited to think of building rustc with cargo. 😄

@alexchandel
Copy link

Extracting rustc from rust-lang/rust into its own repository is a step towards this, and is probably easier to accomplish. It would make building Rust from source slightly more complicated, and it would simplify this repository's Metroid-like dependency graph: Metroid-like dependency graph

@huonw
Copy link
Member

huonw commented Sep 23, 2014

The dependency graph would be equally complicated (likely unchanged), just spread over several repositories. I find it likely that splitting rustc into a separate repository while still doing lots of breaking & generally major changes as we are now would be a recipe for significant pain.

@alexchandel
Copy link

@huonw I was referring to this repository's dependency graph. Naturally the global situation would be unchanged. Disentangling rustc from rust is probably important in the long run, since rustc depends on several extra libraries outside the standard library (e.g. graphviz) that should not necessarily be versioned with the language. One difficulty that comes to mind is ensuring that the latest rustc is compatible with the latest rust, but this is manageable with continuous integration.

And having libstd as a dependency of rustc might make sense from a cargo standpoint, assuming cargo can incorporate the snapshot/bootstrapping process.

@huonw
Copy link
Member

huonw commented Sep 23, 2014

I'm not exactly sure why simplifying the dependency graph of a single repository is valuable, when the overall dependency graph of the officially supported crates is not changing; splitting it across many repositories just makes it harder to reason about, since it's now completely spread out. (My only point is we should not be looking at this from the point-of-view of repositories' dependency graphs; just focus on whatever other benefits it gives.)

One difficulty that comes to mind is ensuring that the latest rustc is compatible with the latest rust, but this is manageable with continuous integration.

It's not immediately obvious that it's easy; we'd certainly need to enhance bors significantly, and people submitting changes may need to submit and keep track of pull requests to upto n different repositories with them all reviewed and ready to merge at once (i.e. bors would have to collect all associated PRs together to land in one go... we'd even need a way to associate them reliably, both for bors and for historical purposes in the commit log).

@Gankra
Copy link
Contributor

Gankra commented Sep 28, 2015

@alexcrichton can you give us an update on the efforts to get this done? Some stuff flared up in the summer, but I dunno what came of it.

@jonas-schievink
Copy link
Contributor

@gankro That was #27003

I don't think all of the limitations in Cargo (whichever these were) were addressed since then. Specifically, the PR depended on rust-lang/cargo#1802.

@alexcrichton
Copy link
Member Author

In addition to the links that @jonas-schievink I'm also working on this on an external branch. My current stance is that I would like to avoid two build systems at all costs, so the only way to land this would be to entirely obsolete the current build system, which is taking some time to do :).

@alexcrichton
Copy link
Member Author

Done!

rustbuild is tracked here -- #31590

lnicola pushed a commit to lnicola/rust that referenced this issue Jan 3, 2024
…ykril

fix: self type replacement in inline-function

Fix rust-lang#16113, fix rust-lang#16091

The problem described in this issue actually involves three bugs.

Firstly, when using `ted` to modify the syntax tree, the offset of nodes on the tree changes, which causes the syntax range information from `hir` to become invalid. Therefore, we need to edit the AST after the last usage for `usages_for_locals`.

The second issue is that when inserting nodes, it's necessary to use `clone_subtree` for duplication because the `ted::replace` operation essentially moves a node.

The third issue is that we should use `ancestors_with_macros` instead of `ancestors` to handle impl definition in macros.

I have fixed the three bugs mentioned above and added unit tests.
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.
Projects
None yet
Development

No branches or pull requests

7 participants