Skip to content

Commit dc6d847

Browse files
committed
Auto merge of rust-lang#10258 - joshtriplett:unconditional-pipelining, r=alexcrichton
Remove the option to disable pipelining Cargo has had pipelining enabled by default for a long time, without issue. Remove support for `build.pipelining = false`. (Continue parsing the option from the config file, but ignore it.) <!-- Thanks for submitting a pull request 🎉! Here are some tips for you: * If this is your first contribution, read "Cargo Contribution Guide": https://doc.crates.io/contrib/ * Run `cargo fmt --all` to format your code changes. * Small commits and pull requests are always preferable and easy to review. * If your idea is large and needs feedback from the community, read how: https://doc.crates.io/contrib/process/#working-on-large-features * Cargo takes care of compatibility. Read our design principles: https://doc.crates.io/contrib/design.html * When changing help text of cargo commands, follow the steps to generate docs: https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages * If your PR is not finished, set it as "draft" PR or add "WIP" in its title. * It's ok to use the CI resources to test your PR, but please don't abuse them. ### What does this PR try to resolve? Explain the motivation behind this change. A clear overview along with an in-depth explanation are helpful. You can use `Fixes #<issue number>` to associate this PR to an existing issue. ### How should we test and review this PR? Demonstrate how you test this change and guide reviewers through your PR. With a smooth review process, a pull request usually gets reviewed quicker. If you don't know how to write and run your tests, please read the guide: https://doc.crates.io/contrib/tests ### Additional information Other information you want to mention in this PR, such as prior arts, future extensions, an unresolved problem, or a TODO list. -->
2 parents c094313 + 65ddbbd commit dc6d847

File tree

6 files changed

+9
-33
lines changed

6 files changed

+9
-33
lines changed

src/cargo/core/compiler/context/mod.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,8 @@ pub struct Context<'a, 'cfg> {
6060
/// been computed.
6161
files: Option<CompilationFiles<'a, 'cfg>>,
6262

63-
/// A flag indicating whether pipelining is enabled for this compilation
64-
/// session. Pipelining largely only affects the edges of the dependency
65-
/// graph that we generate at the end, and otherwise it's pretty
66-
/// straightforward.
67-
pipelining: bool,
68-
6963
/// A set of units which are compiling rlibs and are expected to produce
70-
/// metadata files in addition to the rlib itself. This is only filled in
71-
/// when `pipelining` above is enabled.
64+
/// metadata files in addition to the rlib itself.
7265
rmeta_required: HashSet<Unit>,
7366

7467
/// When we're in jobserver-per-rustc process mode, this keeps those
@@ -106,8 +99,6 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
10699
}
107100
};
108101

109-
let pipelining = bcx.config.build_config()?.pipelining.unwrap_or(true);
110-
111102
Ok(Self {
112103
bcx,
113104
compilation: Compilation::new(bcx)?,
@@ -122,7 +113,6 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
122113
files: None,
123114
rmeta_required: HashSet::new(),
124115
rustc_clients: HashMap::new(),
125-
pipelining,
126116
lto: HashMap::new(),
127117
metadata_for_doc_units: HashMap::new(),
128118
})
@@ -589,11 +579,9 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
589579
/// Returns whether when `parent` depends on `dep` if it only requires the
590580
/// metadata file from `dep`.
591581
pub fn only_requires_rmeta(&self, parent: &Unit, dep: &Unit) -> bool {
592-
// this is only enabled when pipelining is enabled
593-
self.pipelining
594-
// We're only a candidate for requiring an `rmeta` file if we
595-
// ourselves are building an rlib,
596-
&& !parent.requires_upstream_objects()
582+
// We're only a candidate for requiring an `rmeta` file if we
583+
// ourselves are building an rlib,
584+
!parent.requires_upstream_objects()
597585
&& parent.mode == CompileMode::Build
598586
// Our dependency must also be built as an rlib, otherwise the
599587
// object code must be useful in some fashion

src/cargo/core/compiler/job_queue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'cfg> JobQueue<'cfg> {
413413

414414
// This is somewhat tricky, but we may need to synthesize some
415415
// dependencies for this target if it requires full upstream
416-
// compilations to have completed. If we're in pipelining mode then some
416+
// compilations to have completed. Because of pipelining, some
417417
// dependency edges may be `Metadata` due to the above clause (as
418418
// opposed to everything being `All`). For example consider:
419419
//

src/cargo/util/config/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,7 @@ pub struct CargoNetConfig {
21082108
#[derive(Debug, Deserialize)]
21092109
#[serde(rename_all = "kebab-case")]
21102110
pub struct CargoBuildConfig {
2111+
// deprecated, but preserved for compatibility
21112112
pub pipelining: Option<bool>,
21122113
pub dep_info_basedir: Option<ConfigRelativePath>,
21132114
pub target_dir: Option<ConfigRelativePath>,

src/doc/src/reference/config.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ rustflags = ["…", "…"] # custom flags to pass to all compiler invocat
7373
rustdocflags = ["", ""] # custom flags to pass to rustdoc
7474
incremental = true # whether or not to enable incremental compilation
7575
dep-info-basedir = "" # path for the base directory for targets in depfiles
76-
pipelining = true # rustc pipelining
7776

7877
[doc]
7978
browser = "chromium" # browser to use with `cargo doc --open`,
@@ -441,12 +440,8 @@ The setting itself is a config-relative path. So, for example, a value of
441440
directory.
442441

443442
##### `build.pipelining`
444-
* Type: boolean
445-
* Default: true
446-
* Environment: `CARGO_BUILD_PIPELINING`
447443

448-
Controls whether or not build pipelining is used. This allows Cargo to
449-
schedule overlapping invocations of `rustc` in parallel when possible.
444+
This option is deprecated and unused. Cargo always has pipelining enabled.
450445

451446
#### `[doc]`
452447

src/doc/src/reference/environment-variables.md

-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ supported environment variables are:
8181
* `CARGO_BUILD_RUSTDOCFLAGS` — Extra `rustdoc` flags, see [`build.rustdocflags`].
8282
* `CARGO_BUILD_INCREMENTAL` — Incremental compilation, see [`build.incremental`].
8383
* `CARGO_BUILD_DEP_INFO_BASEDIR` — Dep-info relative directory, see [`build.dep-info-basedir`].
84-
* `CARGO_BUILD_PIPELINING` — Whether or not to use `rustc` pipelining, see [`build.pipelining`].
8584
* `CARGO_CARGO_NEW_VCS` — The default source control system with [`cargo new`], see [`cargo-new.vcs`].
8685
* `CARGO_FUTURE_INCOMPAT_REPORT_FREQUENCY` - How often we should generate a future incompat report notifcation, see [`future-incompat-report.frequency`].
8786
* `CARGO_HTTP_DEBUG` — Enables HTTP debugging, see [`http.debug`].
@@ -141,7 +140,6 @@ supported environment variables are:
141140
[`build.rustdocflags`]: config.md#buildrustdocflags
142141
[`build.incremental`]: config.md#buildincremental
143142
[`build.dep-info-basedir`]: config.md#builddep-info-basedir
144-
[`build.pipelining`]: config.md#buildpipelining
145143
[`doc.browser`]: config.md#docbrowser
146144
[`cargo-new.name`]: config.md#cargo-newname
147145
[`cargo-new.email`]: config.md#cargo-newemail

tests/testsuite/build.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -5274,12 +5274,8 @@ fn tricky_pipelining() {
52745274
.file("bar/src/lib.rs", "")
52755275
.build();
52765276

5277-
foo.cargo("build -p bar")
5278-
.env("CARGO_BUILD_PIPELINING", "true")
5279-
.run();
5280-
foo.cargo("build -p foo")
5281-
.env("CARGO_BUILD_PIPELINING", "true")
5282-
.run();
5277+
foo.cargo("build -p bar").run();
5278+
foo.cargo("build -p foo").run();
52835279
}
52845280

52855281
#[cargo_test]
@@ -5301,7 +5297,6 @@ fn pipelining_works() {
53015297
.build();
53025298

53035299
foo.cargo("build")
5304-
.env("CARGO_BUILD_PIPELINING", "true")
53055300
.with_stdout("")
53065301
.with_stderr(
53075302
"\
@@ -5364,7 +5359,6 @@ fn pipelining_big_graph() {
53645359
.file("b30/src/lib.rs", "")
53655360
.build();
53665361
foo.cargo("build -p foo")
5367-
.env("CARGO_BUILD_PIPELINING", "true")
53685362
.with_status(101)
53695363
.with_stderr_contains("[ERROR] could not compile `a30`[..]")
53705364
.run();

0 commit comments

Comments
 (0)