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