Skip to content

rust: add rust-src #66315

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

Closed
wants to merge 1 commit into from
Closed

rust: add rust-src #66315

wants to merge 1 commit into from

Conversation

kidonng
Copy link
Contributor

@kidonng kidonng commented Dec 6, 2020

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

This PR adds rust-src to rust formula, which is required by some third-party programs (such as rust-analyzer).

Default installation with rustup comes rust-src (shown with rustup component list --installed):

cargo
clippy
rust-docs
rust-src
rust-std
rustc
rustfmt

While Homebrew's installation is approximately equivalent to:

cargo
rust-docs
rustc

Since rust-src is just 37MB (as of Rust 1.48.0), and go ships with src too (though that's a little different from Rust), I think it's worth adding it to Homebrew's installation as well.

Not sure if there are any environment variables or build flags for installing it with official build scripts, but I guess this won't hurt since it's just moving files around.

@BrewTestBot BrewTestBot added the python Python use is a significant feature of the PR or issue label Dec 6, 2020
@kidonng kidonng changed the title rust: install library rust: add rust-src Dec 6, 2020
@kidonng
Copy link
Contributor Author

kidonng commented Dec 6, 2020

Not sure why the tests hanged, I tested with brew install rust -s on GitHub Actions and it took about 1h40m. The files are installed into the correct place.

@fxcoudert
Copy link
Member

We have some CI trouble at the moment. One question is: why isn't it installed by default by make install? We generally prefer to rely on upstream deciding what to ship, through install targets or build scripts.

@kidonng
Copy link
Contributor Author

kidonng commented Dec 6, 2020

I think my initial comments are a little misleading. make install just installs the rustc (along with its docs), and cargo gets added in as a resource. It's pretty clear why rust-src is not included.

The problem is, unlike other things such as rustfmt, rust-src can't be installed easily if not using Rustup. Thus it is inconvenient if one wants to install rust via Homebrew and some tools doesn't work.

Or let's see how others do this. Arch's rust bundles rust-src, Debian has rust-src as a package and rustc suggests rust-src.

If adding rust-src into rust formula is not favorable, can we add a new rust-src formula instead?

@sorawee sorawee mentioned this pull request Dec 9, 2020
4 tasks
@carlocab
Copy link
Member

carlocab commented Dec 11, 2020

unlike other things such as rustfmt, rust-src can't be installed easily if not using Rustup

This sounds like an excellent reason to me.

why isn't it installed by default by make install

My best guess, having looked at their docs:

  1. Their primary target for building from source appear to be compiler developers [1]. They probably expect compiler developers to have a release build of the complete Rust toolchain separate from their development compiler, so they don't bother including the rest of the toolchain when you build from source.
  2. They seem to have (softly) deprecated using make to build from source. Their preferred method now is to use a Python script called x.py. Perhaps their Makefiles are no longer up-to-date with the Rust toolchain.

We generally prefer to rely on upstream deciding what to ship

I think what upstream decides to ship with their own package (i.e. through rustup) is our most reliable indicator of what upstream ought to be shipped. (Cf. point above re Makefiles)

[1] E.g. the detailed guide to building from source is contained in their "Guide to Rustc Development". Their abridged instructions in the repo README suggest cloning the master branch of the Rust repo. Moreover, as mentioned already, cargo isn't even installed by make install; it needs to be built as a resource.

Apologies for writing a novel. Wasn't my intention.

@BrewTestBot
Copy link
Member

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@BrewTestBot BrewTestBot added the stale No recent activity label Jan 2, 2021
@BrewTestBot BrewTestBot closed this Jan 9, 2021
@carlocab carlocab reopened this Jan 10, 2021
@carlocab
Copy link
Member

carlocab commented Jan 10, 2021

@kidonng, if you're still interested in this PR, please rebase it against master, and give rust a revision bump. If not, just close it again. Thanks.

@carlocab carlocab removed the stale No recent activity label Jan 10, 2021
@BrewTestBot
Copy link
Member

:shipit: @carlocab has triggered a merge.

@kidonng
Copy link
Contributor Author

kidonng commented Jan 12, 2021

Thank you @carlocab!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants