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

Probably small typo #220

Open
pudnax opened this issue Jan 29, 2022 · 6 comments
Open

Probably small typo #220

pudnax opened this issue Jan 29, 2022 · 6 comments

Comments

@pudnax
Copy link

pudnax commented Jan 29, 2022

In the chaper 6.7 Layout + Basic Redux

Hey that code's actuallyy looking a lot cleaner now that we're sticking to raw pointers!

On to pop, which is also pretty similar to how we left it, although we've got to remember to use Box::from_raw to clean up the allocation:

y/n with actuallyy

@pudnax
Copy link
Author

pudnax commented Jan 29, 2022

And in the chaper 6.8 before Moment of truth time...
There should be as_ref/as_mut or as_deref/as_deref_mut functions?

@alebahn
Copy link

alebahn commented Jan 31, 2022

I just ran into your second comment. It doesn't compile with as_deref / as_deref_mut. I'm trying adding and unsafe block and using as_ref and as_mut.

@Gankra
Copy link
Collaborator

Gankra commented Feb 10, 2022

I'm not 100% sure what y'all mean, but I assume you're just thrown off because the head is a raw pointer and doesn't have an Option anymore?

@Gankra
Copy link
Collaborator

Gankra commented Feb 10, 2022

(the other typo has been fixed, thanks!)

@kentuckyfriedmeerkat
Copy link

kentuckyfriedmeerkat commented Mar 21, 2022

I've also stumbled here. The code in 6.8, attempting to call the as_deref() and as_deref_mut() methods on the head raw pointer won't compile. The full listing in 6.9 will, as it uses the as_ref() and as_mut() methods, wrapped in an unsafe block. This is how it seems to me at least - forgive any oversights.

@LeonWiese
Copy link

Yes, I also figured out the as_deref/as_deref_mut part isn't correct when reimplemting the whole thing step-by-step. It is also funny because the next sentence is YES!!! Take that NARRATOR! Sometimes I don't make mistakes!.

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

No branches or pull requests

5 participants