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

Optionally download source code along with toolchain #37

Closed
WizardUli opened this issue Dec 5, 2015 · 17 comments
Closed

Optionally download source code along with toolchain #37

WizardUli opened this issue Dec 5, 2015 · 17 comments

Comments

@WizardUli
Copy link

Rust sources comes handy when you are using racer or when you are cross-compiling etc...
It would be nice to have a possibility to download/upgrade rust sources along with the toolchain.

@matklad
Copy link
Member

matklad commented Feb 24, 2016

Maybe it's a good idea even to download them by default. libstd should not be that big, and if you are using multirust then you are most likely a developer and need sources for completion anyway.

@steveklabnik
Copy link
Member

if you are using multirust then you are most likely a developer and need sources for completion anyway.

Not all developers use completion.

@matklad
Copy link
Member

matklad commented Mar 9, 2016

Not all developers use completion.

Hm, I think that overwhelming majority uses at least hippie-expand or some alternative in their editor of choice.

Not all developers setup semantic completion, but I think it is because hippie-expand works out of the box, and almost anything else requires some awkward setup to actually be useful. So I think your argument works backwards: if we download sources by default, completion setup becomes easier and more developers use it :)

However I think that this may be not the best option here: see https://internals.rust-lang.org/t/what-do-you-think-about-publishing-libstd-on-crates-io/3227

@steveklabnik
Copy link
Member

Hm, I think that overwhelming majority uses at least hippie-expand

I've never even heard of hippie-expand. 😄 I think it really depends on the circles you run in.

@matklad
Copy link
Member

matklad commented Mar 9, 2016

I've never even heard of hippie-expand.
or some alternative in their editor of choice.

In vim it is Ctrl-N and called keyword completion I think

@matklad
Copy link
Member

matklad commented Apr 22, 2016

@brson I'd like to try to implement this unless libstd and related crates are uploaded to crates.io in the nearest future :)

@toothbrush7777777
Copy link

@matklad Any updates?

@matklad
Copy link
Member

matklad commented May 18, 2016

@toothbrush7777777 no, unfortunately other things have happened :) At the same time the rust-lang/rfcs#1133 RFC looks like a better solution for the problem. The RFC, among other things, should allow cargo to download the source of stdlib.

@Diggsey
Copy link
Contributor

Diggsey commented May 31, 2016

Prerequisite: rust-lang-deprecated/rust-buildbot#102

@aka-demik
Copy link

rust-lang-deprecated/rust-buildbot#102 was merged.

@Diggsey
Copy link
Contributor

Diggsey commented Aug 19, 2016

@aka-demik Yep, the next nightly will be the first to contain source packages. Then we can test #659 against those source packages and hopefully get it merged.

I'm confident we'll be able to install source packages with the next release of rustup.

@Diggsey
Copy link
Contributor

Diggsey commented Aug 20, 2016

So the good news is that the rustup support for adding components (eg. source packages) was merged. The bad news is that it uncovered a problem in the new rust-src package generated upstream (see rust-lang/rust#35840) 😞

@jplatte
Copy link
Contributor

jplatte commented Aug 26, 2016

rustup component add rust-src seems to work now! :)

I'll have to install racer via cargo it seems, as rustup run nightly-x86_64-unknown-linux-gnu racer complete std::io::B errors with a command not found when racer is in /usr/bin. But that shouldn't be a problem. I'll report back when it's installed and I've played around with it a bit!

@jplatte
Copy link
Contributor

jplatte commented Aug 26, 2016

Okay, so installing things works... But I expected a more out-of-the-box experience. Right now on arch linux it's actually harder to set up racer with rust sources installed by rustup than setting it up by installing rust-src from the AUR, because with rustup the sources are now in a much more obscure path – $HOME/.multirust/toolchains/$TOOLCHAIN/lib/rustlib/src/rust/src instead of just /usr/src/rust/src/. I don't know where this would best be fixed, as apparently rustup run isn't for what I thought it was so exporting it from there probably wouldn't make sense. But I think it's important that it is fixed somewhere.

I'll leave this here, in case someone on a different distribution wants to use the sources installed by rustup. It will set RUST_SRC_PATH to where rustup installed them (assuming you installed them for your default toolchain) when put in your shells config file (usually ~/.bashrc; requires re-login to take effect). EDIT: Much simplified version based on info from the racer issue:

export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"

@Diggsey
Copy link
Contributor

Diggsey commented Aug 26, 2016

\o/ finally!

@jplatte I've opened this issue: racer-rust/racer#595 which will make this zero setup.

@Diggsey Diggsey closed this as completed Aug 26, 2016
@ariasuni
Copy link

ariasuni commented Oct 7, 2016

Well, this doesn’t work very well for the Atom integration, which use either default /usr/local/src/rust/src or some static string of text (so I can’t use the --print sysroot trick).

@WilsonGiese
Copy link

@ariasuni I got around this by creating a symlink. Added a little script in my bash profile to keep it updated as well:

if [ "$(readlink -- "/usr/local/src/rust/src")" = "" ]; then
    $(ln -s $RUST_SRC_PATH /usr/local/src/rust)
elif [ "$(readlink -- "/usr/local/src/rust/src")" != "$RUST_SRC_PATH" ]; then
    rm /usr/local/src/rust/src
    $(ln -s $RUST_SRC_PATH /usr/local/src/rust)
fi

Silly, but it works (:

djc added a commit that referenced this issue Jun 18, 2024
# This is the 1st commit message:

Port cli_inst_interactive to CliTestContext

# The commit message #2 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #3 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #4 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #5 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #6 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #7 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #8 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #9 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #10 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #11 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #12 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #13 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #14 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #15 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #16 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #17 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #18 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #19 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #20 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #21 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #22 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #23 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #24 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #25 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #26 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #27 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #28 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #29 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #30 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #31 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #32 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #33 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #34 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #35 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #36 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #37 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #38 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #39 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext

# The commit message #40 will be skipped:

# fixup! Port cli_inst_interactive to CliTestContext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants