Audit uses of tool_only_span_suggestion

This commit is contained in:
Yuki Okushi 2020-07-02 15:17:39 +09:00
parent ec31b4e3a8
commit 84282fd6f1
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
7 changed files with 43 additions and 13 deletions

View File

@ -277,6 +277,8 @@ impl<'a, 'b> Context<'a, 'b> {
("x", "LowerHex"),
("X", "UpperHex"),
] {
// FIXME: rustfix (`run-rustfix`) fails to apply suggestions.
// > "Cannot replace slice of data that was already replaced"
err.tool_only_span_suggestion(
sp,
&format!("use the `{}` trait", name),

View File

@ -0,0 +1,14 @@
// run-rustfix
// In this regression test for #67146, we check that the
// negative outlives bound `!'a` is rejected by the parser.
// This regression was first introduced in PR #57364.
fn main() {}
pub fn f1<T>() {}
//~^ ERROR negative bounds are not supported
pub fn f2<'a, T: Ord>() {}
//~^ ERROR negative bounds are not supported
pub fn f3<'a, T: Ord>() {}
//~^ ERROR negative bounds are not supported

View File

@ -1,12 +1,14 @@
// run-rustfix
// In this regression test for #67146, we check that the
// negative outlives bound `!'a` is rejected by the parser.
// This regression was first introduced in PR #57364.
fn main() {}
fn f1<T: !'static>() {}
pub fn f1<T: !'static>() {}
//~^ ERROR negative bounds are not supported
fn f2<'a, T: Ord + !'a>() {}
pub fn f2<'a, T: Ord + !'a>() {}
//~^ ERROR negative bounds are not supported
fn f3<'a, T: !'a + Ord>() {}
pub fn f3<'a, T: !'a + Ord>() {}
//~^ ERROR negative bounds are not supported

View File

@ -1,20 +1,20 @@
error: negative bounds are not supported
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:7:8
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12
|
LL | fn f1<T: !'static>() {}
| ^^^^^^^^^^ negative bounds are not supported
LL | pub fn f1<T: !'static>() {}
| ^^^^^^^^^^ negative bounds are not supported
error: negative bounds are not supported
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:18
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22
|
LL | fn f2<'a, T: Ord + !'a>() {}
| ^^^^^ negative bounds are not supported
LL | pub fn f2<'a, T: Ord + !'a>() {}
| ^^^^^ negative bounds are not supported
error: negative bounds are not supported
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:12
--> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16
|
LL | fn f3<'a, T: !'a + Ord>() {}
| ^^^^^ negative bounds are not supported
LL | pub fn f3<'a, T: !'a + Ord>() {}
| ^^^^^ negative bounds are not supported
error: aborting due to 3 previous errors

View File

@ -0,0 +1,9 @@
// run-rustfix
#[allow(unused_imports)]
use std::mem::transmute;
//~^ ERROR the name `transmute` is defined multiple times
fn main() {
}

View File

@ -1,3 +1,6 @@
// run-rustfix
#[allow(unused_imports)]
use std::mem::transmute;
use std::mem::transmute;
//~^ ERROR the name `transmute` is defined multiple times

View File

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