]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deref-suggestion.stderr
Add additional test
[rust.git] / src / test / ui / deref-suggestion.stderr
1 error[E0308]: mismatched types
2   --> $DIR/deref-suggestion.rs:8:9
3    |
4 LL |     foo(s);
5    |         ^
6    |         |
7    |         expected struct `String`, found `&String`
8    |         help: try using a conversion method: `s.to_string()`
9
10 error[E0308]: mismatched types
11   --> $DIR/deref-suggestion.rs:14:10
12    |
13 LL |     foo3(u);
14    |          ^
15    |          |
16    |          expected `u32`, found `&u32`
17    |          help: consider dereferencing the borrow: `*u`
18
19 error[E0308]: mismatched types
20   --> $DIR/deref-suggestion.rs:30:9
21    |
22 LL |     foo(&"aaa".to_owned());
23    |         ^^^^^^^^^^^^^^^^^
24    |         |
25    |         expected struct `String`, found `&String`
26    |         help: consider removing the borrow: `"aaa".to_owned()`
27
28 error[E0308]: mismatched types
29   --> $DIR/deref-suggestion.rs:32:9
30    |
31 LL |     foo(&mut "aaa".to_owned());
32    |         ^^^^^^^^^^^^^^^^^^^^^
33    |         |
34    |         expected struct `String`, found `&mut String`
35    |         help: consider removing the borrow: `"aaa".to_owned()`
36
37 error[E0308]: mismatched types
38   --> $DIR/deref-suggestion.rs:2:20
39    |
40 LL |     ($x:expr) => { &$x }
41    |                    ^^^ expected `u32`, found `&{integer}`
42 ...
43 LL |     foo3(borrow!(0));
44    |          ---------- in this macro invocation
45    |
46    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
47
48 error[E0308]: mismatched types
49   --> $DIR/deref-suggestion.rs:36:5
50    |
51 LL |     assert_eq!(3i32, &3i32);
52    |     ^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
53    |
54    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
55
56 error[E0308]: mismatched types
57   --> $DIR/deref-suggestion.rs:39:17
58    |
59 LL |     let s = S { u };
60    |                 ^
61    |                 |
62    |                 expected `&u32`, found integer
63    |                 help: consider borrowing here: `u: &u`
64
65 error[E0308]: mismatched types
66   --> $DIR/deref-suggestion.rs:41:20
67    |
68 LL |     let s = S { u: u };
69    |                    ^
70    |                    |
71    |                    expected `&u32`, found integer
72    |                    help: consider borrowing here: `&u`
73
74 error[E0308]: mismatched types
75   --> $DIR/deref-suggestion.rs:44:17
76    |
77 LL |     let r = R { i };
78    |                 ^
79    |                 |
80    |                 expected `u32`, found `&{integer}`
81    |                 help: consider dereferencing the borrow: `i: *i`
82
83 error[E0308]: mismatched types
84   --> $DIR/deref-suggestion.rs:46:20
85    |
86 LL |     let r = R { i: i };
87    |                    ^
88    |                    |
89    |                    expected `u32`, found `&{integer}`
90    |                    help: consider dereferencing the borrow: `*i`
91
92 error[E0308]: mismatched types
93   --> $DIR/deref-suggestion.rs:55:9
94    |
95 LL |         b
96    |         ^
97    |         |
98    |         expected `i32`, found `&{integer}`
99    |         help: consider dereferencing the borrow: `*b`
100
101 error[E0308]: mismatched types
102   --> $DIR/deref-suggestion.rs:63:9
103    |
104 LL |         b
105    |         ^
106    |         |
107    |         expected `i32`, found `&{integer}`
108    |         help: consider dereferencing the borrow: `*b`
109
110 error[E0308]: `if` and `else` have incompatible types
111   --> $DIR/deref-suggestion.rs:68:12
112    |
113 LL |        let val = if true {
114    |   _______________-
115 LL |  |         *a
116    |  |         -- expected because of this
117 LL |  |     } else if true {
118    |  |____________^
119 LL | ||
120 LL | ||         b
121 LL | ||     } else {
122 LL | ||         &0
123 LL | ||     };
124    | ||     ^
125    | ||_____|
126    | |______`if` and `else` have incompatible types
127    |        expected `i32`, found `&{integer}`
128    |
129 help: consider dereferencing the borrow
130    |
131 LL |     } else *if true {
132 LL |
133 LL |         b
134 LL |     } else {
135 LL |         &0
136 LL |     };
137    |
138
139 error: aborting due to 13 previous errors
140
141 For more information about this error, try `rustc --explain E0308`.