]> git.lizzy.rs Git - rust.git/blob - tests/ui/return/issue-82612-return-mutable-reference.stderr
Auto merge of #106399 - estebank:type-err-span-label, r=nagisa
[rust.git] / tests / ui / return / issue-82612-return-mutable-reference.stderr
1 error[E0308]: mismatched types
2   --> $DIR/issue-82612-return-mutable-reference.rs:18:13
3    |
4 LL | /         if index < self.values.len() {
5 LL | |             let value = unsafe { self.values.get_unchecked_mut(index) };
6 LL | |             value.get_or_insert_with(func)
7    | |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&mut V`
8 LL | |         }
9    | |_________- expected this to be `()`
10    |
11    = note:      expected unit type `()`
12            found mutable reference `&mut V`
13 help: consider using a semicolon here
14    |
15 LL |             value.get_or_insert_with(func);
16    |                                           +
17 help: consider using a semicolon here
18    |
19 LL |         };
20    |          +
21 help: you might have meant to return this value
22    |
23 LL |             return value.get_or_insert_with(func);
24    |             ++++++                               +
25
26 error: aborting due to previous error
27
28 For more information about this error, try `rustc --explain E0308`.