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

fixed incorrect mention of garbage collection in quiz explanation #248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

notfatdan
Copy link

In the quiz explanation ch19-01-unsafe-rust.toml, the last question mentions that the appropriate workaround for returning a pointer to a stack-allocated variable is to use garbage collection, specifically by returning an Rc. This is misleading as Rust does not have garbage collection built into the language. Rc is a reference-counted smart pointer which manages memory through reference counting and not garbage collection. Referring to it as garbage collection can cause confusion, especially for learners who are trying to figure out the differences between Rust and garbage collected languages such as Java or Python.

Suggested Fix:

Replace the reference to garbage collection with reference counting to accurately reflect Rust's memory management model.

@willcrichton
Copy link
Collaborator

I am of the firm opinion that reference counting is a form of garbage collection, as mentioned in Chapter 4.5. I support the phrasing as-is, since GC is the general strategy for returning pointers to locally-allocated objects, with reference counting being a specific implementation strategy.

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 this pull request may close these issues.

2 participants