Skip to content

Commit

Permalink
Auto merge of #66246 - matthewjasper:simplify-mem-cat, r=pnkfelix
Browse files Browse the repository at this point in the history
Simplify memory categorization

With AST borrowck gone, mem_categorization can be simplified, a lot.

* `cmt_` is now called `Place`. Most local variable names have been updated to reflect this, but the `cat_*` methods retain their names.
* `MemCategorizationContext` no longer needs a `ScopeTree` and always needs an `InferCtxt`.
* `Place` now uses a similar representation to `mir::Place` with a `Vec` of projections.
* `Upvar` places don't include the implicit environment and capture derefs. These are now handled by `regionck` when needed.
* Various types, methods and variants only used by AST borrowck have been removed.
* `ExprUseVisitor` now lives in `rustc_typeck::expr_use_visitor`.
* `MemCategorizationContext` and `Place` live in `rustc_typeck::mem_categorization`.
* `Place` is re-exported in `rustc_typeck::expr_use_visitor` so that Clippy can access it.

The loss of an error in `issue-4335.rs` is due to a change in capture inference in ill-formed programs. If any projection from a variable is moved from then we capture that variable by move, whether or not the place being moved from allows this.

Closes #66270
  • Loading branch information
bors committed Nov 28, 2019
2 parents 2539b5f + 5bc1586 commit 4752c05
Show file tree
Hide file tree
Showing 11 changed files with 993 additions and 1,957 deletions.
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,13 @@ pub mod infer;
pub mod lint;

pub mod middle {
pub mod expr_use_visitor;
pub mod cstore;
pub mod dependency_format;
pub mod diagnostic_items;
pub mod exported_symbols;
pub mod free_region;
pub mod lib_features;
pub mod lang_items;
pub mod mem_categorization;
pub mod privacy;
pub mod reachable;
pub mod region;
Expand Down
Loading

0 comments on commit 4752c05

Please sign in to comment.