rust-lang / rust-lang/rustup

Support `cargo install --path ...` using `rust-toolchain`

Open
#2,200 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Problem
If a crate contains a rust-toolchain file, the default toolchain is used if cargo install --path ... is run from outside of the crate's directory. I expected it to use the toolchain specified in rust-toolchain.

Steps

  1. rustup default stable
  2. cargo new foo
  3. echo nightly >foo/rust-toolchain
  4. sed -i '1i#![feature(exact_size_is_empty)]' foo/src/main.rs
  5. cargo install --path foo

cd foo && cargo install --path . does work.

Notes

Output of rustup --version: rustup 1.21.1 (7832b2ebe 2019-12-20)
Output of rustup show:

Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\mkraai\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.40.0 (73528e339 2019-12-16)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the listed rustup and cargo install steps, comparing cargo install --path foo with cd foo && cargo install --path .. Trace how the toolchain is selected for an external path; done means the command uses the crate's rust-toolchain and regression coverage preserves the working in-directory case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.