Skip to content
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

RFC to remove some special treatment of Box by borrow checker #130

Merged
merged 1 commit into from
Jul 30, 2014

Conversation

nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jun 19, 2014

@anasazi
Copy link

anasazi commented Jun 30, 2014

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.

@zwarich
Copy link

zwarich commented Jul 24, 2014

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.

@zwarich
Copy link

zwarich commented Jul 24, 2014

@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.

@zwarich
Copy link

zwarich commented Jul 25, 2014

I went through and wrote a bunch of new test cases, and found one place I missed, which resulted in a few more changes: https://gist.github.com/zwarich/348d5726d1ef42f109ee

@brson brson merged commit 7fabfeb into rust-lang:master Jul 30, 2014
@brson
Copy link
Contributor

brson commented Jul 30, 2014

@pnkfelix
Copy link
Member

pnkfelix commented Nov 5, 2018

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.

@pnkfelix
Copy link
Member

pnkfelix commented Nov 6, 2018

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 Nov 10, 2018
…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:

 1. Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see...
 2. ... 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) )
@Centril Centril added A-typesystem Type system related proposals & ideas A-borrowck Borrow checker related proposals & ideas A-allocation Proposals relating to allocation. labels Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocation Proposals relating to allocation. A-borrowck Borrow checker related proposals & ideas A-typesystem Type system related proposals & ideas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants