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

invalid (valid) channel name in rust-toolchain #1745

Closed
misha-krainik opened this issue Apr 9, 2019 · 13 comments · Fixed by #2141
Closed

invalid (valid) channel name in rust-toolchain #1745

misha-krainik opened this issue Apr 9, 2019 · 13 comments · Fixed by #2141
Assignees
Milestone

Comments

@misha-krainik
Copy link

misha-krainik commented Apr 9, 2019

Problem

I'm trying to get the rust version I need through specifying the version in rust-toolchain
Steps

  1. Create rust-toolchain in project directory, which contains nightly-2018-11-27-x86_64-unknown-linux-gnu without any space in the word
  2. run $rustc -V
  3. got error
rustc -V
error: invalid channel name 'nightly-2018-11-27-x86_64-unknown-linux-gnu' in '/path/to/project/rust-toolchain'
info: caused by: target triple in channel name 'nightly-2018-11-27-x86_64-unknown-linux-gnu'
  1. check with cargo
$ cargo +nightly-2018-11-27-x86_64-unknown-linux-gnu -V
cargo 1.32.0-nightly (b3d0b2e54 2018-11-15)

Possible Solution(s)

Notes

Output of rustup --version:
Output of rustup show:

$ rustup --version
rustup 1.17.0 (069c88e 2019-03-05)

$ rustup show
Default host: x86_64-unknown-linux-gnu

installed toolchains

stable-x86_64-unknown-linux-gnu (default)
beta-x86_64-unknown-linux-gnu
nightly-2018-11-27-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

active toolchain

(error: invalid channel name 'nightly-2018-11-27-x86_64-unknown-linux-gnu' in '/path/to/project/rust-toolchain')

@misha-krainik
Copy link
Author

@kinnison

@kinnison
Copy link
Contributor

kinnison commented Apr 9, 2019

Hi @mikhail-krainik,

Thanks for reporting this.

For the edification of others, we had a brief discussion on the rust developers discord in the Cargo channel about all this, becuase Mikhail was trying to force the use of a specific toolchain (including specific architecture) by means of writing a cargo plugin to do this. I asked why he didn't use rust-toolchain and this bug report is the result.

It's not clear yet whether the right answer is to improve the error message to suggest removing the architecture from the toolchain channel name (or some other improvement to the error message) or to deal with it in some silent, or warning-like, way.

@Nemo157 rightly stated that to silently accept the arch iff it's equal to the host arch might be a bit too dangerous since it'd mask an issue for others potentially.

Right now, we're not certain what the right approach will be, so further discussion is required.

@Qquanwei
Copy link

I have the same error
image

@kinnison
Copy link
Contributor

@Qquanwei Thank you for confirming that this problem exists for others. Could you provide any insight into why the rust-toolchain in that directory contains a host architecture as well as the channel name? What is remacs trying to achieve by doing this?

Also, do you have an opinion on the options mentioned in #1745 (comment) and/or any further ideas to improve the UX here?

@Qquanwei
Copy link

This error is not a common error , when I re-install remacs environment it not appear for me.

the only thing that I do is rustup default xxx .

@kinnison
Copy link
Contributor

@Qquanwei Something else must be putting that file down then - I suggest that if it happens again you grep around looking for what created the file. In the meantime, I'm glad the problem has gone away for you for now.

@jethrogb
Copy link
Contributor

jethrogb commented Nov 29, 2019

I'm getting the same errors when using rustup toolchain link. The linked toolchain works fine when using <TOOL> +<TOOLCHAIN> syntax, but not when using the rust-toolchain file.

@kinnison
Copy link
Contributor

Interesting, you're quite right it does behave badly like that. Hmm...

@davehylands
Copy link

davehylands commented Dec 2, 2019

I'm running into this as well. The toolchain I built is hooked into rustup using rustup toolchain link

I can do cargo +$(cat rust-toolchain) run and it works fine. But if I try just plain cargo run it fails with the invalid channel name error.

Setting the toolchain to the default using rustup also allows cargo run to work (if I remove the rust-toolchain file).

@davehylands
Copy link

Using RUST_TOOLCHAIN=my-2019-09-05-llvm8 cargo run also seems to work. Is there a way I can name my toolchain that will allow it to work with the rust-toolchain file which doesn't match one of the standard names?

@davehylands
Copy link

And rustup show also displays the invalid channel name error when rust-toolchain contains my-2019-09-05-llvm8

@kinnison kinnison self-assigned this Dec 3, 2019
@kinnison kinnison added this to the 1.21.0 milestone Dec 3, 2019
@kinnison
Copy link
Contributor

kinnison commented Dec 3, 2019

I agree that these later examples are not good, so I'm going to try and resolve this. Whether I end up with something the OP is happy with or not, I'm not sure I can predict; but I'll see what I can do.

kinnison added a commit to kinnison/rustup that referenced this issue Dec 3, 2019
The `rust-toolchain` override file was limited to valid toolchain
names.  This commit weakens that slightly to permit *any* string so
long as it's a local toolchain name.  If it's not then it has to
be a valid channelish toolchain name instead.

This fixes rust-lang#1745

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
@chostrander
Copy link

A little more context on this issue, I am trying to deploy a Rust Application to Heroku, and am using Rocket for my REST API. This needs nightly, so I am trying to specify to use the nightly version instead of stable and am getting this error. (because I need to specify it in the rust-toolchain file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants