Skip to content

~ -> Box in the manual #16444

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

Merged
merged 1 commit into from
Aug 14, 2014
Merged

Conversation

steveklabnik
Copy link
Member

Fixes #16439

@@ -1535,7 +1535,7 @@ Likewise, supertrait methods may also be called on trait objects.
# impl Shape for int { fn area(&self) -> f64 { 0.0 } }
# impl Circle for int { fn radius(&self) -> f64 { 0.0 } }
# let mycircle = 0;
let mycircle: Circle = ~mycircle as ~Circle;
let mycircle = box mycircle;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is trying to demonstrate something about trait objects? ("likewise supertrait methods may also be called on trait objects")

Maybe it could be let mycircle = box mycircle as Box<Circle>;?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. You are correct that the cast is needed to do the right thing here.

@bors bors closed this Aug 14, 2014
@bors bors merged commit 5eb4e1a into rust-lang:master Aug 14, 2014
@steveklabnik steveklabnik deleted the fix_boxes_in_manual branch October 25, 2017 18:26
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.

manual, still a reference with ~ operator
4 participants