File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,13 @@ fn foo() -> bool {
4
4
mut
5
5
if true { true } else { false }
6
6
}
7
+
8
+ fn bar ( ) -> bool {
9
+ & //~ ERROR 9:5: 10:40: mismatched types [E0308]
10
+ mut if true { true } else { false }
11
+ }
12
+
13
+ fn baz ( ) -> bool {
14
+ & mut //~ ERROR 14:5: 15:36: mismatched types [E0308]
15
+ if true { true } else { false }
16
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,36 @@ LL - &
14
14
LL - mut
15
15
|
16
16
17
- error: aborting due to previous error
17
+ error[E0308]: mismatched types
18
+ --> $DIR/issue-92741.rs:9:5
19
+ |
20
+ LL | fn bar() -> bool {
21
+ | ---- expected `bool` because of return type
22
+ LL | / &
23
+ LL | | mut if true { true } else { false }
24
+ | |_______________________________________^ expected `bool`, found `&mut bool`
25
+ |
26
+ help: consider removing the borrow
27
+ |
28
+ LL - &
29
+ LL - mut if true { true } else { false }
30
+ LL + if true { true } else { false }
31
+ |
32
+
33
+ error[E0308]: mismatched types
34
+ --> $DIR/issue-92741.rs:14:5
35
+ |
36
+ LL | fn baz() -> bool {
37
+ | ---- expected `bool` because of return type
38
+ LL | / & mut
39
+ LL | | if true { true } else { false }
40
+ | |___________________________________^ expected `bool`, found `&mut bool`
41
+ |
42
+ help: consider removing the borrow
43
+ |
44
+ LL - & mut
45
+ |
46
+
47
+ error: aborting due to 3 previous errors
18
48
19
49
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments