Skip to content

Exercise 2.4.1.J Deref and DerefMut not working as said #126

@fubupc

Description

@fubupc

The question states:

Replacing the implementation of deref with self.as_ref() results in a stack overflow when running an unoptimized version. Why? (Hint: deref coercion)

But actually self.as_ref() does not cause stack overflow: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9ce74e7edda0542dbf20c04f521b2879.

Not sure if I misunderstand something here.

PS: I cannot give a link to above quote directly because the book's website is broken: https://teach-rs.trifectatech.org/full .

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions