Skip to content

Commit 84282fd

Browse files
committed
Audit uses of tool_only_span_suggestion
1 parent ec31b4e commit 84282fd

7 files changed

+43
-13
lines changed

src/librustc_builtin_macros/format.rs

+2
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ impl<'a, 'b> Context<'a, 'b> {
277277
("x", "LowerHex"),
278278
("X", "UpperHex"),
279279
] {
280+
// FIXME: rustfix (`run-rustfix`) fails to apply suggestions.
281+
// > "Cannot replace slice of data that was already replaced"
280282
err.tool_only_span_suggestion(
281283
sp,
282284
&format!("use the `{}` trait", name),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// run-rustfix
2+
3+
// In this regression test for #67146, we check that the
4+
// negative outlives bound `!'a` is rejected by the parser.
5+
// This regression was first introduced in PR #57364.
6+
7+
fn main() {}
8+
9+
pub fn f1<T>() {}
10+
//~^ ERROR negative bounds are not supported
11+
pub fn f2<'a, T: Ord>() {}
12+
//~^ ERROR negative bounds are not supported
13+
pub fn f3<'a, T: Ord>() {}
14+
//~^ ERROR negative bounds are not supported
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
// run-rustfix
2+
13
// In this regression test for #67146, we check that the
24
// negative outlives bound `!'a` is rejected by the parser.
35
// This regression was first introduced in PR #57364.
46

57
fn main() {}
68

7-
fn f1<T: !'static>() {}
9+
pub fn f1<T: !'static>() {}
810
//~^ ERROR negative bounds are not supported
9-
fn f2<'a, T: Ord + !'a>() {}
11+
pub fn f2<'a, T: Ord + !'a>() {}
1012
//~^ ERROR negative bounds are not supported
11-
fn f3<'a, T: !'a + Ord>() {}
13+
pub fn f3<'a, T: !'a + Ord>() {}
1214
//~^ ERROR negative bounds are not supported
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
error: negative bounds are not supported
2-
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:7:8
2+
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12
33
|
4-
LL | fn f1<T: !'static>() {}
5-
| ^^^^^^^^^^ negative bounds are not supported
4+
LL | pub fn f1<T: !'static>() {}
5+
| ^^^^^^^^^^ negative bounds are not supported
66

77
error: negative bounds are not supported
8-
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:18
8+
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22
99
|
10-
LL | fn f2<'a, T: Ord + !'a>() {}
11-
| ^^^^^ negative bounds are not supported
10+
LL | pub fn f2<'a, T: Ord + !'a>() {}
11+
| ^^^^^ negative bounds are not supported
1212

1313
error: negative bounds are not supported
14-
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:12
14+
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16
1515
|
16-
LL | fn f3<'a, T: !'a + Ord>() {}
17-
| ^^^^^ negative bounds are not supported
16+
LL | pub fn f3<'a, T: !'a + Ord>() {}
17+
| ^^^^^ negative bounds are not supported
1818

1919
error: aborting due to 3 previous errors
2020

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-rustfix
2+
3+
#[allow(unused_imports)]
4+
use std::mem::transmute;
5+
6+
//~^ ERROR the name `transmute` is defined multiple times
7+
8+
fn main() {
9+
}

src/test/ui/resolve/resolve-conflict-import-vs-import.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// run-rustfix
2+
3+
#[allow(unused_imports)]
14
use std::mem::transmute;
25
use std::mem::transmute;
36
//~^ ERROR the name `transmute` is defined multiple times

src/test/ui/resolve/resolve-conflict-import-vs-import.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0252]: the name `transmute` is defined multiple times
2-
--> $DIR/resolve-conflict-import-vs-import.rs:2:5
2+
--> $DIR/resolve-conflict-import-vs-import.rs:5:5
33
|
44
LL | use std::mem::transmute;
55
| ------------------- previous import of the value `transmute` here

0 commit comments

Comments
 (0)