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

Update Cargo #48986

Merged
merged 1 commit into from
Mar 18, 2018
Merged

Update Cargo #48986

merged 1 commit into from
Mar 18, 2018

Conversation

matklad
Copy link
Member

@matklad matklad commented Mar 13, 2018

r? @alexcrichton

Let's put new clap argument parsing in production to see if anything dies in flames :)

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 13, 2018

📌 Commit 759fa2c has been approved by alexcrichton

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 13, 2018
@kennytm
Copy link
Member

kennytm commented Mar 14, 2018

@bors r-

Several tests for cargo are failing due difference between clap and docopt.

[01:27:28] ---- build::wrong_message_format_option stdout ----
[01:27:28] 	running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo build --message-format XML`
[01:27:28] thread 'build::wrong_message_format_option' panicked at '
[01:27:28] Expected: execs
[01:27:28]     but: expected to find:
[01:27:28] error: 'XML' isn't a valid value for '--message-format <FMT>'
[01:27:28] <tab>[possible values: human, json]
[01:27:28] 
[01:27:28] 
[01:27:28] did not find in output:
[01:27:28] error: 'XML' isn't a valid value for '--message-format <FMT>'
[01:27:28] <tab>[values: human, json]
[01:27:28] 
[01:27:28] 
[01:27:28] USAGE:
[01:27:28]     cargo build --message-format <FMT>
[01:27:28] 
[01:27:28] For more information try --help
[01:27:28] ', tools/cargo/tests/testsuite/hamcrest.rs:13:9
[01:27:28] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:27:28] 
[01:27:28] ---- metadata::cargo_metadata_bad_version stdout ----
[01:27:28] 	running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo metadata --no-deps --format-version 2`
[01:27:28] thread 'metadata::cargo_metadata_bad_version' panicked at '
[01:27:28] Expected: execs
[01:27:28]     but: expected to find:
[01:27:28] error: '2' isn't a valid value for '--format-version <VERSION>'
[01:27:28] <tab>[possible values: 1]
[01:27:28] 
[01:27:28] 
[01:27:28] did not find in output:
[01:27:28] error: '2' isn't a valid value for '--format-version <VERSION>'
[01:27:28] <tab>[values: 1]
[01:27:28] 
[01:27:28] 
[01:27:28] USAGE:
[01:27:28]     cargo metadata --format-version <VERSION> --no-deps
[01:27:28] 
[01:27:28] For more information try --help
[01:27:28] ', tools/cargo/tests/testsuite/hamcrest.rs:13:9
[01:27:28] 
[01:27:28] ---- run::dashes_are_forwarded stdout ----
[01:27:28] 	running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo run -- a -- b`
[01:27:28] thread 'run::dashes_are_forwarded' panicked at '
[01:27:28] Expected: execs
[01:27:28]     but: exited with exit code: 101
[01:27:28] --- stdout
[01:27:28] 
[01:27:28] --- stderr
[01:27:28] warning: path `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t897/foo/src/main.rs` was erroneously implicitly accepted for binary `bar`,
[01:27:28] please set bin.path in Cargo.toml
[01:27:28]    Compiling foo v0.0.1 (file:///checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t897/foo)
[01:27:28]     Finished dev [unoptimized + debuginfo] target(s) in 0.77 secs
[01:27:28]      Running `target/debug/bar a b`
[01:27:28] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:27:28]   left: `"b"`,
[01:27:28]  right: `"--"`', src/main.rs:5:17
[01:27:28] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:27:28] ', tools/cargo/tests/testsuite/hamcrest.rs:13:9
[01:27:28] 
[01:27:28] 
[01:27:28] failures:
[01:27:28]     build::wrong_message_format_option
[01:27:28]     metadata::cargo_metadata_bad_version
[01:27:28]     run::dashes_are_forwarded
[01:27:28] 
[01:27:28] test result: FAILED. 1177 passed; 3 failed; 1 ignored; 0 measured; 0 filtered out

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 14, 2018
@matklad
Copy link
Member Author

matklad commented Mar 14, 2018

Several tests for cargo are failing due difference between clap and docopt.

Not exactly, it's because the tests are using error messages from clap version X, and on rust-lang/rust, clap is on version Y. Guess I'll need to loosen tests up a bit!

@matklad
Copy link
Member Author

matklad commented Mar 14, 2018

On the other hand, the easier route is just to update clap here :)

I am not 100% sure that relaxing the tests would be a better solution: it's important to check that the error messages actually look reasonable to protect from, say, potential clap regressions.

Perhaps updating the error messages once in a while won't be such a big chore in practice? Note that we'll hit the need of update in Cargo first, because its CI does not use lockfile, and always uses the latest clap.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 14, 2018

📌 Commit 5be1d82 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 14, 2018
@bors
Copy link
Contributor

bors commented Mar 14, 2018

☔ The latest upstream changes (presumably #49014) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 14, 2018
@matklad
Copy link
Member Author

matklad commented Mar 16, 2018

Resolved conflicts and updated Cargo even more, to include rust-lang/cargo#5188 as well

@matklad
Copy link
Member Author

matklad commented Mar 16, 2018

Found a regression with clap, so don't r+ this just yet :)

@matklad
Copy link
Member Author

matklad commented Mar 16, 2018

Updated with the fix for the regression.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 16, 2018

📌 Commit a4ed1ad has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 16, 2018
@bors
Copy link
Contributor

bors commented Mar 16, 2018

☔ The latest upstream changes (presumably #48097) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 16, 2018
This notably includes

* rust-lang/cargo#5152
* rust-lang/cargo#5188

The first one switches cargo from docopt to clap (
we also update to the latest calp in this repository),
the second one should help us to unify feature flags
for Cargo itself and RLS, and build Cargo libray only
once.
@matklad
Copy link
Member Author

matklad commented Mar 16, 2018

rebased

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 17, 2018

📌 Commit b15b023 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 17, 2018
@bors
Copy link
Contributor

bors commented Mar 18, 2018

⌛ Testing commit b15b023 with merge 8aa27ee...

bors added a commit that referenced this pull request Mar 18, 2018
Update Cargo

r? @alexcrichton

Let's put new clap argument parsing in production to see if anything dies in flames :)
@bors
Copy link
Contributor

bors commented Mar 18, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 8aa27ee to master...

@bors bors merged commit b15b023 into rust-lang:master Mar 18, 2018
@kennytm-githubbot
Copy link

📣 Toolstate changed by #48986!

Tested on commit 8aa27ee.
Direct link to PR: #48986

💔 rls on windows: test-pass → build-fail (cc @nrc).
💔 rls on linux: test-pass → build-fail (cc @nrc).

kennytm-githubbot added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Mar 18, 2018
Tested on commit rust-lang/rust@8aa27ee.
Direct link to PR: <rust-lang/rust#48986>

💔 rls on windows: test-pass → build-fail (cc @nrc).
💔 rls on linux: test-pass → build-fail (cc @nrc).
@kennytm
Copy link
Member

kennytm commented Mar 18, 2018

[01:09:14] error[E0308]: mismatched types
[01:09:14]    --> tools/rls/src/build/cargo.rs:188:44
[01:09:14]     |
[01:09:14] 188 |     let spec = Packages::from_flags(false, &[], &packages)?;
[01:09:14]     |                                            ^^^
[01:09:14]     |                                            |
[01:09:14]     |                                            expected struct `std::vec::Vec`, found &[_; 0]
[01:09:14]     |                                            help: try using a conversion method: `&[].to_vec()`
[01:09:14]     |
[01:09:14]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:14]                found type `&[_; 0]`
[01:09:14]
[01:09:14] error[E0308]: mismatched types
[01:09:14]    --> tools/rls/src/build/cargo.rs:188:49
[01:09:14]     |
[01:09:14] 188 |     let spec = Packages::from_flags(false, &[], &packages)?;
[01:09:14]     |                                                 ^^^^^^^^^
[01:09:14]     |                                                 |
[01:09:14]     |                                                 expected struct `std::vec::Vec`, found reference
[01:09:14]     |                                                 help: consider removing the borrow: `packages`
[01:09:14]     |
[01:09:14]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:14]                found type `&std::vec::Vec<std::string::String>`
[01:09:14]
[01:09:14] error[E0308]: mismatched types
[01:09:14]    --> tools/rls/src/build/cargo.rs:191:17
[01:09:14]     |
[01:09:14] 191 |         target: opts.target.as_ref().map(|t| &t[..]),
[01:09:14]     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found &str
[01:09:14]     |
[01:09:14]     = note: expected type `std::option::Option<std::string::String>`
[01:09:14]                found type `std::option::Option<&str>`
[01:09:14]
[01:09:14] error[E0308]: mismatched types
[01:09:14]    --> tools/rls/src/build/cargo.rs:195:13
[01:09:14]     |
[01:09:14] 195 |             &opts.bin,
[01:09:14]     |             ^^^^^^^^^
[01:09:14]     |             |
[01:09:14]     |             expected struct `std::vec::Vec`, found reference
[01:09:14]     |             help: consider removing the borrow: `opts.bin`
[01:09:14]     |
[01:09:14]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:14]                found type `&std::vec::Vec<std::string::String>`
[01:09:14]
[01:09:15] error[E0308]: mismatched types
[01:09:15]    --> tools/rls/src/build/cargo.rs:198:13
[01:09:15]     |
[01:09:15] 198 |             &[],
[01:09:15]     |             ^^^
[01:09:15]     |             |
[01:09:15]     |             expected struct `std::vec::Vec`, found &[_; 0]
[01:09:15]     |             help: try using a conversion method: `&[].to_vec()`
[01:09:15]     |
[01:09:15]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:15]                found type `&[_; 0]`
[01:09:15]
[01:09:15] error[E0308]: mismatched types
[01:09:15]    --> tools/rls/src/build/cargo.rs:200:13
[01:09:15]     |
[01:09:15] 200 |             &[],
[01:09:15]     |             ^^^
[01:09:15]     |             |
[01:09:15]     |             expected struct `std::vec::Vec`, found &[_; 0]
[01:09:15]     |             help: try using a conversion method: `&[].to_vec()`
[01:09:15]     |
[01:09:15]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:15]                found type `&[_; 0]`
[01:09:15]
[01:09:16] error[E0308]: mismatched types
[01:09:16]    --> tools/rls/src/build/cargo.rs:202:13
[01:09:16]     |
[01:09:16] 202 |             &[],
[01:09:16]     |             ^^^
[01:09:16]     |             |
[01:09:16]     |             expected struct `std::vec::Vec`, found &[_; 0]
[01:09:16]     |             help: try using a conversion method: `&[].to_vec()`
[01:09:16]     |
[01:09:16]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:16]                found type `&[_; 0]`
[01:09:16]
[01:09:16] error[E0308]: mismatched types
[01:09:16]    --> tools/rls/src/build/cargo.rs:206:19
[01:09:16]     |
[01:09:16] 206 |         features: &opts.features,
[01:09:16]     |                   ^^^^^^^^^^^^^^
[01:09:16]     |                   |
[01:09:16]     |                   expected struct `std::vec::Vec`, found reference
[01:09:16]     |                   help: consider removing the borrow: `opts.features`
[01:09:16]     |
[01:09:16]     = note: expected type `std::vec::Vec<std::string::String>`
[01:09:16]                found type `&std::vec::Vec<std::string::String>`
[01:09:16]
[01:09:17] error: aborting due to 8 previous errors
[01:09:17]
[01:09:17] For more information about this error, try `rustc --explain E0308`.
[01:09:17] error: Could not compile `rls`.

@matklad
Copy link
Member Author

matklad commented Mar 18, 2018

The RLS itself is already updated (rust-lang/rls@c0f07b3), so only submodule update in rust-lang/rust is required.

@kennytm
Copy link
Member

kennytm commented Mar 18, 2018

Thanks @matklad! I'll include this into #49134 then.

@kennytm kennytm mentioned this pull request Mar 18, 2018
@messense
Copy link
Contributor

I am not sure if it's related to this, but it seems that third party Cargo commands no longer work by executing cargo whatever-third-party-command? For example I am using cargo-update:

$ cargo install-update -a
error: The subcommand 'install-update' wasn't recognized
	Did you mean 'install'?

If you believe you received this message in error, try re-running with 'cargo -- install-update'

USAGE:
    cargo [OPTIONS] [SUBCOMMAND]

For more information try --help

$ cargo -- install-update -a
error: The subcommand 'install-update' wasn't recognized
	Did you mean 'install'?

If you believe you received this message in error, try re-running with 'cargo -- install-update'

USAGE:
    cargo [OPTIONS] [SUBCOMMAND]

For more information try --help

Stable works fine:

$ cargo +stable install-update -a
    Updating registry `https://github.com/rust-lang/crates.io-index`

Package                          Installed      Latest         Needs update
bindgen                          v0.33.2        v0.33.2        No

No packages need updating.

@matklad
Copy link
Member Author

matklad commented Mar 19, 2018

Thank you so much for the report @messense ! Opened an issue at the Cargo tracker: rust-lang/cargo#5201, and investigating.

Looks like not every external subcommand is broken, only those that are named closely to the built-in ones.

@matklad matklad deleted the update-cargo branch March 19, 2018 06:12
@matklad matklad mentioned this pull request Mar 19, 2018
bors added a commit that referenced this pull request Mar 20, 2018
Update clap

This should fix a regression in Cargo after swithing to clap, when
an external subcommand was not discovered, if its name was close to
a built in command.

bug report: #48986 (comment)
fix: clap-rs/clap#1215
bors added a commit that referenced this pull request Mar 20, 2018
Update clap

This should fix a regression in Cargo after swithing to clap, when
an external subcommand was not discovered, if its name was close to
a built in command.

bug report: #48986 (comment)
fix: clap-rs/clap#1215
kennytm added a commit to kennytm/rust that referenced this pull request Mar 20, 2018
Update clap

This should fix a regression in Cargo after swithing to clap, when
an external subcommand was not discovered, if its name was close to
a built in command.

bug report: rust-lang#48986 (comment)
fix: clap-rs/clap#1215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants