RFC to remove some special treatment of Box by borrow checker by nikomatsakis · Pull Request #130 · rust-lang/rfcs (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation7 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
I don't understand the motivation for doing this (but then I've never understood the obsession everyone else has with treating unique pointers just like non-unique pointers) especially when the proposed design still special cases Box
so that moves out are allowed.
I really just don't understand why we would want to make our type system more restrictive just because we can exploit information about Box
that we can't about smart pointers. Seems like it would be going backward.
As discussed in this week's Rust meeting, I went ahead and implemented this change to see what the fallout would be like. There are only two changes required in the Rust distribution (I'm not including tests, since they are designed to test all of the edge cases):
https://gist.github.com/zwarich/348d5726d1ef42f109ee
I'll finish going through tests and double-check that I implemented everything correctly, but this looks like minimal impact on any real-world code.
@anasazi We can remove the special-casing for moves out of Box
by doing something like #178. It doesn't appear to be possible to do the same thing in a safe fashion for the special cases discussed in this RFC.
brson mentioned this pull request
withoutboats pushed a commit to withoutboats/rfcs that referenced this pull request
Fix links to tokio-tls documentation
At some point we should document the fact that NLL has gone back to adding (more) special treatment of Box<T>
. One big reason we were able to justify this is that we discovered several more instances where AST-borrowck was also special casing its treatment of Box<T>
, so it was more consistent overall to just special case Box<T>
consistently within NLL.
See e.g. this snippet of conversation regarding the special treatment of Box
(which was originally a concern blocking NLL from moving forward): rust-lang/rust#43234 (comment)
pietroalbini added a commit to pietroalbini/rust that referenced this pull request
…est-for-nll, r=davidtwco
NLL: Update box insensitivity test
This is just keeping one of our tests honest with respect to NLL, in two ways:
- Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see...
- ... I say "would have expected" because all of the errors in this file are part of the reversion of rust-lang/rfcs#130 that is attached to NLL (you can see more discussion of this here rust-lang#43234 (comment) )