rustlings
rustlings copied to clipboard
cow1.rs last test is missing to_mut
cow1.rs last test owned_mutation
is missing to_mut
as described in the comment. As is it is identical to the previous test, owned_no_mutation
@quidnu @mkovaxx I'm getting this type error and I'm not sure what the intended fix is? Am I only supposed to add code under //TODO
?
⚠️ Compiling of exercises/smart_pointers/cow1.rs failed! Please try again. Here's the output:
error[E0308]: mismatched types
--> exercises/smart_pointers/cow1.rs:74:23
|
74 | match abs_all(&mut input) {
| ------- ^^^^^^^^^^ expected `&mut Cow<'_, [i32]>`, found `&mut &mut Vec<{integer}>`
| |
| arguments to this function are incorrect
|
= note: expected mutable reference `&mut std::borrow::Cow<'_, [i32]>`
found mutable reference `&mut &mut Vec<{integer}>`
note: function defined here
--> exercises/smart_pointers/cow1.rs:19:4
|
19 | fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {
| ^^^^^^^ -----------------------------
error: aborting due to previous error
In fact, I think we should not add to_mut
, as the comment is actually referring to the to_mut
call inside the abs_all
function. owned_mutation
isn't identical to owned_no_mutation
if you look more closely at the input vector.
This should have been checked before merging. #1620 has presented a regression. @shadows-withal could you please reopen this issue.
My bad! I'll push a patch release to address this regression.
Also, I'll keep this issue open, but @wh5a said it correctly: The comment is correct, the abs_all
function presents a special behaviour when processing a negative number.
Isn't this already fixed by someone else?
In 33a4f4e454031ea7b318c855625553b413b8afcd, yeah. I'm just keeping the issue open in case anyone else runs into confusion.
In 33a4f4e, yeah. I'm just keeping the issue open in case anyone else runs into confusion.
And thank you for that -- was really confused on what to change at this point working through the exercises! Good to read through the thread and figure it out.
Further improved in https://github.com/rust-lang/rustlings/commit/9d7b973a62d3c0181be386752d72fa0722fe6135