Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust documentation on unsizing
  • Loading branch information
197g committed Apr 15, 2021
commit bc02b1e4457faaccc8fbc925009175183ec2ae25
3 changes: 3 additions & 0 deletions crates/rc-box/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ optional = true
[dependencies.unsize]
version = "1.1"
optional = true

[package.metadata.docs.rs]
all-features = true
11 changes: 6 additions & 5 deletions crates/rc-box/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ macro_rules! rc_box {

// ~~~ $Rc<T> and Box<T> like inherent impls ~~~ //

// downcast is pretty useless without CoerceUnsized

impl $RcBox<dyn Any + 'static> {
doc_comment! {
concat!("Attempt to downcast the box to a concrete type.
Expand All @@ -122,7 +120,8 @@ print_if_string(my_number.try_into().unwrap());
```

The unsizing as `", stringify!($Rc), "` is required until
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized."),
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized. Alternatively,
activate the `unsize` feature to convert the pointer via an explicit method call."),
#[inline]
pub fn downcast<T>(self) -> Result<$RcBox<T>, Self>
where T: Any,
Expand Down Expand Up @@ -164,7 +163,8 @@ print_if_string(my_number.try_into().unwrap());
```

The unsizing as `", stringify!($Rc), "` is required until
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized."),
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized. Alternatively,
activate the `unsize` feature to convert the pointer via an explicit method call."),
#[inline]
pub fn downcast<T>(self) -> Result<$RcBox<T>, Self>
where T: Any + Send
Expand Down Expand Up @@ -206,7 +206,8 @@ print_if_string(my_number.try_into().unwrap());
```

The unsizing as `", stringify!($Rc), "` is required until
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized."),
[DST coercions](https://github.com/rust-lang/rust/issues/27732) are stabilized. Alternatively,
activate the `unsize` feature to convert the pointer via an explicit method call."),
#[inline]
pub fn downcast<T>(self) -> Result<$RcBox<T>, Self>
where T: Any + Send + Sync
Expand Down