]> git.lizzy.rs Git - rust.git/blob - tests/ui/typeck/deref-multi.stderr
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / typeck / deref-multi.stderr
1 error[E0308]: mismatched types
2   --> $DIR/deref-multi.rs:2:5
3    |
4 LL | fn a(x: &&i32) -> i32 {
5    |                   --- expected `i32` because of return type
6 LL |     x
7    |     ^ expected `i32`, found `&&i32`
8    |
9 help: consider dereferencing the borrow
10    |
11 LL |     **x
12    |     ++
13
14 error[E0308]: mismatched types
15   --> $DIR/deref-multi.rs:7:5
16    |
17 LL | fn a2(x: &&&&&i32) -> i32 {
18    |                       --- expected `i32` because of return type
19 LL |     x
20    |     ^ expected `i32`, found `&&&&&i32`
21    |
22 help: consider dereferencing the borrow
23    |
24 LL |     *****x
25    |     +++++
26
27 error[E0308]: mismatched types
28   --> $DIR/deref-multi.rs:12:5
29    |
30 LL | fn b(x: &i32) -> i32 {
31    |                  --- expected `i32` because of return type
32 LL |     &x
33    |     ^^ expected `i32`, found `&&i32`
34    |
35 help: consider removing the `&` and dereferencing the borrow instead
36    |
37 LL |     *x
38    |     ~
39
40 error[E0308]: mismatched types
41   --> $DIR/deref-multi.rs:17:5
42    |
43 LL | fn c(x: Box<i32>) -> i32 {
44    |                      --- expected `i32` because of return type
45 LL |     &x
46    |     ^^ expected `i32`, found `&Box<i32>`
47    |
48    = note:   expected type `i32`
49            found reference `&Box<i32>`
50 help: consider removing the `&` and dereferencing the borrow instead
51    |
52 LL |     *x
53    |     ~
54
55 error[E0308]: mismatched types
56   --> $DIR/deref-multi.rs:22:5
57    |
58 LL | fn d(x: std::sync::Mutex<&i32>) -> i32 {
59    |                                    --- expected `i32` because of return type
60 LL |     x.lock().unwrap()
61    |     ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `MutexGuard`
62    |
63    = note: expected type `i32`
64             found struct `MutexGuard<'_, &i32>`
65 help: consider dereferencing the type
66    |
67 LL |     **x.lock().unwrap()
68    |     ++
69
70 error: aborting due to 5 previous errors
71
72 For more information about this error, try `rustc --explain E0308`.