Add cross link from Any to Arc/Rc to document downcasting works differently than for Box
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location (URL)
https://doc.rust-lang.org/stable/std/any/trait.Any.html
Summary
Any downcasting is implemented for dyn Any as well as Box<Any> (and Send/Sync versions of those). For Arc there is an inherent method instead. Same for Rc.
I did not find these inherent methods, leading to me to open a question on URLO. It would be good to have some cross links from Any to indicate this.
There is even a section in the module level docs on smart pointers but no mention of this downcasting.
There is a mention of Box<dyn Any> in the first section, but I did not spot that, as Box is also listed as an impl of Any, while Arc is not.
This is all really strange and confusing, and not very discoverable. I don't know what the proper fix is or where it should be documented. But some cross-links are very much needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Any trait documentation and the module's “Smart pointers and dyn Any” section linked in the issue. Compare the existing Box downcasting explanation with Arc::downcast and Rc::downcast, then add cross-links that make those inherent methods discoverable; the documentation should clearly explain that their downcasting differs from Box.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100