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
Grawp opened this Issue Dec 5, 2015 · 17 comments

Comments

Projects
None yet
9 participants
@Grawp
Copy link

Grawp commented Dec 5, 2015

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.

@jwilm jwilm referenced this issue Dec 16, 2015

Merged

[READY] Add support for the Rust programming language #268

13 of 13 tasks complete
@matklad

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

steveklabnik commented Mar 9, 2016

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

Not all developers use completion.

@matklad

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

steveklabnik commented Mar 9, 2016

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

toothbrush7777777 commented May 18, 2016

@matklad Any updates?

@matklad

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

Diggsey commented May 31, 2016

@aka-demik

This comment has been minimized.

Copy link

aka-demik commented Aug 19, 2016

@Diggsey

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

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 Aug 26, 2016

@ariasuni

This comment has been minimized.

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

This comment has been minimized.

Copy link

WilsonGiese commented Oct 28, 2016

@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 (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.