fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.9 KiB61 linesraw
1error[E0308]: mismatched types
2  --> $DIR/coerce-suggestions.rs:7:20
3   |
4LL |     let x: usize = String::new();
5   |                    ^^^^^^^^^^^^^ expected usize, found struct `std::string::String`
6   |
7   = note: expected type `usize`
8              found type `std::string::String`
9
10error[E0308]: mismatched types
11  --> $DIR/coerce-suggestions.rs:9:19
12   |
13LL |     let x: &str = String::new();
14   |                   ^^^^^^^^^^^^^
15   |                   |
16   |                   expected &str, found struct `std::string::String`
17   |                   help: consider borrowing here: `&String::new()`
18   |
19   = note: expected type `&str`
20              found type `std::string::String`
21
22error[E0308]: mismatched types
23  --> $DIR/coerce-suggestions.rs:12:10
24   |
25LL |     test(&y);
26   |          ^^ types differ in mutability
27   |
28   = note: expected type `&mut std::string::String`
29              found type `&std::string::String`
30
31error[E0308]: mismatched types
32  --> $DIR/coerce-suggestions.rs:14:11
33   |
34LL |     test2(&y);
35   |           ^^ types differ in mutability
36   |
37   = note: expected type `&mut i32`
38              found type `&std::string::String`
39
40error[E0308]: mismatched types
41  --> $DIR/coerce-suggestions.rs:17:9
42   |
43LL |     f = box f;
44   |         ^^^^^
45   |         |
46   |         cyclic type of infinite size
47   |         help: try using a conversion method: `(box f).to_string()`
48
49error[E0308]: mismatched types
50  --> $DIR/coerce-suggestions.rs:21:9
51   |
52LL |     s = format!("foo");
53   |         ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String`
54   |
55   = note: expected type `&mut std::string::String`
56              found type `std::string::String`
57   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
58
59error: aborting due to 6 previous errors
60
61For more information about this error, try `rustc --explain E0308`.