Skip to content

Commit

Permalink
Auto merge of rust-lang#52919 - alexcrichton:update-cargo, r=Mark-Sim…
Browse files Browse the repository at this point in the history
…ulacrum

Update tool submodules, update feature unification strategy

* Bring in some fixes for `cargo fix`
* Update RLS/rustfmt to keep them compiling
* Update all tools to [depend on `rustc-workspace-hack`](rust-lang#52919 (comment))
* Change how we deal with feature unification amongst these builds.
  • Loading branch information
bors committed Aug 3, 2018
2 parents 1e3c45a + 0e034d1 commit 7e8ca9f
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 39 deletions.
183 changes: 149 additions & 34 deletions src/Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ debug-assertions = false
[patch."https://github.com/rust-lang/cargo"]
cargo = { path = "tools/cargo" }

[patch."https://github.com/rust-lang-nursery/rustfmt"]
[patch.crates-io]
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
# that we're shipping as well (to ensure that the rustfmt in RLS and the
# `rustfmt` executable are the same exact version).
rustfmt-nightly = { path = "tools/rustfmt" }

# See comments in `tools/rustc-workspace-hack/README.md` for what's going on
# here
rustc-workspace-hack = { path = 'tools/rustc-workspace-hack' }

[patch."https://github.com/rust-lang-nursery/rust-clippy"]
clippy_lints = { path = "tools/clippy/clippy_lints" }
2 changes: 2 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ impl Step for Rls {
cargo.env("RLS_TEST_WORKSPACE_DIR", test_workspace_path);

builder.add_rustc_lib_path(compiler, &mut cargo);
cargo.arg("--")
.args(builder.config.cmd.test_args());

if try_run(builder, &mut cargo) {
builder.save_toolstate("rls", ToolState::TestPass);
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ impl Step for ToolBuild {
prev.0, &prev_features - &cur_features, prev.1);
}
println!("");
println!("to fix this you will probably want to edit the local \
src/tools/rustc-workspace-hack/Cargo.toml crate, as \
that will update the dependency graph to ensure that \
these crates all share the same feature set");
panic!("tools should not compile multiple copies of the same crate");
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 92 files
+7 −6 Cargo.toml
+12 −7 src/bin/cargo/cli.rs
+15 −0 src/bin/cargo/command_prelude.rs
+37 −13 src/bin/cargo/commands/fix.rs
+3 −4 src/bin/cargo/commands/locate_project.rs
+5 −2 src/bin/cargo/commands/read_manifest.rs
+5 −1 src/bin/cargo/commands/uninstall.rs
+15 −10 src/bin/cargo/main.rs
+1 −1 src/cargo/core/compiler/build_context/mod.rs
+5 −5 src/cargo/core/compiler/compilation.rs
+17 −9 src/cargo/core/compiler/context/mod.rs
+1 −1 src/cargo/core/compiler/context/unit_dependencies.rs
+5 −7 src/cargo/core/compiler/fingerprint.rs
+0 −2 src/cargo/core/compiler/job.rs
+31 −9 src/cargo/core/compiler/job_queue.rs
+19 −7 src/cargo/core/compiler/mod.rs
+57 −12 src/cargo/core/dependency.rs
+22 −12 src/cargo/core/manifest.rs
+2 −0 src/cargo/core/package.rs
+0 −2 src/cargo/core/profiles.rs
+14 −14 src/cargo/core/registry.rs
+1 −1 src/cargo/core/resolver/conflict_cache.rs
+11 −11 src/cargo/core/resolver/context.rs
+20 −31 src/cargo/core/resolver/encode.rs
+13 −15 src/cargo/core/resolver/mod.rs
+2 −2 src/cargo/core/resolver/types.rs
+6 −5 src/cargo/core/summary.rs
+0 −8 src/cargo/core/workspace.rs
+16 −12 src/cargo/lib.rs
+19 −7 src/cargo/ops/cargo_compile.rs
+1 −1 src/cargo/ops/cargo_doc.rs
+3 −3 src/cargo/ops/cargo_generate_lockfile.rs
+3 −2 src/cargo/ops/cargo_install.rs
+1 −5 src/cargo/ops/cargo_new.rs
+4 −6 src/cargo/ops/cargo_output_metadata.rs
+4 −3 src/cargo/ops/cargo_package.rs
+1 −1 src/cargo/ops/cargo_pkgid.rs
+3 −3 src/cargo/ops/cargo_test.rs
+329 −68 src/cargo/ops/fix.rs
+3 −4 src/cargo/ops/lockfile.rs
+8 −5 src/cargo/ops/registry.rs
+19 −10 src/cargo/ops/resolve.rs
+2 −2 src/cargo/sources/git/utils.rs
+5 −4 src/cargo/sources/registry/index.rs
+1 −1 src/cargo/util/config.rs
+109 −21 src/cargo/util/diagnostic_server.rs
+5 −5 src/cargo/util/errors.rs
+3 −2 src/cargo/util/lockserver.rs
+1 −1 src/cargo/util/mod.rs
+1 −1 src/cargo/util/network.rs
+4 −4 src/cargo/util/process_builder.rs
+7 −4 src/cargo/util/toml/mod.rs
+32 −8 src/cargo/util/toml/targets.rs
+17 −1 src/cargo/util/vcs.rs
+1 −0 src/crates-io/lib.rs
+1 −1 src/doc/src/reference/manifest.md
+26 −1 src/doc/src/reference/unstable.md
+37 −19 tests/testsuite/bad_config.rs
+44 −44 tests/testsuite/bench.rs
+150 −50 tests/testsuite/build.rs
+3 −3 tests/testsuite/build_lib.rs
+14 −14 tests/testsuite/build_plan.rs
+42 −42 tests/testsuite/build_script.rs
+19 −1 tests/testsuite/cargo_command.rs
+19 −19 tests/testsuite/check.rs
+1 −1 tests/testsuite/clean.rs
+9 −9 tests/testsuite/config.rs
+26 −26 tests/testsuite/cross_compile.rs
+41 −4 tests/testsuite/doc.rs
+226 −24 tests/testsuite/fix.rs
+8 −8 tests/testsuite/freshness.rs
+8 −8 tests/testsuite/git.rs
+4 −11 tests/testsuite/init.rs
+0 −1 tests/testsuite/main.rs
+245 −40 tests/testsuite/metadata.rs
+48 −12 tests/testsuite/new.rs
+23 −23 tests/testsuite/package.rs
+3 −3 tests/testsuite/path.rs
+9 −9 tests/testsuite/profile_config.rs
+11 −11 tests/testsuite/profile_overrides.rs
+129 −129 tests/testsuite/profile_targets.rs
+15 −15 tests/testsuite/profiles.rs
+3 −1 tests/testsuite/read_manifest.rs
+145 −0 tests/testsuite/rename_deps.rs
+18 −18 tests/testsuite/required_features.rs
+5 −5 tests/testsuite/resolve.rs
+28 −28 tests/testsuite/run.rs
+21 −21 tests/testsuite/rustc.rs
+20 −20 tests/testsuite/rustdoc.rs
+14 −24 tests/testsuite/support/mod.rs
+113 −69 tests/testsuite/test.rs
+3 −3 tests/testsuite/tool_paths.rs
2 changes: 1 addition & 1 deletion src/tools/clippy
2 changes: 1 addition & 1 deletion src/tools/rls
Submodule rls updated from 4c7cc9 to 0e8d1f
44 changes: 44 additions & 0 deletions src/tools/rustc-workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "rustc-workspace-hack"
version = "1.0.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = 'MIT/Apache-2.0'
description = """
Hack for the compiler's own build system
"""

[lib]
path = "lib.rs"

# For documentation about what this is and why in the world these dependencies
# are appearing, see `README.md`.

[build-dependencies]
# Currently Cargo/RLS depend on `failure` which depends on `synstructure` which
# enables this feature. Clippy, however, does not depend on anything that
# enables this feature. Enable it unconditionally.
syn = { version = "0.14", features = ['extra-traits'] }

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
features = [
"profileapi",
"memoryapi",
"minschannel",
"securitybaseapi",
"jobapi2",
"schannel",
"sysinfoapi",
"jobapi",
"synchapi",
"wincrypt",
"winbase",
"minwinbase",
"ntsecapi",
"basetsd",
"ntstatus",
"psapi",
"timezoneapi",
"lmcons",
"wincon",
]
25 changes: 25 additions & 0 deletions src/tools/rustc-workspace-hack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# `rustc-workspace-hack`

This crate is a bit of a hack to make workspaces in rustc work a bit better.
The rationale for this existence is a bit subtle, but the general idea is that
we want commands like `./x.py build src/tools/{rls,clippy,cargo}` to share as
many dependencies as possible.

Each invocation is a different invocation of Cargo, however. Each time Cargo
runs a build it will re-resolve the dependency graph, notably selecting
different features sometimes for each build.

For example, let's say there's a very deep dependency like `num-traits` in each
of these builds. For Cargo the `num-traits`'s `default` feature is turned off.
In RLS, however, the `default` feature is turned. This means that building Cargo
and then the RLS will actually build Cargo twice (as a transitive dependency
changed). This is bad!

The goal of this crate is to solve this problem and ensure that the resolved
dependency graph for all of these tools is the same in the various subsets of
each tool, notably enabling the same features of transitive dependencies.

All tools vendored here depend on the `rustc-workspace-hack` crate on crates.io.
When on crates.io this crate is an empty crate that is just a noop. We override
it, however, in this workspace to this crate here, which means we can control
crates in the dependency graph for each of these tools.
11 changes: 11 additions & 0 deletions src/tools/rustc-workspace-hack/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// intentionally left blank
2 changes: 1 addition & 1 deletion src/tools/rustfmt

0 comments on commit 7e8ca9f

Please sign in to comment.