fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

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