Expand test
This commit is contained in:
parent
4e7ec07bb9
commit
a51ca0268d
2 changed files with 30 additions and 2 deletions
|
@ -38,7 +38,11 @@ fn main() {
|
|||
let u = 3;
|
||||
let s = S { u };
|
||||
//~^ ERROR mismatched types
|
||||
let s = S { u: u };
|
||||
//~^ ERROR mismatched types
|
||||
let i = &4;
|
||||
let r = R { i };
|
||||
//~^ ERROR mismatched types
|
||||
let r = R { i: i };
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
|
|
@ -81,7 +81,19 @@ LL | let s = S { u };
|
|||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:42:17
|
||||
--> $DIR/deref-suggestion.rs:41:20
|
||||
|
|
||||
LL | let s = S { u: u };
|
||||
| ^
|
||||
| |
|
||||
| expected &u32, found integer
|
||||
| help: consider borrowing here: `&u`
|
||||
|
|
||||
= note: expected type `&u32`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:44:17
|
||||
|
|
||||
LL | let r = R { i };
|
||||
| ^
|
||||
|
@ -92,6 +104,18 @@ LL | let r = R { i };
|
|||
= note: expected type `u32`
|
||||
found type `&{integer}`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:46:20
|
||||
|
|
||||
LL | let r = R { i: i };
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found &{integer}
|
||||
| help: consider dereferencing the borrow: `*i`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found type `&{integer}`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
Loading…
Add table
Reference in a new issue