Skip to content

Commit c995e9e

Browse files
committed
Auto merge of #3839 - tee-too:fix-3828, r=matklad
Remove --cap-lints feature detection (fix issue #3828)
2 parents 62eb9dd + e45a250 commit c995e9e

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

src/cargo/ops/cargo_rustc/mod.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,12 @@ fn rustc(cx: &mut Context, unit: &Unit, exec: Arc<Executor>) -> CargoResult<Work
253253
// If this is an upstream dep we don't want warnings from, turn off all
254254
// lints.
255255
if !cx.show_warnings(unit.pkg.package_id()) {
256-
if cx.config.rustc()?.cap_lints {
257-
rustc.arg("--cap-lints").arg("allow");
258-
} else {
259-
rustc.arg("-Awarnings");
260-
}
256+
rustc.arg("--cap-lints").arg("allow");
261257

262258
// If this is an upstream dep but we *do* want warnings, make sure that they
263259
// don't fail compilation.
264260
} else if !unit.pkg.package_id().source_id().is_path() {
265-
if cx.config.rustc()?.cap_lints {
266-
rustc.arg("--cap-lints").arg("warn");
267-
} else {
268-
rustc.arg("-Awarnings"); // not much to do on older compilers
269-
}
261+
rustc.arg("--cap-lints").arg("warn");
270262
}
271263

272264
let filenames = cx.target_filenames(unit)?;

src/cargo/util/rustc.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ pub struct Rustc {
66
pub path: PathBuf,
77
pub verbose_version: String,
88
pub host: String,
9-
/// Backwards compatibility: does this compiler support `--cap-lints` flag?
10-
pub cap_lints: bool,
119
}
1210

1311
impl Rustc {
@@ -19,15 +17,9 @@ impl Rustc {
1917
pub fn new(path: PathBuf) -> CargoResult<Rustc> {
2018
let mut cmd = util::process(&path);
2119
cmd.arg("-vV");
22-
23-
let mut first = cmd.clone();
24-
first.arg("--cap-lints").arg("allow");
25-
26-
let (cap_lints, output) = match first.exec_with_output() {
27-
Ok(output) => (true, output),
28-
Err(..) => (false, cmd.exec_with_output()?),
29-
};
30-
20+
21+
let output = cmd.exec_with_output()?;
22+
3123
let verbose_version = String::from_utf8(output.stdout).map_err(|_| {
3224
internal("rustc -v didn't return utf8 output")
3325
})?;
@@ -46,7 +38,6 @@ impl Rustc {
4638
path: path,
4739
verbose_version: verbose_version,
4840
host: host,
49-
cap_lints: cap_lints,
5041
})
5142
}
5243

tests/git.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::io::prelude::*;
88
use std::path::Path;
99

1010
use cargo::util::process;
11-
use cargotest::{sleep_ms, RUSTC};
11+
use cargotest::sleep_ms;
1212
use cargotest::support::paths::{self, CargoPathExt};
1313
use cargotest::support::{git, project, execs, main_file, path2url};
1414
use hamcrest::{assert_that,existing_file};
@@ -1743,9 +1743,6 @@ fn lints_are_suppressed() {
17431743

17441744
#[test]
17451745
fn denied_lints_are_allowed() {
1746-
let enabled = RUSTC.with(|r| r.cap_lints);
1747-
if !enabled { return }
1748-
17491746
let a = git::new("a", |p| {
17501747
p.file("Cargo.toml", r#"
17511748
[project]

0 commit comments

Comments
 (0)