Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/cargo/core/compiler/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ impl<'gctx> DrainState<'gctx> {
build_runner,
id,
&build_runner.bcx.rustc().workspace_wrapper,
warning_handling,
);
self.active.remove(&id).unwrap()
}
Expand Down Expand Up @@ -1053,6 +1054,7 @@ impl<'gctx> DrainState<'gctx> {
runner: &mut BuildRunner<'_, '_>,
id: JobId,
rustc_workspace_wrapper: &Option<PathBuf>,
warning_handling: WarningHandling,
) {
let gctx = runner.bcx.gctx;
let count = match self.warning_count.get(&id) {
Expand Down Expand Up @@ -1131,7 +1133,11 @@ impl<'gctx> DrainState<'gctx> {
}
// Errors are ignored here because it is tricky to handle them
// correctly, and they aren't important.
let _ = gctx.shell().warn(message);
let _ = if warning_handling == WarningHandling::Deny && 0 < count.lints {
gctx.shell().error(message)
} else {
gctx.shell().warn(message)
};
}

fn finish(
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/warning_override.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn rustc_caching_allow_first() {
|
= [NOTE] `#[warn(unused_variables)]` [..]on by default

[WARNING] `foo` (bin "foo") generated 1 warning[..]
[ERROR] `foo` (bin "foo") generated 1 warning[..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[ERROR] warnings are denied by `build.warnings` configuration

Expand All @@ -77,7 +77,7 @@ fn rustc_caching_deny_first() {
|
= [NOTE] `#[warn(unused_variables)]` [..]on by default

[WARNING] `foo` (bin "foo") generated 1 warning[..]
[ERROR] `foo` (bin "foo") generated 1 warning[..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[ERROR] warnings are denied by `build.warnings` configuration

Expand Down Expand Up @@ -114,7 +114,7 @@ fn config() {
|
= [NOTE] `#[warn(unused_variables)]` [..]on by default

[WARNING] `foo` (bin "foo") generated 1 warning[..]
[ERROR] `foo` (bin "foo") generated 1 warning[..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[ERROR] warnings are denied by `build.warnings` configuration

Expand Down Expand Up @@ -194,7 +194,7 @@ fn clippy() {
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[WARNING] unused import: `std::io`
...
[WARNING] `foo` (lib) generated 1 warning (run `cargo clippy --fix --lib -p foo` to apply 1 suggestion)
[ERROR] `foo` (lib) generated 1 warning (run `cargo clippy --fix --lib -p foo` to apply 1 suggestion)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[ERROR] warnings are denied by `build.warnings` configuration

Expand Down