summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/deref-multi.stderr
blob: bd6575c73d244f749380af0abe7be33553536aa5 (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
error[E0308]: mismatched types
  --> $DIR/deref-multi.rs:2:5
   |
LL | fn a(x: &&i32) -> i32 {
   |                   --- expected `i32` because of return type
LL |     x
   |     ^ expected `i32`, found `&&i32`
   |
help: consider dereferencing the borrow
   |
LL |     **x
   |     ++

error[E0308]: mismatched types
  --> $DIR/deref-multi.rs:7:5
   |
LL | fn a2(x: &&&&&i32) -> i32 {
   |                       --- expected `i32` because of return type
LL |     x
   |     ^ expected `i32`, found `&&&&&i32`
   |
help: consider dereferencing the borrow
   |
LL |     *****x
   |     +++++

error[E0308]: mismatched types
  --> $DIR/deref-multi.rs:12:5
   |
LL | fn b(x: &i32) -> i32 {
   |                  --- expected `i32` because of return type
LL |     &x
   |     ^^ expected `i32`, found `&&i32`
   |
help: consider removing the `&` and dereferencing the borrow instead
   |
LL |     *x
   |     ~

error[E0308]: mismatched types
  --> $DIR/deref-multi.rs:17:5
   |
LL | fn c(x: Box<i32>) -> i32 {
   |                      --- expected `i32` because of return type
LL |     &x
   |     ^^ expected `i32`, found `&Box<i32>`
   |
   = note:   expected type `i32`
           found reference `&Box<i32>`
help: consider removing the `&` and dereferencing the borrow instead
   |
LL |     *x
   |     ~

error[E0308]: mismatched types
  --> $DIR/deref-multi.rs:22:5
   |
LL | fn d(x: std::sync::Mutex<&i32>) -> i32 {
   |                                    --- expected `i32` because of return type
LL |     x.lock().unwrap()
   |     ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `MutexGuard`
   |
   = note: expected type `i32`
            found struct `MutexGuard<'_, &i32>`
help: consider dereferencing the type
   |
LL |     **x.lock().unwrap()
   |     ++

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0308`.