Make test run-rustfix
This commit is contained in:
parent
8542dd02a8
commit
725952a738
@ -0,0 +1,8 @@
|
||||
// run-rustfix
|
||||
fn main() {
|
||||
let pi = std::f32::consts::PI; //~ ERROR ambiguous associated type
|
||||
let bytes = "hello world".as_bytes();
|
||||
let string = std::str::from_utf8(bytes).unwrap();
|
||||
//~^ ERROR no function or associated item named `from_utf8` found
|
||||
println!("{pi} {bytes:?} {string}");
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
// run-rustfix
|
||||
fn main() {
|
||||
let pi = f32::consts::PI; //~ ERROR ambiguous associated type
|
||||
let bytes = "hello world".as_bytes();
|
||||
let string = unsafe {
|
||||
str::from_utf8(bytes) //~ ERROR no function or associated item named `from_utf8` found
|
||||
};
|
||||
let string = str::from_utf8(bytes).unwrap();
|
||||
//~^ ERROR no function or associated item named `from_utf8` found
|
||||
println!("{pi} {bytes:?} {string}");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/suggest-std-when-using-type.rs:2:14
|
||||
--> $DIR/suggest-std-when-using-type.rs:3:14
|
||||
|
|
||||
LL | let pi = f32::consts::PI;
|
||||
| ^^^^^^^^^^^
|
||||
@ -10,15 +10,15 @@ LL | let pi = std::f32::consts::PI;
|
||||
| +++++
|
||||
|
||||
error[E0599]: no function or associated item named `from_utf8` found for type `str` in the current scope
|
||||
--> $DIR/suggest-std-when-using-type.rs:5:14
|
||||
--> $DIR/suggest-std-when-using-type.rs:5:23
|
||||
|
|
||||
LL | str::from_utf8(bytes)
|
||||
| ^^^^^^^^^ function or associated item not found in `str`
|
||||
LL | let string = str::from_utf8(bytes).unwrap();
|
||||
| ^^^^^^^^^ function or associated item not found in `str`
|
||||
|
|
||||
help: you are looking for the module in `std`, not the primitive type
|
||||
|
|
||||
LL | std::str::from_utf8(bytes)
|
||||
| +++++
|
||||
LL | let string = std::str::from_utf8(bytes).unwrap();
|
||||
| +++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user