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
6 changes: 4 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2719,8 +2719,10 @@ impl<'test> TestCx<'test> {
(&tmp.0, &tmp.1)
}
} else if compare_output_by_lines {
let mut actual_lines: Vec<&str> = actual.lines().collect();
let mut expected_lines: Vec<&str> = expected.lines().collect();
// Filter out padded empty code lines
Comment thread
zetanumbers marked this conversation as resolved.
let mut actual_lines: Vec<&str> = actual.lines().filter(|l| l.trim() != "|").collect();
let mut expected_lines: Vec<&str> =
expected.lines().filter(|l| l.trim() != "|").collect();
actual_lines.sort_unstable();
expected_lines.sort_unstable();
if actual_lines == expected_lines {
Expand Down
5 changes: 3 additions & 2 deletions src/tools/compiletest/src/runtest/compute_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ pub(crate) fn diff_by_lines(expected: &str, actual: &str) -> String {
let mut expected_counts: HashMap<&str, usize> = HashMap::new();
let mut actual_counts: HashMap<&str, usize> = HashMap::new();

for line in expected.lines() {
// Filter out padded empty code lines
for line in expected.lines().filter(|l| l.trim() != "|") {
*expected_counts.entry(line).or_insert(0) += 1;
}
for line in actual.lines() {
for line in actual.lines().filter(|l| l.trim() != "|") {
*actual_counts.entry(line).or_insert(0) += 1;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ edition:2021
//@ check-pass
//@ ignore-parallel-frontend unstable liveness diagnostics
Comment thread
zetanumbers marked this conversation as resolved.

#![allow(unreachable_code)]
#![warn(unused)]
#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/non-snake-case/lint-uppercase-variables.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![warn(unused)]
#![allow(dead_code)]
#![deny(non_snake_case)]
//@ ignore-parallel-frontend `note`s on different source lines

mod foo {
pub enum Foo { Foo }
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/unused/unused-assign-148960.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ check-fail
//@ ignore-parallel-frontend unstable liveness diagnostics

#![deny(unused)]
#![allow(dead_code)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/liveness/liveness-consts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ check-pass
//@ ignore-parallel-frontend unstable liveness diagnostics

#![warn(unused)]
#![allow(unreachable_code)]

Expand Down
1 change: 0 additions & 1 deletion tests/ui/liveness/liveness-dead.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-parallel-frontend unstable liveness diagnostics
#![allow(dead_code)]
#![deny(unused_assignments)]

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/liveness/liveness-dead.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error: value assigned to `x` is never read
--> $DIR/liveness-dead.rs:10:24
--> $DIR/liveness-dead.rs:9:24
|
LL | let mut x: isize = 3;
| ^ this value is reassigned later and never used
LL | x = 4;
| ----- `x` is overwritten here before the previous value is read
|
note: the lint level is defined here
--> $DIR/liveness-dead.rs:3:9
--> $DIR/liveness-dead.rs:2:9
|
LL | #![deny(unused_assignments)]
| ^^^^^^^^^^^^^^^^^^

error: value assigned to `x` is never read
--> $DIR/liveness-dead.rs:18:5
--> $DIR/liveness-dead.rs:17:5
|
LL | x = 4;
| ^^^^^
|
= help: maybe it is overwritten before being read?

error: value passed to `x` is never read
--> $DIR/liveness-dead.rs:21:7
--> $DIR/liveness-dead.rs:20:7
|
LL | fn f4(mut x: i32) {
| ^^^^^
|
= help: maybe it is overwritten before being read?

error: value assigned to `x` is never read
--> $DIR/liveness-dead.rs:28:5
--> $DIR/liveness-dead.rs:27:5
|
LL | x = 4;
| ^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/liveness/liveness-unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(unused_assignments)]
#![allow(dead_code, non_camel_case_types, trivial_numeric_casts, dropping_copy_types)]
#![feature(intrinsics)]
//@ ignore-parallel-frontend `note`s on different source lines

use std::ops::AddAssign;

fn f1(x: isize) {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/liveness/liveness-upvars.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ edition:2018
//@ check-pass
//@ ignore-parallel-frontend unstable liveness diagnostics

#![feature(coroutines, stmt_expr_attributes)]
#![warn(unused)]
#![allow(unreachable_code)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ run-pass
//@ ignore-parallel-frontend unstable liveness diagnostics

#![allow(dead_code)]
#![warn(unused_assignments)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | _ => {}
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
--> $DIR/empty-types.rs:14:9
--> $DIR/empty-types.rs:8:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/empty-types.never_pats.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | _ => {}
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
--> $DIR/empty-types.rs:14:9
--> $DIR/empty-types.rs:8:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/pattern/usefulness/empty-types.normal.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | _ => {}
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
--> $DIR/empty-types.rs:14:9
--> $DIR/empty-types.rs:8:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/pattern/usefulness/empty-types.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//@ revisions: normal exhaustive_patterns never_pats
//@ edition: 2024
//@ ignore-parallel-frontend pattern matching error message mismatch
//
// This tests correct handling of empty types in exhaustiveness checking.
//
// Most of the subtlety of this file happens in scrutinee places which are not required to hold
// valid data, namely dereferences and union field accesses. In these cases, empty arms can
// generally not be omitted, except with `exhaustive_patterns` which ignores this..

#![feature(never_type)]
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(never_pats, feature(never_patterns))]
#![allow(dead_code, unreachable_code)]
#![deny(unreachable_patterns)]

// This tests correct handling of empty types in exhaustiveness checking.
//
// Most of the subtlety of this file happens in scrutinee places which are not required to hold
// valid data, namely dereferences and union field accesses. In these cases, empty arms can
// generally not be omitted, except with `exhaustive_patterns` which ignores this..

#[derive(Copy, Clone)]
enum Void {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ edition:2018
//@ aux-build:edition-lint-infer-outlives-macro.rs
//@ run-rustfix
//@ ignore-parallel-frontend `note`s on different source lines

#![deny(explicit_outlives_requirements)]
#![allow(dead_code)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ edition:2018
//@ aux-build:edition-lint-infer-outlives-macro.rs
//@ run-rustfix
//@ ignore-parallel-frontend `note`s on different source lines

#![deny(explicit_outlives_requirements)]
#![allow(dead_code)]

Expand Down
Loading