forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#53932 - matthewjasper:remove-base-path, r=n…
…ikomatsakis [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
- Loading branch information
Showing
3 changed files
with
18 additions
and
70 deletions.
There are no files selected for viewing
This file contains 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
35 changes: 12 additions & 23 deletions
35
src/test/ui/borrowck/borrowck-box-insensitivity.nll.stderr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
error[E0382]: use of moved value: `a.y` | ||
--> $DIR/borrowck-box-insensitivity.rs:46:14 | ||
| | ||
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 | ||
|
||
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: compilation successful | ||
--> $DIR/borrowck-box-insensitivity.rs:160:1 | ||
| | ||
LL | / fn main() { | ||
LL | | copy_after_move(); | ||
LL | | move_after_move(); | ||
LL | | borrow_after_move(); | ||
... | | ||
LL | | mut_borrow_after_borrow_nested(); | ||
LL | | } | ||
| |_^ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0382`. |
This file contains 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