fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB75 linesraw
1error[E0308]: mismatched types
2  --> $DIR/coerce-suggestions.rs:7:20
3   |
4LL |     let x: usize = String::new();
5   |            -----   ^^^^^^^^^^^^^ expected `usize`, found `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   |            ----   ^^^^^^^^^^^^^ expected `&str`, found `String`
14   |            |
15   |            expected due to this
16   |
17help: consider borrowing here
18   |
19LL |     let x: &str = &String::new();
20   |                   +
21
22error[E0308]: mismatched types
23  --> $DIR/coerce-suggestions.rs:12:10
24   |
25LL |     test(&y);
26   |     ---- ^^ types differ in mutability
27   |     |
28   |     arguments to this function are incorrect
29   |
30   = note: expected mutable reference `&mut String`
31                      found reference `&String`
32note: function defined here
33  --> $DIR/coerce-suggestions.rs:1:4
34   |
35LL | fn test(_x: &mut String) {}
36   |    ^^^^ ---------------
37
38error[E0308]: mismatched types
39  --> $DIR/coerce-suggestions.rs:14:11
40   |
41LL |     test2(&y);
42   |     ----- ^^ types differ in mutability
43   |     |
44   |     arguments to this function are incorrect
45   |
46   = note: expected mutable reference `&mut i32`
47                      found reference `&String`
48note: function defined here
49  --> $DIR/coerce-suggestions.rs:3:4
50   |
51LL | fn test2(_x: &mut i32) {}
52   |    ^^^^^ ------------
53
54error[E0308]: mismatched types
55  --> $DIR/coerce-suggestions.rs:17:9
56   |
57LL |     f = Box::new(f);
58   |         ^^^^^^^^^^^ cyclic type of infinite size
59   |
60help: consider unboxing the value
61   |
62LL |     f = *Box::new(f);
63   |         +
64
65error[E0308]: mismatched types
66  --> $DIR/coerce-suggestions.rs:21:9
67   |
68LL |     s = format!("foo");
69   |         ^^^^^^^^^^^^^^ expected `&mut String`, found `String`
70   |
71   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
72
73error: aborting due to 6 previous errors
74
75For more information about this error, try `rustc --explain E0308`.