Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cow1.rs last test is missing to_mut #1611

Open
quidnu opened this issue Aug 5, 2023 · 8 comments · Fixed by #1620
Open

cow1.rs last test is missing to_mut #1611

quidnu opened this issue Aug 5, 2023 · 8 comments · Fixed by #1620

Comments

@quidnu
Copy link

quidnu commented Aug 5, 2023

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

@wh5a
Copy link

wh5a commented Sep 7, 2023

@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

@wh5a
Copy link

wh5a commented Sep 7, 2023

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.

@pchilds
Copy link

pchilds commented Sep 18, 2023

This should have been checked before merging.
#1620 has presented a regression.
@shadows-withal could you please reopen this issue.

@shadows-withal
Copy link
Member

My bad! I'll push a patch release to address this regression.

@shadows-withal
Copy link
Member

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.

@wh5a
Copy link

wh5a commented Sep 18, 2023

Isn't this already fixed by someone else?

@shadows-withal
Copy link
Member

In 33a4f4e, yeah. I'm just keeping the issue open in case anyone else runs into confusion.

@PranavJayachand
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants