Rollup merge of #53932 - matthewjasper:remove-base-path, r=nikomatsakis

[NLL] Remove base_place

This function was supposed to make `Box` less special. But

* I think that the consensus is that MIR borrowck is going to fully special case `Box`
* It wasn't implemented correctly, it's looking at the type of the wrong `Place`, resulting in weird behaviour:

```rust
#![feature(nll)]
type A = Box<i32>; // If this is changed to another type then this will compile.

pub fn foo(x: Box<(String, A)>) {
    let a = x.0; // This will compile if these lines are swapped
    let b = x.1;
}
```

r? @nikomatsakis
This commit is contained in:
kennytm 2018-09-08 16:07:38 +08:00
commit 7569d9266e
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
3 changed files with 17 additions and 69 deletions

View file

@ -1,25 +1,14 @@
error[E0382]: use of moved value: `a.y`
--> $DIR/borrowck-box-insensitivity.rs:46:14
error: compilation successful
--> $DIR/borrowck-box-insensitivity.rs:160:1
|
LL | let _x = a.x;
| --- value moved here
LL | //~^ value moved here
LL | let _y = a.y; //~ ERROR use of moved
| ^^^ value used here after move
|
= note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
LL | / fn main() {
LL | | copy_after_move();
LL | | move_after_move();
LL | | borrow_after_move();
... |
LL | | mut_borrow_after_borrow_nested();
LL | | }
| |_^
error[E0382]: use of moved value: `a.y`
--> $DIR/borrowck-box-insensitivity.rs:108:14
|
LL | let _x = a.x.x;
| ----- value moved here
LL | //~^ value moved here
LL | let _y = a.y; //~ ERROR use of collaterally moved
| ^^^ value used here after move
|
= note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0382`.

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
#![feature(box_syntax, rustc_attrs)]
struct A {
x: Box<isize>,
@ -156,6 +156,7 @@ fn mut_borrow_after_borrow_nested() {
//~^ mutable borrow occurs here
}
#[rustc_error]
fn main() {
copy_after_move();
move_after_move();