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

In 2018 edition, warn about cargo installing the current crate #5327

Closed
matklad opened this issue Apr 9, 2018 · 3 comments · Fixed by #5333
Closed

In 2018 edition, warn about cargo installing the current crate #5327

matklad opened this issue Apr 9, 2018 · 3 comments · Fixed by #5333
Labels

Comments

@matklad
Copy link
Member

matklad commented Apr 9, 2018

Running cargo install installs the binaries for the project in current working directory. This might be a surprising behavior for people coming from other ecosystems, especially the node one. The confusion here is that, in Cargo, you don't need to "install" a library to actually use it. At the same time, installing local crates seems like a niche use-case, one typically installs crates from crates.io.

So let's fix confusion by printing a warning, in the next edition, when a user invokes cargo install. The warning should say:

  • If you care coming from other ecosystems, you probably have meant cargo build
  • If you really want to install current package, run cargo install --path .

The code for install command is here:

To check the current edition, one can use this method:

pub fn edition(&self) -> Edition {

The tests for install are here:

https://github.com/rust-lang/cargo/blob/d8b20310217e5e2bc515c13111ab9a7789709e42/tests/testsuite/install.rs

@dwijnand
Copy link
Member

dwijnand commented Apr 9, 2018

I'll take a crack at this.

@dwijnand
Copy link
Member

dwijnand commented Apr 9, 2018

@matklad how should the different behaviour when varying rust editions be tested? I can't find any prior art in https://github.com/rust-lang/cargo/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+2018

@matklad
Copy link
Member Author

matklad commented Apr 9, 2018

@dwijnand here's a example of a test with an edition: bbb2b92#diff-851ff422b9a34b41d197ada1851b7fbbR1469

bors added a commit that referenced this issue Apr 11, 2018
Warn/error when cargo installing the cwd in 2015/2018

Fixes #5327

submitted for early review. feedback very welcome, I'm happy to iterate (and learn).
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Dec 16, 2018
`cargo install` currently fails with:

error: Using `cargo install` to install the binaries for the package
in current working directory is no longer supported, use `cargo
install --path .` instead.

Also see rust-lang/cargo#5327


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@487583 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Dec 16, 2018
`cargo install` currently fails with:

error: Using `cargo install` to install the binaries for the package
in current working directory is no longer supported, use `cargo
install --path .` instead.

Also see rust-lang/cargo#5327
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue Dec 16, 2018
`cargo install` currently fails with:

error: Using `cargo install` to install the binaries for the package
in current working directory is no longer supported, use `cargo
install --path .` instead.

Also see rust-lang/cargo#5327


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@487583 35697150-7ecd-e111-bb59-0022644237b5
swills pushed a commit to swills/freebsd-ports that referenced this issue Dec 16, 2018
`cargo install` currently fails with:

error: Using `cargo install` to install the binaries for the package
in current working directory is no longer supported, use `cargo
install --path .` instead.

Also see rust-lang/cargo#5327


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@487583 35697150-7ecd-e111-bb59-0022644237b5
AnderEnder pushed a commit to AnderEnder/tarpaulin that referenced this issue Dec 18, 2018
warning: Using `cargo install` to install the binaries for the package in current working directory is no longer supported, use `cargo install --path .` instead.

Also see rust-lang/cargo#5327
AnderEnder pushed a commit to AnderEnder/tarpaulin that referenced this issue Dec 19, 2018
warning: Using `cargo install` to install the binaries for the package in current working directory is no longer supported, use `cargo install --path .` instead.

Also see rust-lang/cargo#5327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants