-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
std::rc::Rc should accept DST #18248
Comments
No idea whether we even want to change things before #16918 gets resolved, but I'll work on this just to give me an excuse to dig into the libs again. |
@brandonson FYI, I've tried to fix it by changing RcBox to:
but that didn't work out because of ICE from #17959 . |
Quick update, my attempts have halted for the moment. The way I did it appears to have made compiling std cause rustc to enter an infinite loop, and I had added an extra pointer in any case. We may just want to wait for that ICE to be fixed. |
This also impacts using closures, since they're trait objects. |
Shouldn't this include |
It could be the same, the root cause is the same. |
There are two pieces missing here: we need coercions of deeply DST objects in order to create I'm working on spec'ing then implementing the DST coercions atm. I guess #19063 will cover everything that needs doing to implement
|
FWIW, I have an out of tree implementation of My implementation only supports strong references [1] and uses a different data layout than the one in libstd, which results in a simple implementation of the constructor and the destructor. I have also documented the (re)allocations that each constructor/conversion (e.g. [1] I didn't implement weak references because (I think) I don't need them (yet) for what I'm using the |
@japaric cool! Although, fwiw, that sort of pointer (with separate allocation for the refcounts) almost exists today via |
Yes, but that one has double indirection, it's like |
Yeah, hence "almost". :) |
I believe this was fixed in #24619. |
Yay! |
There is a FIXME related to this issue, |
remove FIXME(rust-lang#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(rust-lang#19649) now that stability markers render. remove FIXME(rust-lang#13642) now the benchmarks were moved. remove FIXME(rust-lang#6220) now that floating points can be formatted. remove FIXME(rust-lang#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(rust-lang#1697, rust-lang#2178...) update FIXME(rust-lang#5516) to point to getopts issue 7 update FIXME(rust-lang#7771) to point to RFC 628 update FIXME(rust-lang#19839) to point to issue 26925
It's currently impossible to store DST (Trait object, for example) inside RC:
gives you:
the trait 'core::kinds::Sized' must be implemented because it is required by 'alloc::rc::Rc'
. However, you can store trait object insideBox
.Rc
usesBox
internally, so it seems inconsistent that one cannot use refcounted box as replacement forBox
.One could work around this issue by storing
Box<Trait>
insideRc
, but that would incur double indirection.Moreover, one couldn't implement their own
Rc
because of related ICE: #17959 .(Maybe related to: #16918 )
The text was updated successfully, but these errors were encountered: