Skip to content

Commit c7eb916

Browse files
committed
deduplicate warnings
1 parent 9273962 commit c7eb916

35 files changed

+235
-227
lines changed

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl Validator<'mir, 'tcx> {
253253
let is_unleashable = O::IS_SUPPORTED_IN_MIRI;
254254

255255
if is_unleashable && self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
256-
self.tcx.sess.span_warn(span, "skipping const checks");
256+
self.tcx.sess.span_warn(self.tcx.def_span(self.def_id), "skipping const checks");
257257
return;
258258
}
259259

src/test/ui/consts/const-eval/const_fn_ptr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ const fn double_const(x: usize) -> usize { x * 2 }
88
const X: fn(usize) -> usize = double;
99
const X_CONST: fn(usize) -> usize = double_const;
1010

11-
const fn bar(x: usize) -> usize {
12-
X(x) //~ WARNING skipping const checks
11+
const fn bar(x: usize) -> usize { //~ WARNING skipping const checks
12+
X(x)
1313
}
1414

15-
const fn bar_const(x: usize) -> usize {
16-
X_CONST(x) //~ WARNING skipping const checks
15+
const fn bar_const(x: usize) -> usize { //~ WARNING skipping const checks
16+
X_CONST(x)
1717
}
1818

19-
const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
20-
x(y) //~ WARNING skipping const checks
19+
const fn foo(x: fn(usize) -> usize, y: usize) -> usize { //~ WARNING skipping const checks
20+
x(y)
2121
}
2222

2323
fn main() {
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
warning: skipping const checks
2-
--> $DIR/const_fn_ptr.rs:12:5
2+
--> $DIR/const_fn_ptr.rs:11:1
33
|
4-
LL | X(x)
5-
| ^^^^
4+
LL | / const fn bar(x: usize) -> usize {
5+
LL | | X(x)
6+
LL | | }
7+
| |_^
68

79
warning: skipping const checks
8-
--> $DIR/const_fn_ptr.rs:16:5
10+
--> $DIR/const_fn_ptr.rs:15:1
911
|
10-
LL | X_CONST(x)
11-
| ^^^^^^^^^^
12+
LL | / const fn bar_const(x: usize) -> usize {
13+
LL | | X_CONST(x)
14+
LL | | }
15+
| |_^
1216

1317
warning: skipping const checks
14-
--> $DIR/const_fn_ptr.rs:20:5
18+
--> $DIR/const_fn_ptr.rs:19:1
1519
|
16-
LL | x(y)
17-
| ^^^^
20+
LL | / const fn foo(x: fn(usize) -> usize, y: usize) -> usize {
21+
LL | | x(y)
22+
LL | | }
23+
| |_^
1824

1925
warning: 3 warnings emitted
2026

src/test/ui/consts/const-eval/const_fn_ptr_fail.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
fn double(x: usize) -> usize { x * 2 }
77
const X: fn(usize) -> usize = double;
88

9-
const fn bar(x: usize) -> usize {
9+
const fn bar(x: usize) -> usize { //~ WARNING skipping const checks
1010
X(x) // FIXME: this should error someday
11-
//~^ WARN: skipping const checks
1211
}
1312

1413
fn main() {}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
warning: skipping const checks
2-
--> $DIR/const_fn_ptr_fail.rs:10:5
2+
--> $DIR/const_fn_ptr_fail.rs:9:1
33
|
4-
LL | X(x) // FIXME: this should error someday
5-
| ^^^^
4+
LL | / const fn bar(x: usize) -> usize {
5+
LL | | X(x) // FIXME: this should error someday
6+
LL | | }
7+
| |_^
68

79
warning: 1 warning emitted
810

src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ fn double(x: usize) -> usize {
99
}
1010
const X: fn(usize) -> usize = double;
1111

12-
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
13-
x(y) //~ WARN skipping const checks
12+
const fn bar(x: fn(usize) -> usize, y: usize) -> usize { //~ WARN skipping const checks
13+
x(y)
1414
}
1515

1616
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday

src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
warning: skipping const checks
2-
--> $DIR/const_fn_ptr_fail2.rs:13:5
2+
--> $DIR/const_fn_ptr_fail2.rs:12:1
33
|
4-
LL | x(y)
5-
| ^^^^
4+
LL | / const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
5+
LL | | x(y)
6+
LL | | }
7+
| |_^
68

79
error[E0080]: evaluation of constant expression failed
810
--> $DIR/const_fn_ptr_fail2.rs:20:5

src/test/ui/consts/const-points-to-static.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: skipping const checks
2-
--> $DIR/const-points-to-static.rs:5:20
2+
--> $DIR/const-points-to-static.rs:5:1
33
|
44
LL | const TEST: &u8 = &MY_STATIC;
5-
| ^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error[E0080]: it is undefined behavior to use this value
88
--> $DIR/const-points-to-static.rs:5:1

src/test/ui/consts/const-prop-read-static-in-const.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: skipping const checks
2-
--> $DIR/const-prop-read-static-in-const.rs:5:18
2+
--> $DIR/const-prop-read-static-in-const.rs:5:1
33
|
44
LL | const TEST: u8 = MY_STATIC;
5-
| ^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: any use of this value will cause an error
88
--> $DIR/const-prop-read-static-in-const.rs:5:18

src/test/ui/consts/miri_unleashed/abi-mismatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
const extern "C" fn c_fn() {}
88

99
const fn call_rust_fn(my_fn: extern "Rust" fn()) {
10+
//~^ WARN skipping const checks
1011
my_fn();
11-
//~^ WARN skipping const checks
12-
//~| ERROR could not evaluate static initializer
12+
//~^ ERROR could not evaluate static initializer
1313
//~| NOTE calling a function with ABI C using caller ABI Rust
1414
//~| NOTE inside `call_rust_fn`
1515
}

0 commit comments

Comments
 (0)