From 48253606e322275ffe22501e04691bdb9038cb00 Mon Sep 17 00:00:00 2001 From: Mariana Meireles Date: Wed, 24 Apr 2019 20:03:46 -0300 Subject: [PATCH] Renames mir::Mir to mir::Body --- src/librustc/infer/mod.rs | 2 +- src/librustc/mir/cache.rs | 6 +-- src/librustc/mir/interpret/mod.rs | 2 +- src/librustc/mir/mod.rs | 42 +++++++++--------- src/librustc/mir/traversal.rs | 18 ++++---- src/librustc/mir/visit.rs | 8 ++-- src/librustc/query/mod.rs | 14 +++--- src/librustc/session/config.rs | 22 +++++----- src/librustc/ty/context.rs | 12 ++--- src/librustc/ty/mod.rs | 4 +- src/librustc/ty/steal.rs | 2 +- .../debuginfo/create_scope_map.rs | 6 +-- src/librustc_codegen_llvm/debuginfo/mod.rs | 4 +- src/librustc_codegen_ssa/back/write.rs | 4 +- src/librustc_codegen_ssa/mir/analyze.rs | 6 +-- src/librustc_codegen_ssa/mir/mod.rs | 8 ++-- src/librustc_codegen_ssa/traits/debuginfo.rs | 4 +- src/librustc_interface/passes.rs | 2 +- src/librustc_metadata/decoder.rs | 4 +- src/librustc_metadata/encoder.rs | 2 +- src/librustc_metadata/schema.rs | 2 +- src/librustc_mir/borrow_check/borrow_set.rs | 8 ++-- .../borrow_check/error_reporting.rs | 44 +++++++++---------- src/librustc_mir/borrow_check/location.rs | 4 +- src/librustc_mir/borrow_check/mod.rs | 14 +++--- src/librustc_mir/borrow_check/move_errors.rs | 2 +- .../borrow_check/mutability_errors.rs | 10 ++--- .../borrow_check/nll/constraint_generation.rs | 4 +- .../nll/explain_borrow/find_use.rs | 8 ++-- .../borrow_check/nll/explain_borrow/mod.rs | 4 +- .../borrow_check/nll/invalidation.rs | 6 +-- src/librustc_mir/borrow_check/nll/mod.rs | 10 ++--- .../nll/region_infer/error_reporting/mod.rs | 20 ++++----- .../error_reporting/region_name.rs | 12 ++--- .../region_infer/error_reporting/var_name.rs | 6 +-- .../borrow_check/nll/region_infer/mod.rs | 28 ++++++------ .../borrow_check/nll/region_infer/values.rs | 6 +-- src/librustc_mir/borrow_check/nll/renumber.rs | 6 +-- .../nll/type_check/input_output.rs | 2 +- .../nll/type_check/liveness/local_use_map.rs | 4 +- .../nll/type_check/liveness/mod.rs | 6 +-- .../nll/type_check/liveness/trace.rs | 6 +-- .../borrow_check/nll/type_check/mod.rs | 40 ++++++++--------- src/librustc_mir/borrow_check/path_utils.rs | 4 +- src/librustc_mir/borrow_check/place_ext.rs | 6 +-- .../borrow_check/places_conflict.rs | 10 ++--- src/librustc_mir/borrow_check/prefixes.rs | 4 +- src/librustc_mir/build/mod.rs | 22 +++++----- src/librustc_mir/const_eval.rs | 8 ++-- .../dataflow/drop_flag_effects.rs | 20 ++++----- src/librustc_mir/dataflow/graphviz.rs | 14 +++--- .../dataflow/impls/borrowed_locals.rs | 6 +-- src/librustc_mir/dataflow/impls/borrows.rs | 8 ++-- src/librustc_mir/dataflow/impls/mod.rs | 18 ++++---- .../dataflow/impls/storage_liveness.rs | 6 +-- src/librustc_mir/dataflow/mod.rs | 14 +++--- .../dataflow/move_paths/builder.rs | 6 +-- src/librustc_mir/dataflow/move_paths/mod.rs | 6 +-- src/librustc_mir/hair/cx/mod.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 8 ++-- src/librustc_mir/interpret/machine.rs | 2 +- src/librustc_mir/lints.rs | 6 +-- src/librustc_mir/monomorphize/collector.rs | 2 +- src/librustc_mir/shim.rs | 24 +++++----- src/librustc_mir/transform/add_call_guards.rs | 4 +- .../transform/add_moves_for_packed_drops.rs | 8 ++-- src/librustc_mir/transform/add_retag.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 4 +- .../transform/cleanup_post_borrowck.rs | 4 +- src/librustc_mir/transform/const_prop.rs | 10 ++--- src/librustc_mir/transform/copy_prop.rs | 10 ++--- src/librustc_mir/transform/deaggregator.rs | 2 +- src/librustc_mir/transform/dump_mir.rs | 8 ++-- src/librustc_mir/transform/elaborate_drops.rs | 10 ++--- src/librustc_mir/transform/erase_regions.rs | 2 +- src/librustc_mir/transform/generator.rs | 32 +++++++------- src/librustc_mir/transform/inline.rs | 18 ++++---- src/librustc_mir/transform/instcombine.rs | 8 ++-- src/librustc_mir/transform/lower_128bit.rs | 4 +- src/librustc_mir/transform/mod.rs | 20 ++++----- src/librustc_mir/transform/no_landing_pads.rs | 4 +- src/librustc_mir/transform/promote_consts.rs | 14 +++--- src/librustc_mir/transform/qualify_consts.rs | 10 ++--- .../transform/qualify_min_const_fn.rs | 12 ++--- .../transform/remove_noop_landing_pads.rs | 8 ++-- src/librustc_mir/transform/rustc_peek.rs | 8 ++-- src/librustc_mir/transform/simplify.rs | 10 ++--- .../transform/simplify_branches.rs | 2 +- .../transform/uniform_array_move_out.rs | 8 ++-- src/librustc_mir/util/borrowck_errors.rs | 6 +-- src/librustc_mir/util/collect_writes.rs | 4 +- src/librustc_mir/util/def_use.rs | 12 ++--- src/librustc_mir/util/elaborate_drops.rs | 2 +- src/librustc_mir/util/graphviz.rs | 10 ++--- src/librustc_mir/util/liveness.rs | 8 ++-- src/librustc_mir/util/patch.rs | 8 ++-- src/librustc_mir/util/pretty.rs | 16 +++---- .../incremental/hashes/call_expressions.rs | 4 +- .../borrowck/borrowck-closures-two-mut.stderr | 10 ++--- src/test/ui/borrowck/borrowck-reinit.rs | 2 +- src/test/ui/borrowck/borrowck-reinit.stderr | 2 +- src/test/ui/borrowck/borrowck-storage-dead.rs | 2 +- .../ui/borrowck/borrowck-storage-dead.stderr | 2 +- src/test/ui/borrowck/immutable-arg.rs | 2 +- src/test/ui/borrowck/immutable-arg.stderr | 2 +- src/test/ui/borrowck/issue-41962.rs | 2 +- src/test/ui/borrowck/issue-41962.stderr | 2 +- .../generator/yield-while-local-borrowed.rs | 4 +- .../yield-while-local-borrowed.stderr | 4 +- src/test/ui/issues/issue-45697-1.rs | 4 +- src/test/ui/issues/issue-45697-1.stderr | 4 +- src/test/ui/issues/issue-45697.rs | 4 +- src/test/ui/issues/issue-45697.stderr | 4 +- src/test/ui/issues/issue-46471-1.rs | 2 +- src/test/ui/issues/issue-46471-1.stderr | 2 +- src/test/ui/issues/issue-46471.rs | 2 +- src/test/ui/issues/issue-46471.stderr | 2 +- src/test/ui/issues/issue-46472.rs | 2 +- src/test/ui/issues/issue-46472.stderr | 2 +- .../liveness-assign-imm-local-notes.rs | 8 ++-- .../liveness-assign-imm-local-notes.stderr | 8 ++-- .../ui/moves/moves-based-on-type-tuple.rs | 2 +- .../ui/moves/moves-based-on-type-tuple.stderr | 2 +- src/test/ui/nll/get_default.rs | 6 +-- src/test/ui/nll/get_default.stderr | 6 +-- src/test/ui/nll/loan_ends_mid_block_pair.rs | 2 +- .../ui/nll/loan_ends_mid_block_pair.stderr | 2 +- src/test/ui/nll/loan_ends_mid_block_vec.rs | 6 +-- .../ui/nll/loan_ends_mid_block_vec.stderr | 6 +-- .../ui/nll/region-ends-after-if-condition.rs | 2 +- .../nll/region-ends-after-if-condition.stderr | 2 +- src/test/ui/nll/return_from_loop.rs | 2 +- src/test/ui/nll/return_from_loop.stderr | 2 +- 133 files changed, 515 insertions(+), 515 deletions(-) diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index f332503435131..a80e3d8a058ca 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -97,7 +97,7 @@ impl SuppressRegionErrors { // If we're on MIR or Compare mode, don't report AST region errors as they should // be reported by NLL - BorrowckMode::Compare | BorrowckMode::Mir => SuppressRegionErrors { suppressed: true }, + BorrowckMode::Compare | BorrowckMode::Body => SuppressRegionErrors { suppressed: true }, } } } diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index 1cc927b1f720f..007013f8f8287 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -3,7 +3,7 @@ use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult}; use crate::ich::StableHashingContext; -use crate::mir::{Mir, BasicBlock}; +use crate::mir::{Body, BasicBlock}; use crate::rustc_serialize as serialize; @@ -47,7 +47,7 @@ impl Cache { pub fn predecessors( &self, - mir: &Mir<'_> + mir: &Body<'_> ) -> MappedReadGuard<'_, IndexVec>> { if self.predecessors.borrow().is_none() { *self.predecessors.borrow_mut() = Some(calculate_predecessors(mir)); @@ -57,7 +57,7 @@ impl Cache { } } -fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec> { +fn calculate_predecessors(mir: &Body<'_>) -> IndexVec> { let mut result = IndexVec::from_elem(vec![], mir.basic_blocks()); for (bb, data) in mir.basic_blocks().iter_enumerated() { if let Some(ref term) = data.terminator { diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 2c619a7a25027..9fec661c0a6fb 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -47,7 +47,7 @@ pub struct GlobalId<'tcx> { /// For a promoted global, the `Instance` of the function they belong to. pub instance: ty::Instance<'tcx>, - /// The index for promoted globals within their function's `Mir`. + /// The index for promoted globals within their function's `Body`. pub promoted: Option, } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index bf2a1eaafd664..3d436e34d17b9 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -60,7 +60,7 @@ impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> { } } -impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> { +impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> { fn local_decls(&self) -> &LocalDecls<'tcx> { &self.local_decls } @@ -86,7 +86,7 @@ impl MirPhase { /// Lowered representation of a single function. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct Mir<'tcx> { +pub struct Body<'tcx> { /// List of basic blocks. References to basic block use a newtyped index type `BasicBlock` /// that indexes into this vector. basic_blocks: IndexVec>, @@ -107,15 +107,15 @@ pub struct Mir<'tcx> { pub source_scope_local_data: ClearCrossCrate>, /// Rvalues promoted from this function, such as borrows of constants. - /// Each of them is the Mir of a constant with the fn's type parameters + /// Each of them is the Body of a constant with the fn's type parameters /// in scope, but a separate set of locals. - pub promoted: IndexVec>, + pub promoted: IndexVec>, /// Yields type of the function, if it is a generator. pub yield_ty: Option>, /// Generator drop glue - pub generator_drop: Option>>, + pub generator_drop: Option>>, /// The layout of a generator. Produced by the state transformation. pub generator_layout: Option>, @@ -167,12 +167,12 @@ pub struct Mir<'tcx> { cache: cache::Cache, } -impl<'tcx> Mir<'tcx> { +impl<'tcx> Body<'tcx> { pub fn new( basic_blocks: IndexVec>, source_scopes: IndexVec, source_scope_local_data: ClearCrossCrate>, - promoted: IndexVec>, + promoted: IndexVec>, yield_ty: Option>, local_decls: LocalDecls<'tcx>, user_type_annotations: CanonicalUserTypeAnnotations<'tcx>, @@ -189,7 +189,7 @@ impl<'tcx> Mir<'tcx> { local_decls.len() ); - Mir { + Body { phase: MirPhase::Build, basic_blocks, source_scopes, @@ -423,7 +423,7 @@ pub enum Safety { ExplicitUnsafe(hir::HirId), } -impl_stable_hash_for!(struct Mir<'tcx> { +impl_stable_hash_for!(struct Body<'tcx> { phase, basic_blocks, source_scopes, @@ -442,7 +442,7 @@ impl_stable_hash_for!(struct Mir<'tcx> { cache }); -impl<'tcx> Index for Mir<'tcx> { +impl<'tcx> Index for Body<'tcx> { type Output = BasicBlockData<'tcx>; #[inline] @@ -451,7 +451,7 @@ impl<'tcx> Index for Mir<'tcx> { } } -impl<'tcx> IndexMut for Mir<'tcx> { +impl<'tcx> IndexMut for Body<'tcx> { #[inline] fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> { &mut self.basic_blocks_mut()[index] @@ -599,7 +599,7 @@ newtype_index! { } } -/// Classifies locals into categories. See `Mir::local_kind`. +/// Classifies locals into categories. See `Body::local_kind`. #[derive(PartialEq, Eq, Debug, HashStable)] pub enum LocalKind { /// User-declared variable binding @@ -2853,23 +2853,23 @@ fn def_path_str(def_id: DefId) -> String { ty::tls::with(|tcx| tcx.def_path_str(def_id)) } -impl<'tcx> graph::DirectedGraph for Mir<'tcx> { +impl<'tcx> graph::DirectedGraph for Body<'tcx> { type Node = BasicBlock; } -impl<'tcx> graph::WithNumNodes for Mir<'tcx> { +impl<'tcx> graph::WithNumNodes for Body<'tcx> { fn num_nodes(&self) -> usize { self.basic_blocks.len() } } -impl<'tcx> graph::WithStartNode for Mir<'tcx> { +impl<'tcx> graph::WithStartNode for Body<'tcx> { fn start_node(&self) -> Self::Node { START_BLOCK } } -impl<'tcx> graph::WithPredecessors for Mir<'tcx> { +impl<'tcx> graph::WithPredecessors for Body<'tcx> { fn predecessors<'graph>( &'graph self, node: Self::Node, @@ -2878,7 +2878,7 @@ impl<'tcx> graph::WithPredecessors for Mir<'tcx> { } } -impl<'tcx> graph::WithSuccessors for Mir<'tcx> { +impl<'tcx> graph::WithSuccessors for Body<'tcx> { fn successors<'graph>( &'graph self, node: Self::Node, @@ -2887,12 +2887,12 @@ impl<'tcx> graph::WithSuccessors for Mir<'tcx> { } } -impl<'a, 'b> graph::GraphPredecessors<'b> for Mir<'a> { +impl<'a, 'b> graph::GraphPredecessors<'b> for Body<'a> { type Item = BasicBlock; type Iter = IntoIter; } -impl<'a, 'b> graph::GraphSuccessors<'b> for Mir<'a> { +impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> { type Item = BasicBlock; type Iter = iter::Cloned>; } @@ -2931,7 +2931,7 @@ impl Location { } /// Returns `true` if `other` is earlier in the control flow graph than `self`. - pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Mir<'tcx>) -> bool { + pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Body<'tcx>) -> bool { // If we are in the same block as the other location and are an earlier statement // then we are a predecessor of `other`. if self.block == other.block && self.statement_index < other.statement_index { @@ -3165,7 +3165,7 @@ CloneTypeFoldableAndLiftImpls! { } BraceStructTypeFoldableImpl! { - impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> { + impl<'tcx> TypeFoldable<'tcx> for Body<'tcx> { phase, basic_blocks, source_scopes, diff --git a/src/librustc/mir/traversal.rs b/src/librustc/mir/traversal.rs index f8398c27cc2da..75d995d801d78 100644 --- a/src/librustc/mir/traversal.rs +++ b/src/librustc/mir/traversal.rs @@ -21,14 +21,14 @@ use super::*; /// A preorder traversal of this graph is either `A B D C` or `A C D B` #[derive(Clone)] pub struct Preorder<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, visited: BitSet, worklist: Vec, root_is_start_block: bool, } impl<'a, 'tcx> Preorder<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> { + pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> { let worklist = vec![root]; Preorder { @@ -40,7 +40,7 @@ impl<'a, 'tcx> Preorder<'a, 'tcx> { } } -pub fn preorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Preorder<'a, 'tcx> { +pub fn preorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Preorder<'a, 'tcx> { Preorder::new(mir, START_BLOCK) } @@ -99,14 +99,14 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> { /// /// A Postorder traversal of this graph is `D B C A` or `D C B A` pub struct Postorder<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, visited: BitSet, visit_stack: Vec<(BasicBlock, Successors<'a>)>, root_is_start_block: bool, } impl<'a, 'tcx> Postorder<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> { + pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> { let mut po = Postorder { mir, visited: BitSet::new_empty(mir.basic_blocks().len()), @@ -194,7 +194,7 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> { } } -pub fn postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Postorder<'a, 'tcx> { +pub fn postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Postorder<'a, 'tcx> { Postorder::new(mir, START_BLOCK) } @@ -252,13 +252,13 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// to re-use the traversal #[derive(Clone)] pub struct ReversePostorder<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, blocks: Vec, idx: usize } impl<'a, 'tcx> ReversePostorder<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> { + pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> { let blocks : Vec<_> = Postorder::new(mir, root).map(|(bb, _)| bb).collect(); let len = blocks.len(); @@ -276,7 +276,7 @@ impl<'a, 'tcx> ReversePostorder<'a, 'tcx> { } -pub fn reverse_postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> ReversePostorder<'a, 'tcx> { +pub fn reverse_postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> ReversePostorder<'a, 'tcx> { ReversePostorder::new(mir, START_BLOCK) } diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index b04c28cde571c..6cb2a42c4cb5a 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -72,7 +72,7 @@ macro_rules! make_mir_visitor { // Override these, and call `self.super_xxx` to revert back to the // default behavior. - fn visit_mir(&mut self, mir: & $($mutability)? Mir<'tcx>) { + fn visit_mir(&mut self, mir: & $($mutability)? Body<'tcx>) { self.super_mir(mir); } @@ -269,7 +269,7 @@ macro_rules! make_mir_visitor { // not meant to be overridden. fn super_mir(&mut self, - mir: & $($mutability)? Mir<'tcx>) { + mir: & $($mutability)? Body<'tcx>) { if let Some(yield_ty) = &$($mutability)? mir.yield_ty { self.visit_ty(yield_ty, TyContext::YieldTy(SourceInfo { span: mir.span, @@ -278,7 +278,7 @@ macro_rules! make_mir_visitor { } // for best performance, we want to use an iterator rather - // than a for-loop, to avoid calling Mir::invalidate for + // than a for-loop, to avoid calling Body::invalidate for // each basic block. macro_rules! basic_blocks { (mut) => (mir.basic_blocks_mut().iter_enumerated_mut()); @@ -886,7 +886,7 @@ macro_rules! make_mir_visitor { // Convenience methods - fn visit_location(&mut self, mir: & $($mutability)? Mir<'tcx>, location: Location) { + fn visit_location(&mut self, mir: & $($mutability)? Body<'tcx>, location: Location) { let basic_block = & $($mutability)? mir[location.block]; if basic_block.statements.len() == location.statement_index { if let Some(ref $($mutability)? terminator) = basic_block.terminator { diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index 1861420b408b6..721b33abd7e51 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -88,7 +88,7 @@ rustc_queries! { desc { "getting a list of all mir_keys" } } - /// Maps DefId's that have an associated Mir to the result + /// Maps DefId's that have an associated Body to the result /// of the MIR qualify_consts pass. The actual meaning of /// the value isn't known except to the pass itself. query mir_const_qualif(key: DefId) -> (u8, Lrc>) { @@ -97,26 +97,26 @@ rustc_queries! { /// Fetch the MIR for a given `DefId` right after it's built - this includes /// unreachable code. - query mir_built(_: DefId) -> &'tcx Steal> {} + query mir_built(_: DefId) -> &'tcx Steal> {} /// Fetch the MIR for a given `DefId` up till the point where it is /// ready for const evaluation. /// /// See the README for the `mir` module for details. - query mir_const(_: DefId) -> &'tcx Steal> { + query mir_const(_: DefId) -> &'tcx Steal> { no_hash } - query mir_validated(_: DefId) -> &'tcx Steal> { + query mir_validated(_: DefId) -> &'tcx Steal> { no_hash } /// MIR after our optimization passes have run. This is MIR that is ready /// for codegen. This is also the only query that can fetch non-local MIR, at present. - query optimized_mir(key: DefId) -> &'tcx mir::Mir<'tcx> { + query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> { cache { key.is_local() } load_cached(tcx, id) { - let mir: Option> = tcx.queries.on_disk_cache + let mir: Option> = tcx.queries.on_disk_cache .try_load_query_result(tcx, id); mir.map(|x| tcx.alloc_mir(x)) } @@ -458,7 +458,7 @@ rustc_queries! { /// in the case of closures, this will be redirected to the enclosing function. query region_scope_tree(_: DefId) -> Lrc {} - query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx> { + query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Body<'tcx> { no_force desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) } } diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index cb307800fcdc2..b0290acc75c67 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -141,7 +141,7 @@ pub enum OutputType { Bitcode, Assembly, LlvmAssembly, - Mir, + Body, Metadata, Object, Exe, @@ -157,7 +157,7 @@ impl OutputType { OutputType::Bitcode | OutputType::Assembly | OutputType::LlvmAssembly - | OutputType::Mir + | OutputType::Body | OutputType::Object | OutputType::Metadata => false, } @@ -168,7 +168,7 @@ impl OutputType { OutputType::Bitcode => "llvm-bc", OutputType::Assembly => "asm", OutputType::LlvmAssembly => "llvm-ir", - OutputType::Mir => "mir", + OutputType::Body => "mir", OutputType::Object => "obj", OutputType::Metadata => "metadata", OutputType::Exe => "link", @@ -180,7 +180,7 @@ impl OutputType { Some(match shorthand { "asm" => OutputType::Assembly, "llvm-ir" => OutputType::LlvmAssembly, - "mir" => OutputType::Mir, + "mir" => OutputType::Body, "llvm-bc" => OutputType::Bitcode, "obj" => OutputType::Object, "metadata" => OutputType::Metadata, @@ -196,7 +196,7 @@ impl OutputType { OutputType::Bitcode.shorthand(), OutputType::Assembly.shorthand(), OutputType::LlvmAssembly.shorthand(), - OutputType::Mir.shorthand(), + OutputType::Body.shorthand(), OutputType::Object.shorthand(), OutputType::Metadata.shorthand(), OutputType::Exe.shorthand(), @@ -209,7 +209,7 @@ impl OutputType { OutputType::Bitcode => "bc", OutputType::Assembly => "s", OutputType::LlvmAssembly => "ll", - OutputType::Mir => "mir", + OutputType::Body => "mir", OutputType::Object => "o", OutputType::Metadata => "rmeta", OutputType::DepInfo => "d", @@ -276,7 +276,7 @@ impl OutputTypes { OutputType::Bitcode | OutputType::Assembly | OutputType::LlvmAssembly - | OutputType::Mir + | OutputType::Body | OutputType::Object | OutputType::Exe => true, OutputType::Metadata | OutputType::DepInfo => false, @@ -460,7 +460,7 @@ pub enum PrintRequest { #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum BorrowckMode { - Mir, + Body, Compare, Migrate, } @@ -471,7 +471,7 @@ impl BorrowckMode { pub fn migrate(self) -> bool { match self { BorrowckMode::Compare => false, - BorrowckMode::Mir => false, + BorrowckMode::Body => false, BorrowckMode::Migrate => true, } } @@ -480,7 +480,7 @@ impl BorrowckMode { pub fn use_ast(self) -> bool { match self { BorrowckMode::Compare => true, - BorrowckMode::Mir => false, + BorrowckMode::Body => false, BorrowckMode::Migrate => false, } } @@ -2315,7 +2315,7 @@ pub fn build_session_options_and_crate_config( let borrowck_mode = match debugging_opts.borrowck.as_ref().map(|s| &s[..]) { None | Some("migrate") => BorrowckMode::Migrate, - Some("mir") => BorrowckMode::Mir, + Some("mir") => BorrowckMode::Body, Some("compare") => BorrowckMode::Compare, Some(m) => early_error(error_format, &format!("unknown borrowck mode `{}`", m)), }; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ed500d1ac3351..aa06fc75bd9b1 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -21,7 +21,7 @@ use crate::middle::cstore::EncodedMetadata; use crate::middle::lang_items; use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use crate::middle::stability; -use crate::mir::{self, Mir, interpret, ProjectionKind}; +use crate::mir::{self, Body, interpret, ProjectionKind}; use crate::mir::interpret::{ConstValue, Allocation}; use crate::ty::subst::{Kind, InternalSubsts, SubstsRef, Subst}; use crate::ty::ReprOptions; @@ -100,8 +100,8 @@ pub struct GlobalArenas<'tcx> { generics: TypedArena, trait_def: TypedArena, adt_def: TypedArena, - steal_mir: TypedArena>>, - mir: TypedArena>, + steal_mir: TypedArena>>, + mir: TypedArena>, tables: TypedArena>, /// miri allocations const_allocs: TypedArena, @@ -1106,11 +1106,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.global_arenas.generics.alloc(generics) } - pub fn alloc_steal_mir(self, mir: Mir<'gcx>) -> &'gcx Steal> { + pub fn alloc_steal_mir(self, mir: Body<'gcx>) -> &'gcx Steal> { self.global_arenas.steal_mir.alloc(Steal::new(mir)) } - pub fn alloc_mir(self, mir: Mir<'gcx>) -> &'gcx Mir<'gcx> { + pub fn alloc_mir(self, mir: Body<'gcx>) -> &'gcx Body<'gcx> { self.global_arenas.mir.alloc(mir) } @@ -1554,7 +1554,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // // * Otherwise, use the behavior requested via `-Z borrowck=...` - if self.features().nll { return BorrowckMode::Mir; } + if self.features().nll { return BorrowckMode::Body; } self.sess.opts.borrowck_mode } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 67be228d232e1..d437553f1a2f2 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -17,7 +17,7 @@ use crate::ich::StableHashingContext; use crate::infer::canonical::Canonical; use crate::middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem}; use crate::middle::resolve_lifetime::ObjectLifetimeDefault; -use crate::mir::Mir; +use crate::mir::Body; use crate::mir::interpret::{GlobalId, ErrorHandled}; use crate::mir::GeneratorLayout; use crate::session::CrateDisambiguator; @@ -2995,7 +2995,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Returns the possibly-auto-generated MIR of a `(DefId, Subst)` pair. pub fn instance_mir(self, instance: ty::InstanceDef<'gcx>) - -> &'gcx Mir<'gcx> + -> &'gcx Body<'gcx> { match instance { ty::InstanceDef::Item(did) => { diff --git a/src/librustc/ty/steal.rs b/src/librustc/ty/steal.rs index a8f9301ba51c9..a5a0b198734c1 100644 --- a/src/librustc/ty/steal.rs +++ b/src/librustc/ty/steal.rs @@ -9,7 +9,7 @@ use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard}; /// queries are these pure functions that produce an immutable value /// (since if you did the query twice, you could observe the /// mutations). So instead we have the query produce a `&'tcx -/// Steal>` (to be very specific). Now we can read from this +/// Steal>` (to be very specific). Now we can read from this /// as much as we want (using `borrow()`), but you can also /// `steal()`. Once you steal, any further attempt to read will panic. /// Therefore, we know that -- assuming no ICE -- nobody is observing diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index c8ddf733ecf1f..8b3ed5b0c623a 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -5,7 +5,7 @@ use super::utils::{DIB, span_start}; use crate::llvm; use crate::llvm::debuginfo::{DIScope, DISubprogram}; use crate::common::CodegenCx; -use rustc::mir::{Mir, SourceScope}; +use rustc::mir::{Body, SourceScope}; use libc::c_uint; @@ -20,7 +20,7 @@ use syntax_pos::BytePos; /// If debuginfo is disabled, the returned vector is empty. pub fn create_mir_scopes( cx: &CodegenCx<'ll, '_>, - mir: &Mir<'_>, + mir: &Body<'_>, debug_context: &FunctionDebugContext<&'ll DISubprogram>, ) -> IndexVec> { let null_scope = MirDebugScope { @@ -55,7 +55,7 @@ pub fn create_mir_scopes( } fn make_mir_scope(cx: &CodegenCx<'ll, '_>, - mir: &Mir<'_>, + mir: &Body<'_>, has_variables: &BitSet, debug_context: &FunctionDebugContextData<&'ll DISubprogram>, scope: SourceScope, diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index cb00cca0f9c96..f1dde2e3cb893 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -239,7 +239,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { instance: Instance<'tcx>, sig: ty::FnSig<'tcx>, llfn: &'ll Value, - mir: &mir::Mir<'_>, + mir: &mir::Body<'_>, ) -> FunctionDebugContext<&'ll DISubprogram> { if self.sess().opts.debuginfo == DebugInfo::None { return FunctionDebugContext::DebugInfoDisabled; @@ -523,7 +523,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn create_mir_scopes( &self, - mir: &mir::Mir<'_>, + mir: &mir::Body<'_>, debug_context: &mut FunctionDebugContext<&'ll DISubprogram>, ) -> IndexVec> { create_scope_map::create_mir_scopes(self, mir, debug_context) diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 88a5e5a1aec3b..430f96fe88c5b 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -473,7 +473,7 @@ pub fn start_async_codegen( metadata_config.emit_obj = true; allocator_config.emit_obj = true; }, - OutputType::Mir => {} + OutputType::Body => {} OutputType::DepInfo => {} } } @@ -625,7 +625,7 @@ fn produce_final_output_artifacts(sess: &Session, user_wants_objects = true; copy_if_one_unit(OutputType::Object, true); } - OutputType::Mir | + OutputType::Body | OutputType::Metadata | OutputType::Exe | OutputType::DepInfo => {} diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 8253a1672454d..507933a236c05 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -275,9 +275,9 @@ impl CleanupKind { } } -pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec { +pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Body<'tcx>) -> IndexVec { fn discover_masters<'tcx>(result: &mut IndexVec, - mir: &mir::Mir<'tcx>) { + mir: &mir::Body<'tcx>) { for (bb, data) in mir.basic_blocks().iter_enumerated() { match data.terminator().kind { TerminatorKind::Goto { .. } | @@ -307,7 +307,7 @@ pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec(result: &mut IndexVec, - mir: &mir::Mir<'tcx>) { + mir: &mir::Body<'tcx>) { let mut funclet_succs = IndexVec::from_elem(None, mir.basic_blocks()); let mut set_successor = |funclet: mir::BasicBlock, succ| { diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 621c4e5d4488e..aec340ffca6cd 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -1,6 +1,6 @@ use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts}; use rustc::ty::layout::{TyLayout, HasTyCtxt}; -use rustc::mir::{self, Mir}; +use rustc::mir::{self, Body}; use rustc::session::config::DebugInfo; use rustc_mir::monomorphize::Instance; use rustc_target::abi::call::{FnType, PassMode, IgnoreMode}; @@ -26,7 +26,7 @@ use self::operand::{OperandRef, OperandValue}; pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { instance: Instance<'tcx>, - mir: &'a mir::Mir<'tcx>, + mir: &'a mir::Body<'tcx>, debug_context: FunctionDebugContext, @@ -195,7 +195,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> LocalRef<'tcx, V> { pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, llfn: Bx::Value, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, instance: Instance<'tcx>, sig: ty::FnSig<'tcx>, ) { @@ -359,7 +359,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, bx: &mut Bx, cleanup_kinds: &IndexVec, block_bxs: &IndexVec) diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index aadffc5932ba8..37b7a15e2ba5e 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -22,12 +22,12 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes { instance: Instance<'tcx>, sig: ty::FnSig<'tcx>, llfn: Self::Value, - mir: &mir::Mir<'_>, + mir: &mir::Body<'_>, ) -> FunctionDebugContext; fn create_mir_scopes( &self, - mir: &mir::Mir<'_>, + mir: &mir::Body<'_>, debug_context: &mut FunctionDebugContext, ) -> IndexVec>; fn extend_scope_to_file( diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index f8b1271b8b5c6..9387738a6577e 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -1025,7 +1025,7 @@ pub fn start_codegen<'tcx>( tcx.print_debug_stats(); } - if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) { + if tcx.sess.opts.output_types.contains_key(&OutputType::Body) { if let Err(e) = mir::transform::dump_mir::emit_mir(tcx, outputs) { tcx.sess.err(&format!("could not emit MIR: {}", e)); tcx.sess.abort_if_errors(); diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 0e3d05d29a3da..0278291ada8ef 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -19,7 +19,7 @@ use rustc::mir::interpret::AllocDecodingSession; use rustc::session::Session; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::codec::TyDecoder; -use rustc::mir::Mir; +use rustc::mir::Body; use rustc::util::captures::Captures; use std::io; @@ -879,7 +879,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn maybe_get_optimized_mir(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefIndex) - -> Option> { + -> Option> { match self.is_proc_macro(id) { true => None, false => self.entry(id).mir.map(|mir| mir.decode((self, tcx))), diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index a0f17a55a8756..eeeffb95eabd2 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1047,7 +1047,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { self.lazy_seq(param_names.iter().map(|ident| ident.name)) } - fn encode_optimized_mir(&mut self, def_id: DefId) -> Option>> { + fn encode_optimized_mir(&mut self, def_id: DefId) -> Option>> { debug!("EntryBuilder::encode_mir({:?})", def_id); if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) { let mir = self.tcx.optimized_mir(def_id); diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 504c7da7d6b9e..addacb52bdaac 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -268,7 +268,7 @@ pub struct Entry<'tcx> { pub predicates: Option>>, pub predicates_defined_on: Option>>, - pub mir: Option>>, + pub mir: Option>>, } impl_stable_hash_for!(struct Entry<'tcx> { diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 918192395c3f4..3e1935ecfae2d 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -4,7 +4,7 @@ use crate::dataflow::indexes::BorrowIndex; use crate::dataflow::move_paths::MoveData; use rustc::mir::traversal; use rustc::mir::visit::{PlaceContext, Visitor, NonUseContext, MutatingUseContext}; -use rustc::mir::{self, Location, Mir, Local}; +use rustc::mir::{self, Location, Body, Local}; use rustc::ty::{RegionVid, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::IndexVec; @@ -89,7 +89,7 @@ crate enum LocalsStateAtExit { impl LocalsStateAtExit { fn build( locals_are_invalidated_at_exit: bool, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx> ) -> Self { struct HasStorageDead(BitSet); @@ -122,7 +122,7 @@ impl LocalsStateAtExit { impl<'tcx> BorrowSet<'tcx> { pub fn build( tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, locals_are_invalidated_at_exit: bool, move_data: &MoveData<'tcx> ) -> Self { @@ -162,7 +162,7 @@ impl<'tcx> BorrowSet<'tcx> { struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, idx_vec: IndexVec>, location_map: FxHashMap, activation_map: FxHashMap>, diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 12dcea7bd5981..8a8ba8de1c551 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -91,7 +91,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { desired_action.as_noun(), &self.describe_place_with_options(moved_place, IncludingDowncast(true)) .unwrap_or_else(|| "_".to_owned()), - Origin::Mir, + Origin::Body, ); err.span_label(span, format!("use of possibly uninitialized {}", item_msg)); @@ -122,7 +122,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { desired_action.as_noun(), msg, self.describe_place_with_options(&moved_place, IncludingDowncast(true)), - Origin::Mir, + Origin::Body, ); self.add_moved_or_invoked_closure_note( @@ -289,7 +289,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut err = tcx.cannot_move_when_borrowed( span, &self.describe_place(place).unwrap_or_else(|| "_".to_owned()), - Origin::Mir, + Origin::Body, ); err.span_label(borrow_span, format!("borrow of {} occurs here", borrow_msg)); err.span_label(span, format!("move out of {} occurs here", value_msg)); @@ -334,7 +334,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { borrow_span, &self.describe_place(&borrow.borrowed_place) .unwrap_or_else(|| "_".to_owned()), - Origin::Mir, + Origin::Body, ); borrow_spans.var_span_label(&mut err, { @@ -401,7 +401,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { rgt, &msg_borrow, None, - Origin::Mir, + Origin::Body, ) } (BorrowKind::Mut { .. }, _, lft, BorrowKind::Shared, rgt, _) => { @@ -416,7 +416,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { rgt, &msg_borrow, None, - Origin::Mir, + Origin::Body, ) } @@ -429,7 +429,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, &msg_borrow, None, - Origin::Mir, + Origin::Body, ) } @@ -440,7 +440,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { &desc_place, issued_span, None, - Origin::Mir, + Origin::Body, ) } @@ -451,7 +451,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, &desc_place, "mutably borrow", - Origin::Mir, + Origin::Body, ); borrow_spans.var_span_label( &mut err, @@ -474,7 +474,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "it", "", None, - Origin::Mir, + Origin::Body, ) }, @@ -490,7 +490,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "", None, second_borrow_desc, - Origin::Mir, + Origin::Body, ) } @@ -506,7 +506,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "", None, second_borrow_desc, - Origin::Mir, + Origin::Body, ) } @@ -843,7 +843,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut err = self.infcx.tcx.path_does_not_live_long_enough( borrow_span, &format!("`{}`", name), - Origin::Mir, + Origin::Body, ); if let Some(annotation) = self.annotate_argument_and_return_for_borrow(borrow) { @@ -933,7 +933,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut err = self.infcx .tcx - .cannot_borrow_across_destructor(borrow_span, Origin::Mir); + .cannot_borrow_across_destructor(borrow_span, Origin::Body); let what_was_dropped = match self.describe_place(place) { Some(name) => format!("`{}`", name.as_str()), @@ -986,7 +986,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut err = self.infcx .tcx - .thread_local_value_does_not_live_long_enough(borrow_span, Origin::Mir); + .thread_local_value_does_not_live_long_enough(borrow_span, Origin::Body); err.span_label( borrow_span, @@ -1029,7 +1029,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } let tcx = self.infcx.tcx; - let mut err = tcx.temporary_value_borrowed_for_too_long(proper_span, Origin::Mir); + let mut err = tcx.temporary_value_borrowed_for_too_long(proper_span, Origin::Body); err.span_label( proper_span, "creates a temporary which is freed while still in use", @@ -1133,7 +1133,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { return_span, reference_desc, &place_desc, - Origin::Mir, + Origin::Body, ); if return_span != borrow_span { @@ -1158,7 +1158,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { args_span, captured_var, var_span, - Origin::Mir, + Origin::Body, ); let suggestion = match tcx.sess.source_map().span_to_snippet(args_span) { @@ -1214,7 +1214,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "function" }; - let mut err = tcx.borrowed_data_escapes_closure(escape_span, escapes_from, Origin::Mir); + let mut err = tcx.borrowed_data_escapes_closure(escape_span, escapes_from, Origin::Body); err.span_label( upvar_span, @@ -1363,7 +1363,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { loan_span, &self.describe_place(place).unwrap_or_else(|| "_".to_owned()), "assign", - Origin::Mir, + Origin::Body, ); loan_spans.var_span_label( &mut err, @@ -1379,7 +1379,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { span, loan_span, &self.describe_place(place).unwrap_or_else(|| "_".to_owned()), - Origin::Mir, + Origin::Body, ); loan_spans.var_span_label( @@ -1444,7 +1444,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { span, place_description.as_ref().map(AsRef::as_ref).unwrap_or("_"), from_arg, - Origin::Mir, + Origin::Body, ); let msg = if from_arg { "cannot assign to immutable argument" diff --git a/src/librustc_mir/borrow_check/location.rs b/src/librustc_mir/borrow_check/location.rs index 20a477576c95c..feade0d2a4aee 100644 --- a/src/librustc_mir/borrow_check/location.rs +++ b/src/librustc_mir/borrow_check/location.rs @@ -1,4 +1,4 @@ -use rustc::mir::{BasicBlock, Location, Mir}; +use rustc::mir::{BasicBlock, Location, Body}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; /// Maps between a MIR Location, which identifies a particular @@ -30,7 +30,7 @@ crate enum RichLocation { } impl LocationTable { - crate fn new(mir: &Mir<'_>) -> Self { + crate fn new(mir: &Body<'_>) -> Self { let mut num_points = 0; let statements_before_block = mir.basic_blocks() .iter() diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 14cafdef67d7d..0429ab06fe086 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -10,7 +10,7 @@ use rustc::lint::builtin::{MUTABLE_BORROW_RESERVATION_CONFLICT}; use rustc::middle::borrowck::SignalledError; use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; use rustc::mir::{ - ClearCrossCrate, Local, Location, Mir, Mutability, Operand, Place, PlaceBase, Static, StaticKind + ClearCrossCrate, Local, Location, Body, Mutability, Operand, Place, PlaceBase, Static, StaticKind }; use rustc::mir::{Field, Projection, ProjectionElem, Rvalue, Statement, StatementKind}; use rustc::mir::{Terminator, TerminatorKind}; @@ -117,7 +117,7 @@ fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> BorrowC } let opt_closure_req = tcx.infer_ctxt().enter(|infcx| { - let input_mir: &Mir<'_> = &input_mir.borrow(); + let input_mir: &Body<'_> = &input_mir.borrow(); do_mir_borrowck(&infcx, input_mir, def_id) }); debug!("mir_borrowck done"); @@ -127,7 +127,7 @@ fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> BorrowC fn do_mir_borrowck<'a, 'gcx, 'tcx>( infcx: &InferCtxt<'a, 'gcx, 'tcx>, - input_mir: &Mir<'gcx>, + input_mir: &Body<'gcx>, def_id: DefId, ) -> BorrowCheckResult<'gcx> { debug!("do_mir_borrowck(def_id = {:?})", def_id); @@ -174,7 +174,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( // requires first making our own copy of the MIR. This copy will // be modified (in place) to contain non-lexical lifetimes. It // will have a lifetime tied to the inference context. - let mut mir: Mir<'tcx> = input_mir.clone(); + let mut mir: Body<'tcx> = input_mir.clone(); let free_regions = nll::replace_regions_in_mir(infcx, def_id, param_env, &mut mir); let mir = &mir; // no further changes let location_table = &LocationTable::new(mir); @@ -448,7 +448,7 @@ fn downgrade_if_error(diag: &mut Diagnostic) { pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> { infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, - mir: &'cx Mir<'tcx>, + mir: &'cx Body<'tcx>, mir_def_id: DefId, move_data: &'cx MoveData<'tcx>, @@ -534,7 +534,7 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> { impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'gcx, 'tcx> { type FlowState = Flows<'cx, 'gcx, 'tcx>; - fn mir(&self) -> &'cx Mir<'tcx> { + fn mir(&self) -> &'cx Body<'tcx> { self.mir } @@ -1531,7 +1531,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { .cannot_borrow_across_generator_yield( self.retrieve_borrow_spans(borrow).var_or_use(), yield_span, - Origin::Mir, + Origin::Body, ); err.buffer(&mut self.errors_buffer); diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index a7bad44c42c7f..379d6cfb45f46 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -253,7 +253,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { (span, original_path, kind) }, }; - let origin = Origin::Mir; + let origin = Origin::Body; debug!("report: original_path={:?} span={:?}, kind={:?} \ original_path.is_upvar_field_projection={:?}", original_path, span, kind, self.is_upvar_field_projection(original_path)); diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index c5ad2b18c23fc..9e2c41956ed07 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -1,6 +1,6 @@ use rustc::hir; use rustc::hir::Node; -use rustc::mir::{self, BindingForm, Constant, ClearCrossCrate, Local, Location, Mir}; +use rustc::mir::{self, BindingForm, Constant, ClearCrossCrate, Local, Location, Body}; use rustc::mir::{ Mutability, Operand, Place, PlaceBase, Projection, ProjectionElem, Static, StaticKind, }; @@ -172,14 +172,14 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { let span = match error_access { AccessKind::Move => { err = self.infcx.tcx - .cannot_move_out_of(span, &(item_msg + &reason), Origin::Mir); + .cannot_move_out_of(span, &(item_msg + &reason), Origin::Body); err.span_label(span, "cannot move"); err.buffer(&mut self.errors_buffer); return; } AccessKind::Mutate => { err = self.infcx.tcx - .cannot_assign(span, &(item_msg + &reason), Origin::Mir); + .cannot_assign(span, &(item_msg + &reason), Origin::Body); act = "assign"; acted_on = "written"; span @@ -194,7 +194,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { borrow_span, &item_msg, &reason, - Origin::Mir, + Origin::Body, ); borrow_spans.var_span_label( &mut err, @@ -559,7 +559,7 @@ fn suggest_ampmut_self<'cx, 'gcx, 'tcx>( // by trying (3.), then (2.) and finally falling back on (1.). fn suggest_ampmut<'cx, 'gcx, 'tcx>( tcx: TyCtxt<'cx, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, local: Local, local_decl: &mir::LocalDecl<'tcx>, opt_ty_info: Option, diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index bf9cff1e4ae03..1c40f8e8bdf17 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -6,7 +6,7 @@ use crate::borrow_check::nll::region_infer::values::LivenessValues; use rustc::infer::InferCtxt; use rustc::mir::visit::TyContext; use rustc::mir::visit::Visitor; -use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, PlaceBase, Rvalue}; +use rustc::mir::{BasicBlock, BasicBlockData, Location, Body, Place, PlaceBase, Rvalue}; use rustc::mir::{SourceInfo, Statement, Terminator}; use rustc::mir::UserTypeProjection; use rustc::ty::fold::TypeFoldable; @@ -18,7 +18,7 @@ pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>( liveness_constraints: &mut LivenessValues, all_facts: &mut Option, location_table: &LocationTable, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, borrow_set: &BorrowSet<'tcx>, ) { let mut cg = ConstraintGeneration { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs index 7d6385752c348..9a3e51efc9fb8 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs @@ -5,12 +5,12 @@ use crate::borrow_check::nll::region_infer::{Cause, RegionInferenceContext}; use crate::borrow_check::nll::ToRegionVid; use crate::util::liveness::{self, DefUse}; use rustc::mir::visit::{MirVisitable, PlaceContext, Visitor}; -use rustc::mir::{Local, Location, Mir}; +use rustc::mir::{Local, Location, Body}; use rustc::ty::{RegionVid, TyCtxt}; use rustc_data_structures::fx::FxHashSet; crate fn find<'tcx>( - mir: &Mir<'tcx>, + mir: &Body<'tcx>, regioncx: &Rc>, tcx: TyCtxt<'_, '_, 'tcx>, region_vid: RegionVid, @@ -28,7 +28,7 @@ crate fn find<'tcx>( } struct UseFinder<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - mir: &'cx Mir<'tcx>, + mir: &'cx Body<'tcx>, regioncx: &'cx Rc>, tcx: TyCtxt<'cx, 'gcx, 'tcx>, region_vid: RegionVid, @@ -100,7 +100,7 @@ impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> { } struct DefUseVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - mir: &'cx Mir<'tcx>, + mir: &'cx Body<'tcx>, tcx: TyCtxt<'cx, 'gcx, 'tcx>, region_vid: RegionVid, def_use_result: Option, diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 89f85a941d386..7bc6008b1e4a0 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -6,7 +6,7 @@ use crate::borrow_check::nll::region_infer::{Cause, RegionName}; use crate::borrow_check::nll::ConstraintDescription; use crate::borrow_check::{Context, MirBorrowckCtxt, WriteKind}; use rustc::mir::{ - CastKind, ConstraintCategory, FakeReadCause, Local, Location, Mir, Operand, Place, PlaceBase, + CastKind, ConstraintCategory, FakeReadCause, Local, Location, Body, Operand, Place, PlaceBase, Projection, ProjectionElem, Rvalue, Statement, StatementKind, TerminatorKind, }; use rustc::ty::{self, TyCtxt}; @@ -54,7 +54,7 @@ impl BorrowExplanation { pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>( &self, tcx: TyCtxt<'cx, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, err: &mut DiagnosticBuilder<'_>, borrow_desc: &str, borrow_span: Option, diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 8cbf68c476a7e..fd3dc81568d6e 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -12,7 +12,7 @@ use crate::borrow_check::path_utils::*; use crate::dataflow::indexes::BorrowIndex; use rustc::ty::TyCtxt; use rustc::mir::visit::Visitor; -use rustc::mir::{BasicBlock, Location, Mir, Place, PlaceBase, Rvalue}; +use rustc::mir::{BasicBlock, Location, Body, Place, PlaceBase, Rvalue}; use rustc::mir::{Statement, StatementKind}; use rustc::mir::{Terminator, TerminatorKind}; use rustc::mir::{Operand, BorrowKind}; @@ -22,7 +22,7 @@ pub(super) fn generate_invalidates<'cx, 'gcx, 'tcx>( tcx: TyCtxt<'cx, 'gcx, 'tcx>, all_facts: &mut Option, location_table: &LocationTable, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, borrow_set: &BorrowSet<'tcx>, ) { if all_facts.is_none() { @@ -48,7 +48,7 @@ struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { tcx: TyCtxt<'cx, 'gcx, 'tcx>, all_facts: &'cx mut AllFacts, location_table: &'cx LocationTable, - mir: &'cx Mir<'tcx>, + mir: &'cx Body<'tcx>, dominators: Dominators, borrow_set: &'cx BorrowSet<'tcx>, } diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index ad43c8ef66f42..99bd38d7eda08 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -11,7 +11,7 @@ use crate::transform::MirSource; use crate::borrow_check::Upvar; use rustc::hir::def_id::DefId; use rustc::infer::InferCtxt; -use rustc::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, Mir}; +use rustc::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, Body}; use rustc::ty::{self, RegionKind, RegionVid}; use rustc_errors::Diagnostic; use std::fmt::Debug; @@ -49,7 +49,7 @@ pub(in crate::borrow_check) fn replace_regions_in_mir<'cx, 'gcx, 'tcx>( infcx: &InferCtxt<'cx, 'gcx, 'tcx>, def_id: DefId, param_env: ty::ParamEnv<'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, ) -> UniversalRegions<'tcx> { debug!("replace_regions_in_mir(def_id={:?})", def_id); @@ -72,7 +72,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( infcx: &InferCtxt<'cx, 'gcx, 'tcx>, def_id: DefId, universal_regions: UniversalRegions<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], location_table: &LocationTable, param_env: ty::ParamEnv<'gcx>, @@ -212,7 +212,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( fn dump_mir_results<'a, 'gcx, 'tcx>( infcx: &InferCtxt<'a, 'gcx, 'tcx>, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, regioncx: &RegionInferenceContext<'_>, closure_region_requirements: &Option>, ) { @@ -272,7 +272,7 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( fn dump_annotation<'a, 'gcx, 'tcx>( infcx: &InferCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, regioncx: &RegionInferenceContext<'tcx>, closure_region_requirements: &Option>, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index abb30d042ca4c..fbf891c163a30 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -9,7 +9,7 @@ use rustc::hir::def_id::DefId; use rustc::infer::error_reporting::nice_region_error::NiceRegionError; use rustc::infer::InferCtxt; use rustc::infer::NLLRegionVariableOrigin; -use rustc::mir::{ConstraintCategory, Location, Mir}; +use rustc::mir::{ConstraintCategory, Location, Body}; use rustc::ty::{self, RegionVid}; use rustc_data_structures::indexed_vec::IndexVec; use rustc_errors::{Diagnostic, DiagnosticBuilder}; @@ -62,7 +62,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// path to blame. fn best_blame_constraint( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, from_region: RegionVid, target_test: impl Fn(RegionVid) -> bool, ) -> (ConstraintCategory, bool, Span) { @@ -237,7 +237,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Here we would be invoked with `fr = 'a` and `outlived_fr = `'b`. pub(super) fn report_error( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], infcx: &InferCtxt<'_, '_, 'tcx>, mir_def_id: DefId, @@ -357,7 +357,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn report_fnmut_error( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], infcx: &InferCtxt<'_, '_, 'tcx>, mir_def_id: DefId, @@ -422,7 +422,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn report_escaping_data_error( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], infcx: &InferCtxt<'_, '_, 'tcx>, mir_def_id: DefId, @@ -467,7 +467,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mut diag = infcx .tcx - .borrowed_data_escapes_closure(span, escapes_from, Origin::Mir); + .borrowed_data_escapes_closure(span, escapes_from, Origin::Body); if let Some((Some(outlived_fr_name), outlived_fr_span)) = outlived_fr_name_and_span { diag.span_label( @@ -514,7 +514,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn report_general_error( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], infcx: &InferCtxt<'_, '_, 'tcx>, mir_def_id: DefId, @@ -667,7 +667,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { crate fn free_region_constraint_info( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, infcx: &InferCtxt<'_, '_, 'tcx>, @@ -721,7 +721,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Finds a good span to blame for the fact that `fr1` outlives `fr2`. crate fn find_outlives_blame_span( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, fr1: RegionVid, fr2: RegionVid, ) -> (ConstraintCategory, Span) { @@ -732,7 +732,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn retrieve_closure_constraint_info( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, constraint: &OutlivesConstraint, ) -> (ConstraintCategory, bool, Span) { let loc = match constraint.locations { diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 680e7ce576af0..7d5a3cf93d53f 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -6,7 +6,7 @@ use crate::borrow_check::Upvar; use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer::InferCtxt; -use rustc::mir::Mir; +use rustc::mir::Body; use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt}; use rustc::ty::print::RegionHighlightMode; @@ -144,7 +144,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { crate fn give_region_a_name( &self, infcx: &InferCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, fr: RegionVid, @@ -319,7 +319,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn give_name_if_anonymous_region_appears_in_arguments( &self, infcx: &InferCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, fr: RegionVid, counter: &mut usize, @@ -347,7 +347,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn give_name_if_we_can_match_hir_ty_from_argument( &self, infcx: &InferCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, needle_fr: RegionVid, argument_ty: Ty<'tcx>, @@ -393,7 +393,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn give_name_if_we_cannot_match_hir_ty( &self, infcx: &InferCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, needle_fr: RegionVid, argument_ty: Ty<'tcx>, counter: &mut usize, @@ -663,7 +663,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn give_name_if_anonymous_region_appears_in_output( &self, infcx: &InferCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, fr: RegionVid, counter: &mut usize, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index d8f34233839b9..c02a492c34100 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -1,7 +1,7 @@ use crate::borrow_check::nll::region_infer::RegionInferenceContext; use crate::borrow_check::nll::ToRegionVid; use crate::borrow_check::Upvar; -use rustc::mir::{Local, Mir}; +use rustc::mir::{Local, Body}; use rustc::ty::{RegionVid, TyCtxt}; use rustc_data_structures::indexed_vec::Idx; use syntax::source_map::Span; @@ -11,7 +11,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( &self, tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], fr: RegionVid, ) -> Option<(Option, Span)> { @@ -120,7 +120,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// declared. crate fn get_argument_name_and_span_for_region( &self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, argument_index: usize, ) -> (Option, Span) { let implicit_inputs = self.universal_regions.defining_ty.implicit_inputs(); diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 9dd18ab76a5f2..4a00571feb110 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -13,7 +13,7 @@ use rustc::infer::region_constraints::{GenericKind, VarInfos, VerifyBound}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin}; use rustc::mir::{ ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements, - ConstraintCategory, Local, Location, Mir, + ConstraintCategory, Local, Location, Body, }; use rustc::ty::{self, subst::SubstsRef, RegionVid, Ty, TyCtxt, TypeFoldable}; use rustc::util::common::{self, ErrorReported}; @@ -185,7 +185,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { universal_regions: Rc>, placeholder_indices: Rc, universal_region_relations: Rc>, - _mir: &Mir<'tcx>, + _mir: &Body<'tcx>, outlives_constraints: ConstraintSet, closure_bounds_mapping: FxHashMap< Location, @@ -400,7 +400,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { pub(super) fn solve<'gcx>( &mut self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, errors_buffer: &mut Vec, @@ -416,7 +416,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn solve_inner<'gcx>( &mut self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, errors_buffer: &mut Vec, @@ -468,7 +468,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// for each region variable until all the constraints are /// satisfied. Note that some values may grow **too** large to be /// feasible, but we check this later. - fn propagate_constraints(&mut self, _mir: &Mir<'tcx>) { + fn propagate_constraints(&mut self, _mir: &Body<'tcx>) { debug!("propagate_constraints()"); debug!("propagate_constraints: constraints={:#?}", { @@ -581,7 +581,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn check_type_tests<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, mut propagated_outlives_requirements: Option<&mut Vec>>, errors_buffer: &mut Vec, @@ -725,7 +725,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn try_promote_type_test<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, type_test: &TypeTest<'tcx>, propagated_outlives_requirements: &mut Vec>, ) -> bool { @@ -944,7 +944,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn eval_verify_bound( &self, tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, verify_bound: &VerifyBound<'tcx>, @@ -977,7 +977,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn eval_if_eq( &self, tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, test_ty: Ty<'tcx>, @@ -1037,7 +1037,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Evaluate whether `sup_region: sub_region @ point`. fn eval_outlives( &self, - _mir: &Mir<'tcx>, + _mir: &Body<'tcx>, sup_region: RegionVid, sub_region: RegionVid, ) -> bool { @@ -1105,7 +1105,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn check_universal_regions<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, mut propagated_outlives_requirements: Option<&mut Vec>>, @@ -1150,7 +1150,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn check_universal_region<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, longer_fr: RegionVid, @@ -1216,7 +1216,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { longer_fr: RegionVid, shorter_fr: RegionVid, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, upvars: &[Upvar], mir_def_id: DefId, propagated_outlives_requirements: &mut Option<&mut Vec>>, @@ -1282,7 +1282,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn check_bound_universal_region<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, _mir_def_id: DefId, longer_fr: RegionVid, placeholder: ty::PlaceholderRegion, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index 2101447965a15..8822d7bb37393 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -1,4 +1,4 @@ -use rustc::mir::{BasicBlock, Location, Mir}; +use rustc::mir::{BasicBlock, Location, Body}; use rustc::ty::{self, RegionVid}; use rustc_data_structures::bit_set::{HybridBitSet, SparseBitMatrix}; use rustc_data_structures::fx::FxHashMap; @@ -20,7 +20,7 @@ crate struct RegionValueElements { } impl RegionValueElements { - crate fn new(mir: &Mir<'_>) -> Self { + crate fn new(mir: &Body<'_>) -> Self { let mut num_points = 0; let statements_before_block: IndexVec = mir.basic_blocks() .iter() @@ -92,7 +92,7 @@ impl RegionValueElements { /// Pushes all predecessors of `index` onto `stack`. crate fn push_predecessors( &self, - mir: &Mir<'_>, + mir: &Body<'_>, index: PointIndex, stack: &mut Vec, ) { diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index 58e567c39a9bb..1b966ba86a6f1 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -1,12 +1,12 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable}; -use rustc::mir::{Location, Mir}; +use rustc::mir::{Location, Body}; use rustc::mir::visit::{MutVisitor, TyContext}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; /// Replaces all free regions appearing in the MIR with fresh /// inference variables, returning the number of variables created. -pub fn renumber_mir<'tcx>(infcx: &InferCtxt<'_, '_, 'tcx>, mir: &mut Mir<'tcx>) { +pub fn renumber_mir<'tcx>(infcx: &InferCtxt<'_, '_, 'tcx>, mir: &mut Body<'tcx>) { debug!("renumber_mir()"); debug!("renumber_mir: mir.arg_count={:?}", mir.arg_count); @@ -47,7 +47,7 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { - fn visit_mir(&mut self, mir: &mut Mir<'tcx>) { + fn visit_mir(&mut self, mir: &mut Body<'tcx>) { for promoted in mir.promoted.iter_mut() { self.visit_mir(promoted); } diff --git a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs index 50828c294fa1b..120088e1784d4 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs @@ -20,7 +20,7 @@ use super::{Locations, TypeChecker}; impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { pub(super) fn equate_inputs_and_outputs( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, universal_regions: &UniversalRegions<'tcx>, normalized_inputs_and_output: &[Ty<'tcx>], ) { diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs index 9b8940098852c..af0405f4f0a25 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs @@ -1,7 +1,7 @@ use crate::borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements}; use crate::util::liveness::{categorize, DefUse}; use rustc::mir::visit::{PlaceContext, Visitor}; -use rustc::mir::{Local, Location, Mir}; +use rustc::mir::{Local, Location, Body}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::vec_linked_list as vll; @@ -60,7 +60,7 @@ impl LocalUseMap { crate fn build( live_locals: &Vec, elements: &RegionValueElements, - mir: &Mir<'_>, + mir: &Body<'_>, ) -> Self { let nones = IndexVec::from_elem_n(None, mir.local_decls.len()); let mut local_use_map = LocalUseMap { diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index 960e75048fa16..9f782a28a62b4 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -7,7 +7,7 @@ use crate::borrow_check::nll::ToRegionVid; use crate::dataflow::move_paths::MoveData; use crate::dataflow::FlowAtLocation; use crate::dataflow::MaybeInitializedPlaces; -use rustc::mir::{Local, Mir}; +use rustc::mir::{Local, Body}; use rustc::ty::{RegionVid, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use std::rc::Rc; @@ -27,7 +27,7 @@ mod trace; /// performed before pub(super) fn generate<'gcx, 'tcx>( typeck: &mut TypeChecker<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, elements: &Rc, flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, @@ -78,7 +78,7 @@ pub(super) fn generate<'gcx, 'tcx>( fn compute_live_locals( tcx: TyCtxt<'_, '_, 'tcx>, free_regions: &FxHashSet, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ) -> Vec { let live_locals: Vec = mir .local_decls diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 4c4b4c0431927..91bf2274db723 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -7,7 +7,7 @@ use crate::dataflow::indexes::MovePathIndex; use crate::dataflow::move_paths::MoveData; use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces}; use rustc::infer::canonical::QueryRegionConstraint; -use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, Mir}; +use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, Body}; use rustc::traits::query::dropck_outlives::DropckOutlivesResult; use rustc::traits::query::type_op::outlives::DropckOutlives; use rustc::traits::query::type_op::TypeOp; @@ -32,7 +32,7 @@ use std::rc::Rc; /// this respects `#[may_dangle]` annotations). pub(super) fn trace( typeck: &mut TypeChecker<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, elements: &Rc, flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, @@ -72,7 +72,7 @@ where elements: &'me RegionValueElements, /// MIR we are analyzing. - mir: &'me Mir<'tcx>, + mir: &'me Body<'tcx>, /// Mapping to/from the various indices used for initialization tracking. move_data: &'me MoveData<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 0dee64db72763..b793e8f20b70e 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -113,7 +113,7 @@ mod relate_tys; pub(crate) fn type_check<'gcx, 'tcx>( infcx: &InferCtxt<'_, 'gcx, 'tcx>, param_env: ty::ParamEnv<'gcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mir_def_id: DefId, universal_regions: &Rc>, location_table: &LocationTable, @@ -182,7 +182,7 @@ fn type_check_internal<'a, 'gcx, 'tcx, R>( infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, mir_def_id: DefId, param_env: ty::ParamEnv<'gcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>, @@ -256,7 +256,7 @@ enum FieldAccessError { /// is a problem. struct TypeVerifier<'a, 'b: 'a, 'gcx: 'tcx, 'tcx: 'b> { cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, - mir: &'b Mir<'tcx>, + mir: &'b Body<'tcx>, last_span: Span, mir_def_id: DefId, errors_reported: bool, @@ -371,7 +371,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } - fn visit_mir(&mut self, mir: &Mir<'tcx>) { + fn visit_mir(&mut self, mir: &Body<'tcx>) { self.sanitize_type(&"return type", mir.return_ty()); for local_decl in &mir.local_decls { self.sanitize_type(local_decl, local_decl.ty); @@ -384,7 +384,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { } impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { - fn new(cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, mir: &'b Mir<'tcx>) -> Self { + fn new(cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, mir: &'b Body<'tcx>) -> Self { TypeVerifier { mir, mir_def_id: cx.mir_def_id, @@ -538,7 +538,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { place_ty } - fn sanitize_promoted(&mut self, promoted_mir: &'b Mir<'tcx>, location: Location) { + fn sanitize_promoted(&mut self, promoted_mir: &'b Body<'tcx>, location: Location) { // Determine the constraints from the promoted MIR by running the type // checker on the promoted MIR, then transfer the constraints back to // the main MIR, changing the locations to the provided location. @@ -949,7 +949,7 @@ impl Locations { } /// Gets a span representing the location. - pub fn span(&self, mir: &Mir<'_>) -> Span { + pub fn span(&self, mir: &Body<'_>) -> Span { match self { Locations::All(span) => *span, Locations::Single(l) => mir.source_info(*l).span, @@ -960,7 +960,7 @@ impl Locations { impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn new( infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mir_def_id: DefId, param_env: ty::ParamEnv<'gcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, @@ -1302,7 +1302,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.infcx.tcx } - fn check_stmt(&mut self, mir: &Mir<'tcx>, stmt: &Statement<'tcx>, location: Location) { + fn check_stmt(&mut self, mir: &Body<'tcx>, stmt: &Statement<'tcx>, location: Location) { debug!("check_stmt: {:?}", stmt); let tcx = self.tcx(); match stmt.kind { @@ -1441,7 +1441,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_terminator( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, term: &Terminator<'tcx>, term_location: Location, ) { @@ -1605,7 +1605,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_call_dest( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, term: &Terminator<'tcx>, sig: &ty::FnSig<'tcx>, destination: &Option<(Place<'tcx>, BasicBlock)>, @@ -1674,7 +1674,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_call_inputs( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, term: &Terminator<'tcx>, sig: &ty::FnSig<'tcx>, args: &[Operand<'tcx>], @@ -1715,7 +1715,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } } - fn check_iscleanup(&mut self, mir: &Mir<'tcx>, block_data: &BasicBlockData<'tcx>) { + fn check_iscleanup(&mut self, mir: &Body<'tcx>, block_data: &BasicBlockData<'tcx>) { let is_cleanup = block_data.is_cleanup; self.last_span = block_data.terminator().source_info.span; match block_data.terminator().kind { @@ -1807,7 +1807,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn assert_iscleanup( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ctxt: &dyn fmt::Debug, bb: BasicBlock, iscleanuppad: bool, @@ -1823,7 +1823,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } } - fn check_local(&mut self, mir: &Mir<'tcx>, local: Local, local_decl: &LocalDecl<'tcx>) { + fn check_local(&mut self, mir: &Body<'tcx>, local: Local, local_decl: &LocalDecl<'tcx>) { match mir.local_kind(local) { LocalKind::ReturnPointer | LocalKind::Arg => { // return values of normal functions are required to be @@ -1929,7 +1929,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } } - fn check_rvalue(&mut self, mir: &Mir<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { + fn check_rvalue(&mut self, mir: &Body<'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { let tcx = self.tcx(); match rvalue { @@ -2265,7 +2265,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_aggregate_rvalue( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, rvalue: &Rvalue<'tcx>, aggregate_kind: &AggregateKind<'tcx>, operands: &[Operand<'tcx>], @@ -2323,7 +2323,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { /// - `borrowed_place`: the place `P` being borrowed fn add_reborrow_constraint( &mut self, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, location: Location, borrow_region: ty::Region<'tcx>, borrowed_place: &Place<'tcx>, @@ -2617,7 +2617,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { }) } - fn typeck_mir(&mut self, mir: &Mir<'tcx>) { + fn typeck_mir(&mut self, mir: &Body<'tcx>) { self.last_span = mir.span; debug!("run_on_mir: {:?}", mir.span); @@ -2667,7 +2667,7 @@ impl MirPass for TypeckMir { &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, ) { let def_id = src.def_id(); debug!("run_pass: {:?}", def_id); diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index c68dee29c5b1b..a33c9e21ba65b 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -3,7 +3,7 @@ use crate::borrow_check::places_conflict; use crate::borrow_check::Context; use crate::borrow_check::AccessDepth; use crate::dataflow::indexes::BorrowIndex; -use rustc::mir::{BasicBlock, Location, Mir, Place, PlaceBase}; +use rustc::mir::{BasicBlock, Location, Body, Place, PlaceBase}; use rustc::mir::{ProjectionElem, BorrowKind}; use rustc::ty::TyCtxt; use rustc_data_structures::graph::dominators::Dominators; @@ -30,7 +30,7 @@ pub(super) enum Control { pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> ( s: &mut S, tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, _context: Context, access_place: (AccessDepth, &Place<'tcx>), borrow_set: &BorrowSet<'tcx>, diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index 913884a821837..a77ba351ac0a9 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -1,6 +1,6 @@ use rustc::hir; use rustc::mir::ProjectionElem; -use rustc::mir::{Local, Mir, Place, PlaceBase, Mutability, Static, StaticKind}; +use rustc::mir::{Local, Body, Place, PlaceBase, Mutability, Static, StaticKind}; use rustc::ty::{self, TyCtxt}; use crate::borrow_check::borrow_set::LocalsStateAtExit; @@ -13,7 +13,7 @@ crate trait PlaceExt<'tcx> { fn ignore_borrow( &self, tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool; @@ -26,7 +26,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { fn ignore_borrow( &self, tcx: TyCtxt<'_, '_, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool { match self { diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 1bf606109dc76..0393a20bb80e6 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -3,7 +3,7 @@ use crate::borrow_check::Overlap; use crate::borrow_check::{Deep, Shallow, AccessDepth}; use rustc::hir; use rustc::mir::{ - BorrowKind, Mir, Place, PlaceBase, PlaceProjection, ProjectionElem, PlaceProjectionsIter, + BorrowKind, Body, Place, PlaceBase, PlaceProjection, ProjectionElem, PlaceProjectionsIter, StaticKind }; use rustc::ty::{self, TyCtxt}; @@ -26,7 +26,7 @@ crate enum PlaceConflictBias { /// dataflow). crate fn places_conflict<'gcx, 'tcx>( tcx: TyCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, borrow_place: &Place<'tcx>, access_place: &Place<'tcx>, bias: PlaceConflictBias, @@ -48,7 +48,7 @@ crate fn places_conflict<'gcx, 'tcx>( /// order to make the conservative choice and preserve soundness. pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( tcx: TyCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, borrow_place: &Place<'tcx>, borrow_kind: BorrowKind, access_place: &Place<'tcx>, @@ -85,7 +85,7 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( fn place_components_conflict<'gcx, 'tcx>( tcx: TyCtxt<'_, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, borrow_projections: (&PlaceBase<'tcx>, PlaceProjectionsIter<'_, 'tcx>), borrow_kind: BorrowKind, access_projections: (&PlaceBase<'tcx>, PlaceProjectionsIter<'_, 'tcx>), @@ -367,7 +367,7 @@ fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>( // between `elem1` and `elem2`. fn place_projection_conflict<'a, 'gcx: 'tcx, 'tcx>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, pi1: &PlaceProjection<'tcx>, pi2: &PlaceProjection<'tcx>, bias: PlaceConflictBias, diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index 866f1cf994e69..0e1abeba70dff 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -11,7 +11,7 @@ use super::MirBorrowckCtxt; use rustc::hir; use rustc::ty::{self, TyCtxt}; -use rustc::mir::{Mir, Place, PlaceBase, ProjectionElem}; +use rustc::mir::{Body, Place, PlaceBase, ProjectionElem}; pub trait IsPrefixOf<'tcx> { fn is_prefix_of(&self, other: &Place<'tcx>) -> bool; @@ -38,7 +38,7 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { pub(super) struct Prefixes<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - mir: &'cx Mir<'tcx>, + mir: &'cx Body<'tcx>, tcx: TyCtxt<'cx, 'gcx, 'tcx>, kind: PrefixSet, next: Option<&'cx Place<'tcx>>, diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 79e1d5daae194..18497ce0b2bae 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -26,7 +26,7 @@ use syntax_pos::Span; use super::lints; /// Construct the MIR for a given `DefId`. -pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'tcx> { +pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. @@ -150,14 +150,14 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t build::construct_const(cx, body_id, return_ty_span) }; - // Convert the Mir to global types. + // Convert the Body to global types. let mut globalizer = GlobalizeMir { tcx, span: mir.span }; globalizer.visit_mir(&mut mir); let mir = unsafe { - mem::transmute::, Mir<'tcx>>(mir) + mem::transmute::, Body<'tcx>>(mir) }; mir_util::dump_mir(tcx, None, "mir_map", &0, @@ -222,14 +222,14 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: hir::HirId, v: &'tcx hir::VariantData) - -> Mir<'tcx> + -> Body<'tcx> { let span = tcx.hir().span_by_hir_id(ctor_id); if let hir::VariantData::Tuple(ref fields, ctor_id) = *v { tcx.infer_ctxt().enter(|infcx| { let mut mir = shim::build_adt_ctor(&infcx, ctor_id, fields, span); - // Convert the Mir to global types. + // Convert the Body to global types. let tcx = infcx.tcx.global_tcx(); let mut globalizer = GlobalizeMir { tcx, @@ -237,7 +237,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; globalizer.visit_mir(&mut mir); let mir = unsafe { - mem::transmute::, Mir<'tcx>>(mir) + mem::transmute::, Body<'tcx>>(mir) }; mir_util::dump_mir(tcx, None, "mir_map", &0, @@ -613,7 +613,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, yield_ty: Option>, return_ty_span: Span, body: &'gcx hir::Body) - -> Mir<'tcx> + -> Body<'tcx> where A: Iterator> { let arguments: Vec<_> = arguments.collect(); @@ -731,7 +731,7 @@ fn construct_const<'a, 'gcx, 'tcx>( hir: Cx<'a, 'gcx, 'tcx>, body_id: hir::BodyId, ty_span: Span, -) -> Mir<'tcx> { +) -> Body<'tcx> { let tcx = hir.tcx(); let ast_expr = &tcx.hir().body(body_id).value; let ty = hir.tables().expr_ty_adjusted(ast_expr); @@ -761,7 +761,7 @@ fn construct_const<'a, 'gcx, 'tcx>( fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>, body_id: hir::BodyId) - -> Mir<'tcx> { + -> Body<'tcx> { let owner_id = hir.tcx().hir().body_owner(body_id); let span = hir.tcx().hir().span(owner_id); let ty = hir.tcx().types.err; @@ -821,14 +821,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn finish(self, yield_ty: Option>) - -> Mir<'tcx> { + -> Body<'tcx> { for (index, block) in self.cfg.basic_blocks.iter().enumerate() { if block.terminator.is_none() { span_bug!(self.fn_span, "no terminator on block {:?}", index); } } - Mir::new( + Body::new( self.cfg.basic_blocks, self.source_scopes, ClearCrossCrate::Set(self.source_scope_local_data), diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index b65f2ba2601e4..bb5de09c5314e 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -54,7 +54,7 @@ pub(crate) fn mk_eval_cx<'a, 'mir, 'tcx>( pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, cid: GlobalId<'tcx>, - mir: &'mir mir::Mir<'tcx>, + mir: &'mir mir::Body<'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> EvalResult<'tcx, MPlaceTy<'tcx>> { let span = tcx.def_span(cid.instance.def_id()); @@ -110,7 +110,7 @@ fn op_to_const<'tcx>( fn eval_body_and_ecx<'a, 'mir, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, cid: GlobalId<'tcx>, - mir: Option<&'mir mir::Mir<'tcx>>, + mir: Option<&'mir mir::Body<'tcx>>, param_env: ty::ParamEnv<'tcx>, ) -> (EvalResult<'tcx, MPlaceTy<'tcx>>, CompileTimeEvalContext<'a, 'mir, 'tcx>) { // we start out with the best span we have @@ -126,7 +126,7 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>( fn eval_body_using_ecx<'mir, 'tcx>( ecx: &mut CompileTimeEvalContext<'_, 'mir, 'tcx>, cid: GlobalId<'tcx>, - mir: Option<&'mir mir::Mir<'tcx>>, + mir: Option<&'mir mir::Body<'tcx>>, param_env: ty::ParamEnv<'tcx>, ) -> EvalResult<'tcx, MPlaceTy<'tcx>> { debug!("eval_body_using_ecx: {:?}, {:?}", cid, param_env); @@ -327,7 +327,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> args: &[OpTy<'tcx>], dest: Option>, ret: Option, - ) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>> { + ) -> EvalResult<'tcx, Option<&'mir mir::Body<'tcx>>> { debug!("eval_fn_call: {:?}", instance); // Only check non-glue functions if let ty::InstanceDef::Item(def_id) = instance.def { diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index aae4590a387a7..90ab3e9e5d93a 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -1,4 +1,4 @@ -use rustc::mir::{self, Mir, Location}; +use rustc::mir::{self, Body, Location}; use rustc::ty::{self, TyCtxt}; use crate::util::elaborate_drops::DropFlagState; @@ -47,7 +47,7 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, // // FIXME: we have to do something for moving slice patterns. fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(mir, tcx).ty; match ty.sty { @@ -74,7 +74,7 @@ fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, each_child: F) @@ -92,7 +92,7 @@ pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, mut each_child: F) @@ -100,7 +100,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( { fn is_terminal_path<'a, 'gcx, 'tcx>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx>, path: MovePathIndex) -> bool { @@ -110,7 +110,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( fn on_all_children_bits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, each_child: &mut F) @@ -133,7 +133,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, path: MovePathIndex, mut each_child: F) @@ -156,7 +156,7 @@ pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, mut callback: F) where F: FnMut(MovePathIndex, DropFlagState) @@ -173,7 +173,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, loc: Location, mut callback: F) @@ -205,7 +205,7 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( pub(crate) fn for_location_inits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, move_data: &MoveData<'tcx>, loc: Location, mut callback: F) diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs index d68377681f1ca..4965f1a585d48 100644 --- a/src/librustc_mir/dataflow/graphviz.rs +++ b/src/librustc_mir/dataflow/graphviz.rs @@ -1,7 +1,7 @@ //! Hook into libgraphviz for rendering dataflow graphs for MIR. use rustc::hir::def_id::DefId; -use rustc::mir::{BasicBlock, Mir}; +use rustc::mir::{BasicBlock, Body}; use std::fs; use std::io; @@ -17,7 +17,7 @@ use super::DebugFormatted; pub trait MirWithFlowState<'tcx> { type BD: BitDenotation<'tcx>; fn def_id(&self) -> DefId; - fn mir(&self) -> &Mir<'tcx>; + fn mir(&self) -> &Body<'tcx>; fn flow_state(&self) -> &DataflowState<'tcx, Self::BD>; } @@ -26,7 +26,7 @@ impl<'a, 'tcx, BD> MirWithFlowState<'tcx> for DataflowBuilder<'a, 'tcx, BD> { type BD = BD; fn def_id(&self) -> DefId { self.def_id } - fn mir(&self) -> &Mir<'tcx> { self.flow_state.mir() } + fn mir(&self) -> &Body<'tcx> { self.flow_state.mir() } fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state } } @@ -59,7 +59,7 @@ pub type Node = BasicBlock; #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct Edge { source: BasicBlock, index: usize } -fn outgoing(mir: &Mir<'_>, bb: BasicBlock) -> Vec { +fn outgoing(mir: &Body<'_>, bb: BasicBlock) -> Vec { (0..mir[bb].terminator().successors().count()) .map(|index| Edge { source: bb, index: index}).collect() } @@ -124,7 +124,7 @@ where MWF: MirWithFlowState<'tcx>, n: &Node, w: &mut W, block: BasicBlock, - mir: &Mir<'_>) -> io::Result<()> { + mir: &Body<'_>) -> io::Result<()> { // Header rows const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"]; const HDR_FMT: &str = "bgcolor=\"grey\""; @@ -149,7 +149,7 @@ where MWF: MirWithFlowState<'tcx>, n: &Node, w: &mut W, block: BasicBlock, - mir: &Mir<'_>) + mir: &Body<'_>) -> io::Result<()> { let i = n.index(); @@ -199,7 +199,7 @@ where MWF: MirWithFlowState<'tcx>, n: &Node, w: &mut W, block: BasicBlock, - mir: &Mir<'_>) + mir: &Body<'_>) -> io::Result<()> { let i = n.index(); diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 9d4600d13ac13..35df80c174fcc 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -12,16 +12,16 @@ use crate::dataflow::BitDenotation; /// immovable generators. #[derive(Copy, Clone)] pub struct HaveBeenBorrowedLocals<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, } impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>) + pub fn new(mir: &'a Body<'tcx>) -> Self { HaveBeenBorrowedLocals { mir } } - pub fn mir(&self) -> &Mir<'tcx> { + pub fn mir(&self) -> &Body<'tcx> { self.mir } } diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 43cb0ed4565fe..99051fb37f148 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -1,7 +1,7 @@ use crate::borrow_check::borrow_set::{BorrowSet, BorrowData}; use crate::borrow_check::place_ext::PlaceExt; -use rustc::mir::{self, Location, Place, PlaceBase, Mir}; +use rustc::mir::{self, Location, Place, PlaceBase, Body}; use rustc::ty::TyCtxt; use rustc::ty::RegionVid; @@ -31,7 +31,7 @@ newtype_index! { /// borrows in compact bitvectors. pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, borrow_set: Rc>, borrows_out_of_scope_at_location: FxHashMap>, @@ -48,7 +48,7 @@ struct StackEntry { } fn precompute_borrows_out_of_scope<'tcx>( - mir: &Mir<'tcx>, + mir: &Body<'tcx>, regioncx: &Rc>, borrows_out_of_scope_at_location: &mut FxHashMap>, borrow_index: BorrowIndex, @@ -136,7 +136,7 @@ fn precompute_borrows_out_of_scope<'tcx>( impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { crate fn new( tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, nonlexical_regioncx: Rc>, borrow_set: &Rc>, ) -> Self { diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 4dcfb3f1a7fc3..671a4ce449aac 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -3,7 +3,7 @@ //! zero-sized structure. use rustc::ty::TyCtxt; -use rustc::mir::{self, Mir, Location}; +use rustc::mir::{self, Body, Location}; use rustc_data_structures::bit_set::{BitSet, BitSetOperator}; use rustc_data_structures::indexed_vec::Idx; @@ -66,13 +66,13 @@ pub(super) mod borrows; /// places that would require a dynamic drop-flag at that statement. pub struct MaybeInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self { @@ -121,13 +121,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 'tcx /// places that would require a dynamic drop-flag at that statement. pub struct MaybeUninitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self { @@ -175,13 +175,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 't /// that would require a dynamic drop-flag at that statement. pub struct DefinitelyInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self { @@ -224,13 +224,13 @@ impl<'a, 'gcx, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, ' /// ``` pub struct EverInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx: 'a> EverInitializedPlaces<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self { diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index 6b8eb6f17f6c1..9bf346f5f62d6 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -5,16 +5,16 @@ use crate::dataflow::BitDenotation; #[derive(Copy, Clone)] pub struct MaybeStorageLive<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, } impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>) + pub fn new(mir: &'a Body<'tcx>) -> Self { MaybeStorageLive { mir } } - pub fn mir(&self) -> &Mir<'tcx> { + pub fn mir(&self) -> &Body<'tcx> { self.mir } } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 83221aca6c5b3..afc2c5b1bf937 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -6,7 +6,7 @@ use rustc_data_structures::work_queue::WorkQueue; use rustc::hir::def_id::DefId; use rustc::ty::{self, TyCtxt}; -use rustc::mir::{self, Mir, BasicBlock, BasicBlockData, Location, Statement, Terminator}; +use rustc::mir::{self, Body, BasicBlock, BasicBlockData, Location, Statement, Terminator}; use rustc::mir::traversal; use rustc::session::Session; @@ -121,7 +121,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { } pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, def_id: DefId, attributes: &[ast::Attribute], dead_unwinds: &BitSet, @@ -344,13 +344,13 @@ pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> { // Delegated Hooks: Provide access to the MIR and process the flow state. - fn mir(&self) -> &'a Mir<'tcx>; + fn mir(&self) -> &'a Body<'tcx>; } pub fn state_for_location<'tcx, T: BitDenotation<'tcx>>(loc: Location, analysis: &T, result: &DataflowResults<'tcx, T>, - mir: &Mir<'tcx>) + mir: &Body<'tcx>) -> BitSet { let mut on_entry = result.sets().on_entry_set_for(loc.block.index()).to_owned(); let mut kill_set = on_entry.to_hybrid(); @@ -385,7 +385,7 @@ pub struct DataflowAnalysis<'a, 'tcx: 'a, O> where O: BitDenotation<'tcx> { flow_state: DataflowState<'tcx, O>, dead_unwinds: &'a BitSet, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, } impl<'a, 'tcx: 'a, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> @@ -394,7 +394,7 @@ impl<'a, 'tcx: 'a, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> DataflowResults(self.flow_state) } - pub fn mir(&self) -> &'a Mir<'tcx> { self.mir } + pub fn mir(&self) -> &'a Body<'tcx> { self.mir } } pub struct DataflowResults<'tcx, O>(pub(crate) DataflowState<'tcx, O>) where O: BitDenotation<'tcx>; @@ -698,7 +698,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator { impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { - pub fn new(mir: &'a Mir<'tcx>, + pub fn new(mir: &'a Body<'tcx>, dead_unwinds: &'a BitSet, denotation: D) -> Self where D: InitialFlow { let bits_per_block = denotation.bits_per_block(); diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 2471c01e3f3d0..6930be972eee4 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -13,14 +13,14 @@ use super::{MoveError, InitIndex, Init, InitLocation, LookupResult, InitKind}; use super::IllegalMoveOriginKind::*; struct MoveDataBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>, data: MoveData<'tcx>, errors: Vec<(Place<'tcx>, MoveError<'tcx>)>, } impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { - fn new(mir: &'a Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { + fn new(mir: &'a Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { let mut move_paths = IndexVec::new(); let mut path_map = IndexVec::new(); let mut init_path_map = IndexVec::new(); @@ -198,7 +198,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { } pub(super) fn gather_moves<'a, 'gcx, 'tcx>( - mir: &Mir<'tcx>, + mir: &Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx> ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { let mut builder = MoveDataBuilder::new(mir, tcx); diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 8810be9326bf5..0593603d32b67 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -138,7 +138,7 @@ impl IndexMut for LocationMap { } impl LocationMap where T: Default + Clone { - fn new(mir: &Mir<'_>) -> Self { + fn new(mir: &Body<'_>) -> Self { LocationMap { map: mir.basic_blocks().iter().map(|block| { vec![T::default(); block.statements.len()+1] @@ -205,7 +205,7 @@ impl fmt::Debug for Init { } impl Init { - crate fn span<'gcx>(&self, mir: &Mir<'gcx>) -> Span { + crate fn span<'gcx>(&self, mir: &Body<'gcx>) -> Span { match self.location { InitLocation::Argument(local) => mir.local_decls[local].source_info.span, InitLocation::Statement(location) => mir.source_info(location).span, @@ -305,7 +305,7 @@ impl<'tcx> MoveError<'tcx> { } impl<'a, 'gcx, 'tcx> MoveData<'tcx> { - pub fn gather_moves(mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) + pub fn gather_moves(mir: &Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(mir, tcx) } diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 71c6489d63f0d..6cca2024293f6 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -45,7 +45,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /// Whether this constant/function needs overflow checks. check_overflow: bool, - /// See field with the same name on `Mir`. + /// See field with the same name on `Body`. control_flow_destroyed: Vec<(Span, String)>, } diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 4ae8bfe854d78..3ff04ec553155 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -53,7 +53,7 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { // Function and callsite information //////////////////////////////////////////////////////////////////////////////// /// The MIR for the function called on this frame. - pub mir: &'mir mir::Mir<'tcx>, + pub mir: &'mir mir::Body<'tcx>, /// The def_id and substs of the current function. pub instance: ty::Instance<'tcx>, @@ -236,7 +236,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tc } #[inline(always)] - pub(super) fn mir(&self) -> &'mir mir::Mir<'tcx> { + pub(super) fn mir(&self) -> &'mir mir::Body<'tcx> { self.frame().mir } @@ -286,7 +286,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tc pub fn load_mir( &self, instance: ty::InstanceDef<'tcx>, - ) -> EvalResult<'tcx, &'tcx mir::Mir<'tcx>> { + ) -> EvalResult<'tcx, &'tcx mir::Body<'tcx>> { // do not continue if typeck errors occurred (can only occur in local crate) let did = instance.def_id(); if did.is_local() @@ -464,7 +464,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tc &mut self, instance: ty::Instance<'tcx>, span: source_map::Span, - mir: &'mir mir::Mir<'tcx>, + mir: &'mir mir::Body<'tcx>, return_place: Option>, return_to_block: StackPopCleanup, ) -> EvalResult<'tcx> { diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 288ffbf3cd616..873c2d2ec6088 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -117,7 +117,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { args: &[OpTy<'tcx, Self::PointerTag>], dest: Option>, ret: Option, - ) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>>; + ) -> EvalResult<'tcx, Option<&'mir mir::Body<'tcx>>>; /// Directly process an intrinsic without pushing a stack frame. /// If this returns successfully, the engine will take care of jumping to the next block. diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 572f7133cad84..5c0074ac9b77b 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -3,12 +3,12 @@ use rustc::hir::def_id::DefId; use rustc::hir::intravisit::FnKind; use rustc::hir::map::blocks::FnLikeNode; use rustc::lint::builtin::UNCONDITIONAL_RECURSION; -use rustc::mir::{self, Mir, TerminatorKind}; +use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::{self, AssociatedItem, AssociatedItemContainer, Instance, TyCtxt}; use rustc::ty::subst::InternalSubsts; pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -19,7 +19,7 @@ pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn_kind: FnKind<'_>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, def_id: DefId) { if let FnKind::Closure(_) = fn_kind { // closures can't recur, so they don't matter. diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 47fe136e0e451..b92ae7d4b9563 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -517,7 +517,7 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, struct MirNeighborCollector<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a mir::Mir<'tcx>, + mir: &'a mir::Body<'tcx>, output: &'a mut Vec>, param_substs: SubstsRef<'tcx>, } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index cb25db73cd2be..05ee495460ab6 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -28,7 +28,7 @@ pub fn provide(providers: &mut Providers<'_>) { fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) - -> &'tcx Mir<'tcx> + -> &'tcx Body<'tcx> { debug!("make_shim({:?})", instance); @@ -169,7 +169,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, ty: Option>) - -> Mir<'tcx> + -> Body<'tcx> { debug!("build_drop_shim(def_id={:?}, ty={:?})", def_id, ty); @@ -202,7 +202,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, block(&mut blocks, TerminatorKind::Goto { target: return_block }); block(&mut blocks, TerminatorKind::Return); - let mut mir = Mir::new( + let mut mir = Body::new( blocks, IndexVec::from_elem_n( SourceScopeData { span: span, parent_scope: None }, 1 @@ -256,7 +256,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } pub struct DropShimElaborator<'a, 'tcx: 'a> { - pub mir: &'a Mir<'tcx>, + pub mir: &'a Body<'tcx>, pub patch: MirPatch<'tcx>, pub tcx: TyCtxt<'a, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, @@ -272,7 +272,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { type Path = (); fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } - fn mir(&self) -> &'a Mir<'tcx> { self.mir } + fn mir(&self) -> &'a Body<'tcx> { self.mir } fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } @@ -309,7 +309,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) - -> Mir<'tcx> + -> Body<'tcx> { debug!("build_clone_shim(def_id={:?})", def_id); @@ -371,8 +371,8 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { } } - fn into_mir(self) -> Mir<'tcx> { - Mir::new( + fn into_mir(self) -> Body<'tcx> { + Body::new( self.blocks, IndexVec::from_elem_n( SourceScopeData { span: self.span, parent_scope: None }, 1 @@ -700,7 +700,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, rcvr_adjustment: Adjustment, call_kind: CallKind, untuple_args: Option<&[Ty<'tcx>]>) - -> Mir<'tcx> + -> Body<'tcx> { debug!("build_call_shim(def_id={:?}, rcvr_adjustment={:?}, \ call_kind={:?}, untuple_args={:?})", @@ -827,7 +827,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, block(&mut blocks, vec![], TerminatorKind::Resume, true); } - let mut mir = Mir::new( + let mut mir = Body::new( blocks, IndexVec::from_elem_n( SourceScopeData { span: span, parent_scope: None }, 1 @@ -852,7 +852,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, ctor_id: hir::HirId, fields: &[hir::StructField], span: Span) - -> Mir<'tcx> + -> Body<'tcx> { let tcx = infcx.tcx; let gcx = tcx.global_tcx(); @@ -906,7 +906,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, is_cleanup: false }; - Mir::new( + Body::new( IndexVec::from_elem_n(start_block, 1), IndexVec::from_elem_n( SourceScopeData { span: span, parent_scope: None }, 1 diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 88042d64e96b7..712e9b1fe2505 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -34,13 +34,13 @@ impl MirPass for AddCallGuards { fn run_pass<'a, 'tcx>(&self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { self.add_call_guards(mir); } } impl AddCallGuards { - pub fn add_call_guards(&self, mir: &mut Mir<'_>) { + pub fn add_call_guards(&self, mir: &mut Body<'_>) { let pred_count: IndexVec<_, _> = mir.predecessors().iter().map(|ps| ps.len()).collect(); diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index b6436ec70eef2..f7a4bf759545c 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -43,7 +43,7 @@ impl MirPass for AddMovesForPackedDrops { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) + mir: &mut Body<'tcx>) { debug!("add_moves_for_packed_drops({:?} @ {:?})", src, mir.span); add_moves_for_packed_drops(tcx, mir, src.def_id()); @@ -52,7 +52,7 @@ impl MirPass for AddMovesForPackedDrops { pub fn add_moves_for_packed_drops<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, def_id: DefId) { let patch = add_moves_for_packed_drops_patch(tcx, mir, def_id); @@ -61,7 +61,7 @@ pub fn add_moves_for_packed_drops<'a, 'tcx>( fn add_moves_for_packed_drops_patch<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, def_id: DefId) -> MirPatch<'tcx> { @@ -92,7 +92,7 @@ fn add_moves_for_packed_drops_patch<'a, 'tcx>( fn add_move_for_packed_drop<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, patch: &mut MirPatch<'tcx>, terminator: &Terminator<'tcx>, loc: Location, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index a393847fd4922..5a8c1fdcfdb65 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -77,7 +77,7 @@ impl MirPass for AddRetag { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) + mir: &mut Body<'tcx>) { if !tcx.sess.opts.debugging_opts.mir_emit_retag { return; diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 87c02b7f01da3..c127963772228 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -19,7 +19,7 @@ use std::ops::Bound; use crate::util; pub struct UnsafetyChecker<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, const_context: bool, min_const_fn: bool, source_scope_local_data: &'a IndexVec, @@ -36,7 +36,7 @@ impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { fn new( const_context: bool, min_const_fn: bool, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, source_scope_local_data: &'a IndexVec, tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 349b27523a0a1..0f32ff295df17 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -16,7 +16,7 @@ //! [`FakeRead`]: rustc::mir::StatementKind::FakeRead //! [`Nop`]: rustc::mir::StatementKind::Nop -use rustc::mir::{BasicBlock, BorrowKind, Rvalue, Location, Mir}; +use rustc::mir::{BasicBlock, BorrowKind, Rvalue, Location, Body}; use rustc::mir::{Statement, StatementKind}; use rustc::mir::visit::MutVisitor; use rustc::ty::TyCtxt; @@ -30,7 +30,7 @@ impl MirPass for CleanupNonCodegenStatements { fn run_pass<'a, 'tcx>(&self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let mut delete = DeleteNonCodegenStatements; delete.visit_mir(mir); } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index b5bdc9e1c8c6e..1421a772ce2d0 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -3,7 +3,7 @@ use rustc::hir::def::Def; -use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Body, Operand, Rvalue, Local}; use rustc::mir::{NullOp, UnOp, StatementKind, Statement, BasicBlock, LocalKind, Static, StaticKind}; use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; @@ -30,7 +30,7 @@ impl MirPass for ConstProp { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { // will be evaluated by miri and produce its errors there if source.promoted.is_some() { return; @@ -71,7 +71,7 @@ type Const<'tcx> = (OpTy<'tcx>, Span); /// Finds optimization opportunities on the MIR. struct ConstPropagator<'a, 'mir, 'tcx:'a+'mir> { ecx: InterpretCx<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, - mir: &'mir Mir<'tcx>, + mir: &'mir Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, places: IndexVec>>, @@ -104,7 +104,7 @@ impl<'a, 'b, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'a, 'b, 'tcx> { impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { fn new( - mir: &'mir Mir<'tcx>, + mir: &'mir Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, ) -> ConstPropagator<'a, 'mir, 'tcx> { @@ -488,7 +488,7 @@ struct CanConstProp { impl CanConstProp { /// returns true if `local` can be propagated - fn check(mir: &Mir<'_>) -> IndexVec { + fn check(mir: &Body<'_>) -> IndexVec { let mut cpv = CanConstProp { can_const_prop: IndexVec::from_elem(true, &mir.local_decls), found_assignment: IndexVec::from_elem(false, &mir.local_decls), diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 817a2f31c0736..68a9955d3c8c0 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -20,7 +20,7 @@ //! future. use rustc::mir::{ - Constant, Local, LocalKind, Location, Place, PlaceBase, Mir, Operand, Rvalue, StatementKind + Constant, Local, LocalKind, Location, Place, PlaceBase, Body, Operand, Rvalue, StatementKind }; use rustc::mir::visit::MutVisitor; use rustc::ty::TyCtxt; @@ -33,7 +33,7 @@ impl MirPass for CopyPropagation { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { // We only run when the MIR optimization level is > 1. // This avoids a slow pass, and messing up debug info. if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 { @@ -135,7 +135,7 @@ impl MirPass for CopyPropagation { } fn eliminate_self_assignments<'tcx>( - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, def_use_analysis: &DefUseAnalysis<'tcx>, ) -> bool { let mut changed = false; @@ -177,7 +177,7 @@ enum Action<'tcx> { } impl<'tcx> Action<'tcx> { - fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis<'_>, src_place: &Place<'tcx>) + fn local_copy(mir: &Body<'tcx>, def_use_analysis: &DefUseAnalysis<'_>, src_place: &Place<'tcx>) -> Option> { // The source must be a local. let src_local = if let Place::Base(PlaceBase::Local(local)) = *src_place { @@ -232,7 +232,7 @@ impl<'tcx> Action<'tcx> { } fn perform(self, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, def_use_analysis: &DefUseAnalysis<'tcx>, dest_local: Local, location: Location) diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index 9061dfff76fe8..1f9a250bcc64d 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -9,7 +9,7 @@ impl MirPass for Deaggregator { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let (basic_blocks, local_decls) = mir.basic_blocks_and_local_decls_mut(); let local_decls = &*local_decls; for bb in basic_blocks { diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 81e48fe2dbe3b..104f2109b633c 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -5,7 +5,7 @@ use std::fmt; use std::fs::File; use std::io; -use rustc::mir::Mir; +use rustc::mir::Body; use rustc::session::config::{OutputFilenames, OutputType}; use rustc::ty::TyCtxt; use crate::transform::{MirPass, MirSource}; @@ -21,7 +21,7 @@ impl MirPass for Marker { fn run_pass<'a, 'tcx>(&self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _source: MirSource<'tcx>, - _mir: &mut Mir<'tcx>) + _mir: &mut Body<'tcx>) { } } @@ -42,7 +42,7 @@ pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_num: &dyn fmt::Display, pass_name: &str, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, is_after: bool) { if mir_util::dump_enabled(tcx, pass_name, source) { mir_util::dump_mir(tcx, @@ -60,7 +60,7 @@ pub fn emit_mir<'a, 'tcx>( outputs: &OutputFilenames) -> io::Result<()> { - let path = outputs.path(OutputType::Mir); + let path = outputs.path(OutputType::Body); let mut f = File::create(&path)?; mir_util::write_mir_pretty(tcx, None, &mut f)?; Ok(()) diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 023a61588c42e..2f190d2cacade 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -24,7 +24,7 @@ impl MirPass for ElaborateDrops { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) + mir: &mut Body<'tcx>) { debug!("elaborate_drops({:?} @ {:?})", src, mir.span); @@ -79,7 +79,7 @@ impl MirPass for ElaborateDrops { /// that can't drop anything. fn find_dead_unwinds<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, def_id: hir::def_id::DefId, env: &MoveDataParamEnv<'tcx, 'tcx>) -> BitSet @@ -143,7 +143,7 @@ struct InitializationData { impl InitializationData { fn apply_location<'a,'tcx>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, env: &MoveDataParamEnv<'tcx, 'tcx>, loc: Location) { @@ -186,7 +186,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { &mut self.ctxt.patch } - fn mir(&self) -> &'a Mir<'tcx> { + fn mir(&self) -> &'a Body<'tcx> { self.ctxt.mir } @@ -291,7 +291,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { struct ElaborateDropsCtxt<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index a853f8d92beae..04757bb423922 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -54,7 +54,7 @@ impl MirPass for EraseRegions { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { EraseRegionsVisitor::new(tcx).visit_mir(mir); } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 2b909feb9603f..34e7879edfd5f 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -298,7 +298,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { fn make_generator_state_argument_indirect<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let gen_ty = mir.local_decls.raw[1].ty; let region = ty::ReFree(ty::FreeRegion { @@ -322,7 +322,7 @@ fn make_generator_state_argument_indirect<'a, 'tcx>( fn make_generator_state_argument_pinned<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let ref_gen_ty = mir.local_decls.raw[1].ty; let pin_did = tcx.lang_items().pin_type().unwrap(); @@ -339,7 +339,7 @@ fn make_generator_state_argument_pinned<'a, 'tcx>( fn replace_result_variable<'tcx>( ret_ty: Ty<'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, ) -> Local { let source_info = source_info(mir); let new_ret = LocalDecl { @@ -382,7 +382,7 @@ impl<'tcx> Visitor<'tcx> for StorageIgnored { fn locals_live_across_suspend_points( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, source: MirSource<'tcx>, movable: bool, ) -> ( @@ -493,7 +493,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, upvars: &Vec>, interior: Ty<'tcx>, movable: bool, - mir: &mut Mir<'tcx>) + mir: &mut Body<'tcx>) -> (FxHashMap, usize)>, GeneratorLayout<'tcx>, FxHashMap) @@ -553,7 +553,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn insert_switch<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, cases: Vec<(u32, BasicBlock)>, transform: &TransformVisitor<'a, 'tcx>, default: TerminatorKind<'tcx>) { @@ -585,7 +585,7 @@ fn insert_switch<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; use crate::util::patch::MirPatch; use crate::shim::DropShimElaborator; @@ -640,8 +640,8 @@ fn create_generator_drop_shim<'a, 'tcx>( def_id: DefId, source: MirSource<'tcx>, gen_ty: Ty<'tcx>, - mir: &Mir<'tcx>, - drop_clean: BasicBlock) -> Mir<'tcx> { + mir: &Body<'tcx>, + drop_clean: BasicBlock) -> Body<'tcx> { let mut mir = mir.clone(); let source_info = source_info(&mir); @@ -711,7 +711,7 @@ fn create_generator_drop_shim<'a, 'tcx>( mir } -fn insert_term_block<'tcx>(mir: &mut Mir<'tcx>, kind: TerminatorKind<'tcx>) -> BasicBlock { +fn insert_term_block<'tcx>(mir: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> BasicBlock { let term_block = BasicBlock::new(mir.basic_blocks().len()); let source_info = source_info(mir); mir.basic_blocks_mut().push(BasicBlockData { @@ -726,7 +726,7 @@ fn insert_term_block<'tcx>(mir: &mut Mir<'tcx>, kind: TerminatorKind<'tcx>) -> B } fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, message: AssertMessage<'tcx>) -> BasicBlock { let assert_block = BasicBlock::new(mir.basic_blocks().len()); let term = TerminatorKind::Assert { @@ -762,7 +762,7 @@ fn create_generator_resume_function<'a, 'tcx>( transform: TransformVisitor<'a, 'tcx>, def_id: DefId, source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { // Poison the generator when it unwinds for block in mir.basic_blocks_mut() { let source_info = block.terminator().source_info; @@ -799,14 +799,14 @@ fn create_generator_resume_function<'a, 'tcx>( dump_mir(tcx, None, "generator_resume", &0, source, mir, |_, _| Ok(()) ); } -fn source_info<'a, 'tcx>(mir: &Mir<'tcx>) -> SourceInfo { +fn source_info<'a, 'tcx>(mir: &Body<'tcx>) -> SourceInfo { SourceInfo { span: mir.span, scope: OUTERMOST_SOURCE_SCOPE, } } -fn insert_clean_drop<'a, 'tcx>(mir: &mut Mir<'tcx>) -> BasicBlock { +fn insert_clean_drop<'a, 'tcx>(mir: &mut Body<'tcx>) -> BasicBlock { let return_block = insert_term_block(mir, TerminatorKind::Return); // Create a block to destroy an unresumed generators. This can only destroy upvars. @@ -829,7 +829,7 @@ fn insert_clean_drop<'a, 'tcx>(mir: &mut Mir<'tcx>) -> BasicBlock { drop_clean } -fn create_cases<'a, 'tcx, F>(mir: &mut Mir<'tcx>, +fn create_cases<'a, 'tcx, F>(mir: &mut Body<'tcx>, transform: &TransformVisitor<'a, 'tcx>, target: F) -> Vec<(u32, BasicBlock)> where F: Fn(&SuspensionPoint) -> Option { @@ -873,7 +873,7 @@ impl MirPass for StateTransform { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let yield_ty = if let Some(yield_ty) = mir.yield_ty { yield_ty } else { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index e96a40ad2f036..4a62a98c5d89b 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -41,7 +41,7 @@ impl MirPass for Inline { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 { Inliner { tcx, source }.run_pass(mir); } @@ -54,7 +54,7 @@ struct Inliner<'a, 'tcx: 'a> { } impl<'a, 'tcx> Inliner<'a, 'tcx> { - fn run_pass(&self, caller_mir: &mut Mir<'tcx>) { + fn run_pass(&self, caller_mir: &mut Body<'tcx>) { // Keep a queue of callsites to try inlining on. We take // advantage of the fact that queries detect cycles here to // allow us to try and fetch the fully optimized MIR of a @@ -171,7 +171,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { fn get_valid_function_call(&self, bb: BasicBlock, bb_data: &BasicBlockData<'tcx>, - caller_mir: &Mir<'tcx>, + caller_mir: &Body<'tcx>, param_env: ParamEnv<'tcx>, ) -> Option> { // Don't inline calls that are in cleanup blocks. @@ -204,7 +204,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { fn consider_optimizing(&self, callsite: CallSite<'tcx>, - callee_mir: &Mir<'tcx>) + callee_mir: &Body<'tcx>) -> bool { debug!("consider_optimizing({:?})", callsite); @@ -216,7 +216,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { fn should_inline(&self, callsite: CallSite<'tcx>, - callee_mir: &Mir<'tcx>) + callee_mir: &Body<'tcx>) -> bool { debug!("should_inline({:?})", callsite); @@ -394,8 +394,8 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { fn inline_call(&self, callsite: CallSite<'tcx>, - caller_mir: &mut Mir<'tcx>, - mut callee_mir: Mir<'tcx>) -> bool { + caller_mir: &mut Body<'tcx>, + mut callee_mir: Body<'tcx>) -> bool { let terminator = caller_mir[callsite.bb].terminator.take().unwrap(); match terminator.kind { // FIXME: Handle inlining of diverging calls @@ -528,7 +528,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { &self, args: Vec>, callsite: &CallSite<'tcx>, - caller_mir: &mut Mir<'tcx>, + caller_mir: &mut Body<'tcx>, ) -> Vec { let tcx = self.tcx; @@ -595,7 +595,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { &self, arg: Operand<'tcx>, callsite: &CallSite<'tcx>, - caller_mir: &mut Mir<'tcx>, + caller_mir: &mut Body<'tcx>, ) -> Local { // FIXME: Analysis of the usage of the arguments to avoid // unnecessary temporaries. diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 8187a81f0edab..270d51130303b 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -1,6 +1,6 @@ //! Performs various peephole optimizations. -use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, ProjectionElem, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Body, Operand, ProjectionElem, Rvalue, Local}; use rustc::mir::visit::{MutVisitor, Visitor}; use rustc::ty::{self, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -14,7 +14,7 @@ impl MirPass for InstCombine { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { // We only run when optimizing MIR (at any level). if tcx.sess.opts.debugging_opts.mir_opt_level == 0 { return @@ -63,13 +63,13 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { /// Finds optimization opportunities on the MIR. struct OptimizationFinder<'b, 'a, 'tcx:'a+'b> { - mir: &'b Mir<'tcx>, + mir: &'b Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, optimizations: OptimizationList<'tcx>, } impl<'b, 'a, 'tcx:'b> OptimizationFinder<'b, 'a, 'tcx> { - fn new(mir: &'b Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'a, 'tcx> { + fn new(mir: &'b Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'a, 'tcx> { OptimizationFinder { mir, tcx, diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index fd9d6bb5760b1..8c19637a955f1 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -13,7 +13,7 @@ impl MirPass for Lower128Bit { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let debugging_override = tcx.sess.opts.debugging_opts.lower_128bit_ops; let target_default = tcx.sess.host.options.i128_lowering; if !debugging_override.unwrap_or(target_default) { @@ -25,7 +25,7 @@ impl MirPass for Lower128Bit { } impl Lower128Bit { - fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<'tcx>) { + fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Body<'tcx>) { let mut new_blocks = Vec::new(); let cur_len = mir.basic_blocks().len(); diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 27cb87f5dcaa0..0cba06b87f1f4 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -1,7 +1,7 @@ use crate::borrow_check::nll::type_check; use crate::build; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc::mir::{Mir, MirPhase, Promoted}; +use rustc::mir::{Body, MirPhase, Promoted}; use rustc::ty::{TyCtxt, InstanceDef}; use rustc::ty::query::Providers; use rustc::ty::steal::Steal; @@ -96,12 +96,12 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) tcx.arena.alloc(set) } -fn mir_built<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_built<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let mir = build::mir_build(tcx, def_id); tcx.alloc_steal_mir(mir) } -/// Where a specific Mir comes from. +/// Where a specific Body comes from. #[derive(Debug, Copy, Clone)] pub struct MirSource<'tcx> { pub instance: InstanceDef<'tcx>, @@ -146,19 +146,19 @@ pub trait MirPass { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, source: MirSource<'tcx>, - mir: &mut Mir<'tcx>); + mir: &mut Body<'tcx>); } pub fn run_passes( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, instance: InstanceDef<'tcx>, mir_phase: MirPhase, passes: &[&dyn MirPass], ) { let phase_index = mir_phase.phase_index(); - let run_passes = |mir: &mut Mir<'tcx>, promoted| { + let run_passes = |mir: &mut Body<'tcx>, promoted| { if mir.phase >= mir_phase { return; } @@ -197,7 +197,7 @@ pub fn run_passes( } } -fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { // Unsafety check uses the raw mir, so make sure it is run let _ = tcx.unsafety_check_result(def_id); @@ -212,7 +212,7 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea tcx.alloc_steal_mir(mir) } -fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at @@ -229,8 +229,8 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx tcx.alloc_steal_mir(mir) } -fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Mir<'tcx> { - // (Mir-)Borrowck uses `mir_validated`, so we have to force it to +fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { + // (Body-)Borrowck uses `mir_validated`, so we have to force it to // execute before we can steal. tcx.ensure().mir_borrowck(def_id); diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 089d9b9b54454..06277a7d099b0 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -12,12 +12,12 @@ impl MirPass for NoLandingPads { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { no_landing_pads(tcx, mir) } } -pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<'tcx>) { +pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { NoLandingPads.visit_mir(mir); } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index ddf963c7fa9b5..00e338f4bb051 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -71,7 +71,7 @@ pub enum Candidate { struct TempCollector<'tcx> { temps: IndexVec, span: Span, - mir: &'tcx Mir<'tcx>, + mir: &'tcx Body<'tcx>, } impl<'tcx> Visitor<'tcx> for TempCollector<'tcx> { @@ -134,7 +134,7 @@ impl<'tcx> Visitor<'tcx> for TempCollector<'tcx> { } } -pub fn collect_temps(mir: &Mir<'_>, +pub fn collect_temps(mir: &Body<'_>, rpo: &mut ReversePostorder<'_, '_>) -> IndexVec { let mut collector = TempCollector { temps: IndexVec::from_elem(TempState::Undefined, &mir.local_decls), @@ -149,8 +149,8 @@ pub fn collect_temps(mir: &Mir<'_>, struct Promoter<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - source: &'a mut Mir<'tcx>, - promoted: Mir<'tcx>, + source: &'a mut Body<'tcx>, + promoted: Body<'tcx>, temps: &'a mut IndexVec, /// If true, all nested temps are also kept in the @@ -369,7 +369,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } } -pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, +pub fn promote_candidates<'a, 'tcx>(mir: &mut Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, mut temps: IndexVec, candidates: Vec) { @@ -393,13 +393,13 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, } - // Declare return place local so that `Mir::new` doesn't complain. + // Declare return place local so that `Body::new` doesn't complain. let initial_locals = iter::once( LocalDecl::new_return_place(tcx.types.never, mir.span) ).collect(); let promoter = Promoter { - promoted: Mir::new( + promoted: Body::new( IndexVec::new(), // FIXME: maybe try to filter this to avoid blowing up // memory usage? diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index bbcdd2c1812ae..75d47233e05aa 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -113,7 +113,7 @@ struct ConstCx<'a, 'tcx> { tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, mode: Mode, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, per_local: PerQualif>, } @@ -619,7 +619,7 @@ impl Deref for Checker<'a, 'tcx> { impl<'a, 'tcx> Checker<'a, 'tcx> { fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, mode: Mode) -> Self { assert!(def_id.is_local()); @@ -1441,7 +1441,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mir = &tcx.mir_const(def_id).borrow(); if mir.return_ty().references_error() { - tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Mir had errors"); + tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Body had errors"); return (1 << IsNotPromotable::IDX, Lrc::new(BitSet::new_empty(0))); } @@ -1454,10 +1454,10 @@ impl MirPass for QualifyAndPromoteConstants { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { // There's not really any point in promoting errorful MIR. if mir.return_ty().references_error() { - tcx.sess.delay_span_bug(mir.span, "QualifyAndPromoteConstants: Mir had errors"); + tcx.sess.delay_span_bug(mir.span, "QualifyAndPromoteConstants: Body had errors"); return; } diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index d5f04ca64e4c4..e7f95dcb88c3d 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -11,7 +11,7 @@ type McfResult = Result<(), (Span, Cow<'static, str>)>; pub fn is_min_const_fn( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, ) -> McfResult { let mut current = def_id; loop { @@ -130,7 +130,7 @@ fn check_ty( fn check_rvalue( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, rvalue: &Rvalue<'tcx>, span: Span, ) -> McfResult { @@ -210,7 +210,7 @@ fn check_rvalue( fn check_statement( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, statement: &Statement<'tcx>, ) -> McfResult { let span = statement.source_info.span; @@ -240,7 +240,7 @@ fn check_statement( fn check_operand( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, operand: &Operand<'tcx>, span: Span, ) -> McfResult { @@ -254,7 +254,7 @@ fn check_operand( fn check_place( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, place: &Place<'tcx>, span: Span, ) -> McfResult { @@ -280,7 +280,7 @@ fn check_place( fn check_terminator( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, terminator: &Terminator<'tcx>, ) -> McfResult { let span = terminator.source_info.span; diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index b7493b25d4650..42818a571151e 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -11,7 +11,7 @@ pub struct RemoveNoopLandingPads; pub fn remove_noop_landing_pads<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &mut Mir<'tcx>) + mir: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { return @@ -25,7 +25,7 @@ impl MirPass for RemoveNoopLandingPads { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { remove_noop_landing_pads(tcx, mir); } } @@ -34,7 +34,7 @@ impl RemoveNoopLandingPads { fn is_nop_landing_pad( &self, bb: BasicBlock, - mir: &Mir<'_>, + mir: &Body<'_>, nop_landing_pads: &BitSet, ) -> bool { for stmt in &mir[bb].statements { @@ -86,7 +86,7 @@ impl RemoveNoopLandingPads { } } - fn remove_nop_landing_pads(&self, mir: &mut Mir<'_>) { + fn remove_nop_landing_pads(&self, mir: &mut Body<'_>) { // make sure there's a single resume block let resume_block = { let patch = MirPatch::new(mir); diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 246f876235d71..4badb7941c0cd 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -4,7 +4,7 @@ use syntax_pos::Span; use rustc::ty::{self, TyCtxt}; use rustc::hir::def_id::DefId; -use rustc::mir::{self, Mir, Location}; +use rustc::mir::{self, Body, Location}; use rustc_data_structures::bit_set::BitSet; use crate::transform::{MirPass, MirSource}; @@ -25,7 +25,7 @@ pub struct SanityCheck; impl MirPass for SanityCheck { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, - src: MirSource<'tcx>, mir: &mut Mir<'tcx>) { + src: MirSource<'tcx>, mir: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, "rustc_mir") { debug!("skipping rustc_peek::SanityCheck on {}", tcx.def_path_str(def_id)); @@ -84,7 +84,7 @@ impl MirPass for SanityCheck { /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, def_id: DefId, _attributes: &[ast::Attribute], results: &DataflowResults<'tcx, O>) @@ -101,7 +101,7 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 14e7895af0419..af2c0c295cc88 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -44,7 +44,7 @@ impl SimplifyCfg { } } -pub fn simplify_cfg(mir: &mut Mir<'_>) { +pub fn simplify_cfg(mir: &mut Body<'_>) { CfgSimplifier::new(mir).simplify(); remove_dead_blocks(mir); @@ -60,7 +60,7 @@ impl MirPass for SimplifyCfg { fn run_pass<'a, 'tcx>(&self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, mir); simplify_cfg(mir); } @@ -72,7 +72,7 @@ pub struct CfgSimplifier<'a, 'tcx: 'a> { } impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { - pub fn new(mir: &'a mut Mir<'tcx>) -> Self { + pub fn new(mir: &'a mut Body<'tcx>) -> Self { let mut pred_count = IndexVec::from_elem(0u32, mir.basic_blocks()); // we can't use mir.predecessors() here because that counts @@ -263,7 +263,7 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { } } -pub fn remove_dead_blocks(mir: &mut Mir<'_>) { +pub fn remove_dead_blocks(mir: &mut Body<'_>) { let mut seen = BitSet::new_empty(mir.basic_blocks().len()); for (bb, _) in traversal::preorder(mir) { seen.insert(bb.index()); @@ -299,7 +299,7 @@ impl MirPass for SimplifyLocals { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let mut marker = DeclMarker { locals: BitSet::new_empty(mir.local_decls.len()) }; marker.visit_mir(mir); // Return pointer and arguments are always live diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index db73e829c53a7..53949bcfcd707 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -22,7 +22,7 @@ impl MirPass for SimplifyBranches { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { for block in mir.basic_blocks_mut() { let terminator = block.terminator_mut(); terminator.kind = match terminator.kind { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 616944dd7ef99..9b4b13959c736 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -40,7 +40,7 @@ impl MirPass for UniformArrayMoveOut { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let mut patch = MirPatch::new(mir); { let mut visitor = UniformArrayMoveOutVisitor{mir, patch: &mut patch, tcx}; @@ -51,7 +51,7 @@ impl MirPass for UniformArrayMoveOut { } struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, + mir: &'a Body<'tcx>, patch: &'a mut MirPatch<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, } @@ -166,7 +166,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource<'tcx>, - mir: &mut Mir<'tcx>) { + mir: &mut Body<'tcx>) { let mut patch = MirPatch::new(mir); { let mut visitor = RestoreDataCollector { @@ -255,7 +255,7 @@ impl RestoreSubsliceArrayMoveOut { } fn try_get_item_source<'a, 'tcx>(local_use: &LocalUse, - mir: &'a Mir<'tcx>) -> Option<(u32, &'a Place<'tcx>)> { + mir: &'a Body<'tcx>) -> Option<(u32, &'a Place<'tcx>)> { if let Some(location) = local_use.first_use { let block = &mir[location.block]; if block.statements.len() > location.statement_index { diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index e334e27cc8556..3f3088ece0422 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -8,7 +8,7 @@ use std::fmt; #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Origin { Ast, - Mir, + Body, } impl fmt::Display for Origin { @@ -25,7 +25,7 @@ impl fmt::Display for Origin { }); if display_origin { match *self { - Origin::Mir => write!(w, " (Mir)"), + Origin::Body => write!(w, " (Body)"), Origin::Ast => write!(w, " (Ast)"), } } else { @@ -40,7 +40,7 @@ impl Origin { pub fn should_emit_errors(self, mode: BorrowckMode) -> bool { match self { Origin::Ast => mode.use_ast(), - Origin::Mir => true, + Origin::Body => true, } } } diff --git a/src/librustc_mir/util/collect_writes.rs b/src/librustc_mir/util/collect_writes.rs index fd94c49dd1d4a..5b769c9434f28 100644 --- a/src/librustc_mir/util/collect_writes.rs +++ b/src/librustc_mir/util/collect_writes.rs @@ -1,5 +1,5 @@ use rustc::mir::{Local, Location}; -use rustc::mir::Mir; +use rustc::mir::Body; use rustc::mir::visit::PlaceContext; use rustc::mir::visit::Visitor; @@ -9,7 +9,7 @@ crate trait FindAssignments { fn find_assignments(&self, local: Local) -> Vec; } -impl<'tcx> FindAssignments for Mir<'tcx>{ +impl<'tcx> FindAssignments for Body<'tcx>{ fn find_assignments(&self, local: Local) -> Vec{ let mut visitor = FindLocalAssignmentVisitor{ needle: local, locations: vec![]}; visitor.visit_mir(self); diff --git a/src/librustc_mir/util/def_use.rs b/src/librustc_mir/util/def_use.rs index 2e41c6e493bc3..f737a6ef4acb4 100644 --- a/src/librustc_mir/util/def_use.rs +++ b/src/librustc_mir/util/def_use.rs @@ -1,6 +1,6 @@ //! Def-use analysis. -use rustc::mir::{Local, Location, Mir}; +use rustc::mir::{Local, Location, Body}; use rustc::mir::visit::{PlaceContext, MutVisitor, Visitor}; use rustc_data_structures::indexed_vec::IndexVec; use std::marker::PhantomData; @@ -24,13 +24,13 @@ pub struct Use<'tcx> { } impl<'tcx> DefUseAnalysis<'tcx> { - pub fn new(mir: &Mir<'tcx>) -> DefUseAnalysis<'tcx> { + pub fn new(mir: &Body<'tcx>) -> DefUseAnalysis<'tcx> { DefUseAnalysis { info: IndexVec::from_elem_n(Info::new(), mir.local_decls.len()), } } - pub fn analyze(&mut self, mir: &Mir<'tcx>) { + pub fn analyze(&mut self, mir: &Body<'tcx>) { self.clear(); let mut finder = DefUseFinder { @@ -50,7 +50,7 @@ impl<'tcx> DefUseAnalysis<'tcx> { &self.info[local] } - fn mutate_defs_and_uses(&self, local: Local, mir: &mut Mir<'tcx>, mut callback: F) + fn mutate_defs_and_uses(&self, local: Local, mir: &mut Body<'tcx>, mut callback: F) where F: for<'a> FnMut(&'a mut Local, PlaceContext<'tcx>, Location) { @@ -64,7 +64,7 @@ impl<'tcx> DefUseAnalysis<'tcx> { // FIXME(pcwalton): this should update the def-use chains. pub fn replace_all_defs_and_uses_with(&self, local: Local, - mir: &mut Mir<'tcx>, + mir: &mut Body<'tcx>, new_local: Local) { self.mutate_defs_and_uses(local, mir, |local, _, _| *local = new_local) } @@ -127,7 +127,7 @@ struct MutateUseVisitor<'tcx, F> { } impl<'tcx, F> MutateUseVisitor<'tcx, F> { - fn new(query: Local, callback: F, _: &Mir<'tcx>) + fn new(query: Local, callback: F, _: &Body<'tcx>) -> MutateUseVisitor<'tcx, F> where F: for<'a> FnMut(&'a mut Local, PlaceContext<'tcx>, Location) { MutateUseVisitor { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 2d275c9a13792..f0b145c6a759d 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -74,7 +74,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { type Path : Copy + fmt::Debug; fn patch(&mut self) -> &mut MirPatch<'tcx>; - fn mir(&self) -> &'a Mir<'tcx>; + fn mir(&self) -> &'a Body<'tcx>; fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; fn param_env(&self) -> ty::ParamEnv<'tcx>; diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index f87714b58c442..f529849af345a 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -35,7 +35,7 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String { /// Write a graphviz DOT graph of the MIR. pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId, - mir: &Mir<'_>, + mir: &Body<'_>, w: &mut W) -> io::Result<()> where W: Write { @@ -69,7 +69,7 @@ pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, /// `init` and `fini` are callbacks for emitting additional rows of /// data (using HTML enclosed with `` in the emitted text). pub fn write_node_label(block: BasicBlock, - mir: &Mir<'_>, + mir: &Body<'_>, w: &mut W, num_cols: u32, init: INIT, @@ -111,7 +111,7 @@ pub fn write_node_label(block: BasicBlock, } /// Write a graphviz DOT node for the given basic block. -fn write_node(block: BasicBlock, mir: &Mir<'_>, w: &mut W) -> io::Result<()> { +fn write_node(block: BasicBlock, mir: &Body<'_>, w: &mut W) -> io::Result<()> { // Start a new node with the label to follow, in one of DOT's pseudo-HTML tables. write!(w, r#" {} [shape="none", label=<"#, node(block))?; write_node_label(block, mir, w, 1, |_| Ok(()), |_| Ok(()))?; @@ -120,7 +120,7 @@ fn write_node(block: BasicBlock, mir: &Mir<'_>, w: &mut W) -> io::Resu } /// Write graphviz DOT edges with labels between the given basic block and all of its successors. -fn write_edges(source: BasicBlock, mir: &Mir<'_>, w: &mut W) -> io::Result<()> { +fn write_edges(source: BasicBlock, mir: &Body<'_>, w: &mut W) -> io::Result<()> { let terminator = mir[source].terminator(); let labels = terminator.kind.fmt_successor_labels(); @@ -136,7 +136,7 @@ fn write_edges(source: BasicBlock, mir: &Mir<'_>, w: &mut W) -> io::Re /// all the variables and temporaries. fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId, - mir: &Mir<'_>, + mir: &Body<'_>, w: &mut W) -> io::Result<()> { write!(w, " label=( - mir: &Mir<'tcx>, + mir: &Body<'tcx>, ) -> LivenessResult { let num_live_vars = mir.local_decls.len(); @@ -259,7 +259,7 @@ pub fn dump_mir<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, result: &LivenessResult, ) { if !dump_enabled(tcx, pass_name, source) { @@ -277,7 +277,7 @@ fn dump_matched_mir_node<'a, 'tcx>( pass_name: &str, node_path: &str, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, result: &LivenessResult, ) { let mut file_path = PathBuf::new(); @@ -298,7 +298,7 @@ fn dump_matched_mir_node<'a, 'tcx>( pub fn write_mir_fn<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, w: &mut dyn Write, result: &LivenessResult, ) -> io::Result<()> { diff --git a/src/librustc_mir/util/patch.rs b/src/librustc_mir/util/patch.rs index 366cd71f6d4e9..974dda867bc9d 100644 --- a/src/librustc_mir/util/patch.rs +++ b/src/librustc_mir/util/patch.rs @@ -17,7 +17,7 @@ pub struct MirPatch<'tcx> { } impl<'tcx> MirPatch<'tcx> { - pub fn new(mir: &Mir<'tcx>) -> Self { + pub fn new(mir: &Body<'tcx>) -> Self { let mut result = MirPatch { patch_map: IndexVec::from_elem(None, mir.basic_blocks()), new_blocks: vec![], @@ -75,7 +75,7 @@ impl<'tcx> MirPatch<'tcx> { self.patch_map[bb].is_some() } - pub fn terminator_loc(&self, mir: &Mir<'tcx>, bb: BasicBlock) -> Location { + pub fn terminator_loc(&self, mir: &Body<'tcx>, bb: BasicBlock) -> Location { let offset = match bb.index().checked_sub(mir.basic_blocks().len()) { Some(index) => self.new_blocks[index].statements.len(), None => mir[bb].statements.len() @@ -127,7 +127,7 @@ impl<'tcx> MirPatch<'tcx> { self.make_nop.push(loc); } - pub fn apply(self, mir: &mut Mir<'tcx>) { + pub fn apply(self, mir: &mut Body<'tcx>) { debug!("MirPatch: make nops at: {:?}", self.make_nop); for loc in self.make_nop { mir.make_statement_nop(loc); @@ -177,7 +177,7 @@ impl<'tcx> MirPatch<'tcx> { } } - pub fn source_info_for_location(&self, mir: &Mir<'_>, loc: Location) -> SourceInfo { + pub fn source_info_for_location(&self, mir: &Body<'_>, loc: Location) -> SourceInfo { let data = match loc.block.index().checked_sub(mir.basic_blocks().len()) { Some(new) => &self.new_blocks[new], None => &mir[loc.block] diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 1f55a728f9c72..9b4d55b31a1b4 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -68,7 +68,7 @@ pub fn dump_mir<'a, 'gcx, 'tcx, F>( pass_name: &str, disambiguator: &dyn Display, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, extra_data: F, ) where F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>, @@ -124,7 +124,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>( node_path: &str, disambiguator: &dyn Display, source: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, mut extra_data: F, ) where F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>, @@ -282,7 +282,7 @@ pub fn write_mir_pretty<'a, 'gcx, 'tcx>( pub fn write_mir_fn<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, src: MirSource<'tcx>, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, extra_data: &mut F, w: &mut dyn Write, ) -> io::Result<()> @@ -306,7 +306,7 @@ where pub fn write_basic_block<'cx, 'gcx, 'tcx, F>( tcx: TyCtxt<'cx, 'gcx, 'tcx>, block: BasicBlock, - mir: &Mir<'tcx>, + mir: &Body<'tcx>, extra_data: &mut F, w: &mut dyn Write, ) -> io::Result<()> @@ -464,7 +464,7 @@ fn comment(tcx: TyCtxt<'_, '_, '_>, SourceInfo { span, scope }: SourceInfo) -> S /// Prints local variables in a scope tree. fn write_scope_tree( tcx: TyCtxt<'_, '_, '_>, - mir: &Mir<'_>, + mir: &Body<'_>, scope_tree: &FxHashMap>, w: &mut dyn Write, parent: SourceScope, @@ -541,7 +541,7 @@ fn write_scope_tree( pub fn write_mir_intro<'a, 'gcx, 'tcx>( tcx: TyCtxt<'a, 'gcx, 'tcx>, src: MirSource<'tcx>, - mir: &Mir<'_>, + mir: &Body<'_>, w: &mut dyn Write, ) -> io::Result<()> { write_mir_sig(tcx, src, mir, w)?; @@ -572,7 +572,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>( fn write_mir_sig( tcx: TyCtxt<'_, '_, '_>, src: MirSource<'tcx>, - mir: &Mir<'_>, + mir: &Body<'_>, w: &mut dyn Write, ) -> io::Result<()> { use rustc::hir::def::Def; @@ -626,7 +626,7 @@ fn write_mir_sig( Ok(()) } -fn write_user_type_annotations(mir: &Mir<'_>, w: &mut dyn Write) -> io::Result<()> { +fn write_user_type_annotations(mir: &Body<'_>, w: &mut dyn Write) -> io::Result<()> { if !mir.user_type_annotations.is_empty() { writeln!(w, "| User Type Annotations")?; } diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs index 55dd37451235a..84fab1842fa6d 100644 --- a/src/test/incremental/hashes/call_expressions.rs +++ b/src/test/incremental/hashes/call_expressions.rs @@ -151,8 +151,8 @@ pub fn change_to_ufcs() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,mir_built,optimized_mir,typeck_tables_of")] #[rustc_clean(cfg="cfail3")] -// One might think this would be expanded in the HirBody/Mir, but it actually -// results in slightly different Hir/Mir. +// One might think this would be expanded in the HirBody/Body, but it actually +// results in slightly different Hir/Body. pub fn change_to_ufcs() { let s = Struct; Struct::method1(&s, 'x', true); diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr index e881201ddfcc0..1536d388c374e 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr @@ -73,7 +73,7 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f)); LL | } | - first borrow ends here -error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `x` as mutable more than once at a time (Body) --> $DIR/borrowck-closures-two-mut.rs:14:24 | LL | let c1 = to_fn_mut(|| x = 4); @@ -88,7 +88,7 @@ LL | LL | drop((c1, c2)); | -- first borrow later used here -error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `x` as mutable more than once at a time (Body) --> $DIR/borrowck-closures-two-mut.rs:26:24 | LL | let c1 = to_fn_mut(|| set(&mut x)); @@ -103,7 +103,7 @@ LL | LL | drop((c1, c2)); | -- first borrow later used here -error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `x` as mutable more than once at a time (Body) --> $DIR/borrowck-closures-two-mut.rs:34:24 | LL | let c1 = to_fn_mut(|| x = 5); @@ -118,7 +118,7 @@ LL | LL | drop((c1, c2)); | -- first borrow later used here -error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `x` as mutable more than once at a time (Body) --> $DIR/borrowck-closures-two-mut.rs:42:24 | LL | let c1 = to_fn_mut(|| x = 5); @@ -133,7 +133,7 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes LL | drop((c1, c2)); | -- first borrow later used here -error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `x` as mutable more than once at a time (Body) --> $DIR/borrowck-closures-two-mut.rs:55:24 | LL | let c1 = to_fn_mut(|| set(&mut *x.f)); diff --git a/src/test/ui/borrowck/borrowck-reinit.rs b/src/test/ui/borrowck/borrowck-reinit.rs index e8e38a92c81e9..0ca0a9cb48ffd 100644 --- a/src/test/ui/borrowck/borrowck-reinit.rs +++ b/src/test/ui/borrowck/borrowck-reinit.rs @@ -6,5 +6,5 @@ fn main() { x = Box::new(1); drop(x); let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) - //~^ ERROR use of moved value: `x` (Mir) + //~^ ERROR use of moved value: `x` (Body) } diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 3618a7cb2cd39..6fc4f8fffdc8d 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -8,7 +8,7 @@ LL | let _ = (1,x); | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `x` (Mir) +error[E0382]: use of moved value: `x` (Body) --> $DIR/borrowck-reinit.rs:8:16 | LL | let mut x = Box::new(0); diff --git a/src/test/ui/borrowck/borrowck-storage-dead.rs b/src/test/ui/borrowck/borrowck-storage-dead.rs index 72c3bc1371985..bb1898fce2ab6 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.rs +++ b/src/test/ui/borrowck/borrowck-storage-dead.rs @@ -16,7 +16,7 @@ fn fail() { loop { let x: i32; let _ = x + 1; //~ERROR (Ast) [E0381] - //~^ ERROR (Mir) [E0381] + //~^ ERROR (Body) [E0381] } } diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr index c291ed224eb3c..ca63ad562093c 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.stderr +++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr @@ -4,7 +4,7 @@ error[E0381]: use of possibly uninitialized variable: `x` (Ast) LL | let _ = x + 1; | ^ use of possibly uninitialized `x` -error[E0381]: use of possibly uninitialized variable: `x` (Mir) +error[E0381]: use of possibly uninitialized variable: `x` (Body) --> $DIR/borrowck-storage-dead.rs:18:17 | LL | let _ = x + 1; diff --git a/src/test/ui/borrowck/immutable-arg.rs b/src/test/ui/borrowck/immutable-arg.rs index 8d1cd3c80455c..5b9ec4634f6d4 100644 --- a/src/test/ui/borrowck/immutable-arg.rs +++ b/src/test/ui/borrowck/immutable-arg.rs @@ -2,7 +2,7 @@ fn foo(_x: u32) { _x = 4; - //~^ ERROR cannot assign to immutable argument `_x` (Mir) + //~^ ERROR cannot assign to immutable argument `_x` (Body) //~^^ ERROR cannot assign twice to immutable variable `_x` (Ast) } diff --git a/src/test/ui/borrowck/immutable-arg.stderr b/src/test/ui/borrowck/immutable-arg.stderr index 8b21e92666674..d64fbb7337e17 100644 --- a/src/test/ui/borrowck/immutable-arg.stderr +++ b/src/test/ui/borrowck/immutable-arg.stderr @@ -6,7 +6,7 @@ LL | fn foo(_x: u32) { LL | _x = 4; | ^^^^^^ cannot assign twice to immutable variable -error[E0384]: cannot assign to immutable argument `_x` (Mir) +error[E0384]: cannot assign to immutable argument `_x` (Body) --> $DIR/immutable-arg.rs:4:5 | LL | fn foo(_x: u32) { diff --git a/src/test/ui/borrowck/issue-41962.rs b/src/test/ui/borrowck/issue-41962.rs index 2bcc074542d17..9e72bc649035a 100644 --- a/src/test/ui/borrowck/issue-41962.rs +++ b/src/test/ui/borrowck/issue-41962.rs @@ -8,6 +8,6 @@ pub fn main(){ } //~^^ ERROR use of partially moved value: `maybe` (Ast) [E0382] //~| ERROR use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast) [E0382] - //~| ERROR use of moved value (Mir) [E0382] + //~| ERROR use of moved value (Body) [E0382] } } diff --git a/src/test/ui/borrowck/issue-41962.stderr b/src/test/ui/borrowck/issue-41962.stderr index fd4d318b5ddf1..8acb850d12327 100644 --- a/src/test/ui/borrowck/issue-41962.stderr +++ b/src/test/ui/borrowck/issue-41962.stderr @@ -16,7 +16,7 @@ LL | if let Some(thing) = maybe { | = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait -error[E0382]: use of moved value (Mir) +error[E0382]: use of moved value (Body) --> $DIR/issue-41962.rs:7:21 | LL | if let Some(thing) = maybe { diff --git a/src/test/ui/generator/yield-while-local-borrowed.rs b/src/test/ui/generator/yield-while-local-borrowed.rs index 38061e71358c4..e4ea375ea9568 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.rs +++ b/src/test/ui/generator/yield-while-local-borrowed.rs @@ -14,7 +14,7 @@ fn borrow_local_inline() { let mut b = move || { let a = &mut 3; //~^ ERROR borrow may still be in use when generator yields (Ast) - //~| ERROR borrow may still be in use when generator yields (Mir) + //~| ERROR borrow may still be in use when generator yields (Body) yield(); println!("{}", a); }; @@ -42,7 +42,7 @@ fn borrow_local() { { let b = &a; //~^ ERROR borrow may still be in use when generator yields (Ast) - //~| ERROR borrow may still be in use when generator yields (Mir) + //~| ERROR borrow may still be in use when generator yields (Body) yield(); println!("{}", b); } diff --git a/src/test/ui/generator/yield-while-local-borrowed.stderr b/src/test/ui/generator/yield-while-local-borrowed.stderr index 56f425b7e70a0..fe6d1152a0f92 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.stderr +++ b/src/test/ui/generator/yield-while-local-borrowed.stderr @@ -16,7 +16,7 @@ LL | let b = &a; LL | yield(); | ------- possible yield occurs here -error[E0626]: borrow may still be in use when generator yields (Mir) +error[E0626]: borrow may still be in use when generator yields (Body) --> $DIR/yield-while-local-borrowed.rs:15:17 | LL | let a = &mut 3; @@ -25,7 +25,7 @@ LL | let a = &mut 3; LL | yield(); | ------- possible yield occurs here -error[E0626]: borrow may still be in use when generator yields (Mir) +error[E0626]: borrow may still be in use when generator yields (Body) --> $DIR/yield-while-local-borrowed.rs:43:21 | LL | let b = &a; diff --git a/src/test/ui/issues/issue-45697-1.rs b/src/test/ui/issues/issue-45697-1.rs index c9b267ca5a10a..7ea77d18d67fe 100644 --- a/src/test/ui/issues/issue-45697-1.rs +++ b/src/test/ui/issues/issue-45697-1.rs @@ -19,8 +19,8 @@ fn main() { let z = copy_borrowed_ptr(&mut y); *y.pointer += 1; //~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506] - //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503] - //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506] + //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Body) [E0503] + //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Body) [E0506] *z.pointer += 1; } } diff --git a/src/test/ui/issues/issue-45697-1.stderr b/src/test/ui/issues/issue-45697-1.stderr index 854e18003f330..ab3e91c65655b 100644 --- a/src/test/ui/issues/issue-45697-1.stderr +++ b/src/test/ui/issues/issue-45697-1.stderr @@ -6,7 +6,7 @@ LL | let z = copy_borrowed_ptr(&mut y); LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here -error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir) +error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Body) --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); @@ -17,7 +17,7 @@ LL | *y.pointer += 1; LL | *z.pointer += 1; | --------------- borrow later used here -error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir) +error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Body) --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); diff --git a/src/test/ui/issues/issue-45697.rs b/src/test/ui/issues/issue-45697.rs index 5bb30432fede4..36e005af4552b 100644 --- a/src/test/ui/issues/issue-45697.rs +++ b/src/test/ui/issues/issue-45697.rs @@ -19,8 +19,8 @@ fn main() { let z = copy_borrowed_ptr(&mut y); *y.pointer += 1; //~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506] - //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503] - //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506] + //~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Body) [E0503] + //~| ERROR cannot assign to `*y.pointer` because it is borrowed (Body) [E0506] *z.pointer += 1; } } diff --git a/src/test/ui/issues/issue-45697.stderr b/src/test/ui/issues/issue-45697.stderr index 01ae416b1cf14..9d339f4cfc393 100644 --- a/src/test/ui/issues/issue-45697.stderr +++ b/src/test/ui/issues/issue-45697.stderr @@ -6,7 +6,7 @@ LL | let z = copy_borrowed_ptr(&mut y); LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here -error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir) +error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Body) --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); @@ -17,7 +17,7 @@ LL | *y.pointer += 1; LL | *z.pointer += 1; | --------------- borrow later used here -error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir) +error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Body) --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); diff --git a/src/test/ui/issues/issue-46471-1.rs b/src/test/ui/issues/issue-46471-1.rs index 3cf3f35284951..7c09f5b878dc8 100644 --- a/src/test/ui/issues/issue-46471-1.rs +++ b/src/test/ui/issues/issue-46471-1.rs @@ -6,6 +6,6 @@ fn main() { &mut z }; //~^^ ERROR `z` does not live long enough (Ast) [E0597] - //~| ERROR `z` does not live long enough (Mir) [E0597] + //~| ERROR `z` does not live long enough (Body) [E0597] println!("{}", y); } diff --git a/src/test/ui/issues/issue-46471-1.stderr b/src/test/ui/issues/issue-46471-1.stderr index 51026c9f2d834..5885bc8d212d0 100644 --- a/src/test/ui/issues/issue-46471-1.stderr +++ b/src/test/ui/issues/issue-46471-1.stderr @@ -9,7 +9,7 @@ LL | }; LL | } | - borrowed value needs to live until here -error[E0597]: `z` does not live long enough (Mir) +error[E0597]: `z` does not live long enough (Body) --> $DIR/issue-46471-1.rs:6:9 | LL | &mut z diff --git a/src/test/ui/issues/issue-46471.rs b/src/test/ui/issues/issue-46471.rs index 0905c8bb1eb12..c588c58c7fb68 100644 --- a/src/test/ui/issues/issue-46471.rs +++ b/src/test/ui/issues/issue-46471.rs @@ -4,7 +4,7 @@ fn foo() -> &'static u32 { let x = 0; &x //~^ ERROR `x` does not live long enough (Ast) [E0597] - //~| ERROR cannot return reference to local variable `x` (Mir) [E0515] + //~| ERROR cannot return reference to local variable `x` (Body) [E0515] } fn main() { } diff --git a/src/test/ui/issues/issue-46471.stderr b/src/test/ui/issues/issue-46471.stderr index 90202e307eb11..9d68be550e0dd 100644 --- a/src/test/ui/issues/issue-46471.stderr +++ b/src/test/ui/issues/issue-46471.stderr @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0515]: cannot return reference to local variable `x` (Mir) +error[E0515]: cannot return reference to local variable `x` (Body) --> $DIR/issue-46471.rs:5:5 | LL | &x diff --git a/src/test/ui/issues/issue-46472.rs b/src/test/ui/issues/issue-46472.rs index 88f97e99aeaff..772babb424e4b 100644 --- a/src/test/ui/issues/issue-46472.rs +++ b/src/test/ui/issues/issue-46472.rs @@ -3,7 +3,7 @@ fn bar<'a>() -> &'a mut u32 { &mut 4 //~^ ERROR borrowed value does not live long enough (Ast) [E0597] - //~| ERROR cannot return reference to temporary value (Mir) [E0515] + //~| ERROR cannot return reference to temporary value (Body) [E0515] } fn main() { } diff --git a/src/test/ui/issues/issue-46472.stderr b/src/test/ui/issues/issue-46472.stderr index 0cc93a081b2af..7c3907fcf1184 100644 --- a/src/test/ui/issues/issue-46472.stderr +++ b/src/test/ui/issues/issue-46472.stderr @@ -13,7 +13,7 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn bar<'a>() -> &'a mut u32 { | ^^ -error[E0515]: cannot return reference to temporary value (Mir) +error[E0515]: cannot return reference to temporary value (Body) --> $DIR/issue-46472.rs:4:5 | LL | &mut 4 diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs index 99949e17b6f4a..e3decf34a5ab0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs @@ -11,7 +11,7 @@ fn test() { } else { x = 2; x = 3; //~ ERROR (Ast) [E0384] - //~^ ERROR (Mir) [E0384] + //~^ ERROR (Body) [E0384] } } @@ -23,7 +23,7 @@ fn test_in_loop() { } else { x = 2; x = 3; //~ ERROR (Ast) [E0384] - //~^ ERROR (Mir) [E0384] + //~^ ERROR (Body) [E0384] } } } @@ -33,10 +33,10 @@ fn test_using_loop() { loop { if true { x = 1; //~ ERROR (Ast) [E0384] - //~^ ERROR (Mir) [E0384] + //~^ ERROR (Body) [E0384] } else { x = 2; //~ ERROR (Ast) [E0384] - //~^ ERROR (Mir) [E0384] + //~^ ERROR (Body) [E0384] } } } diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr index e15290f0b9ee9..9245c5067dbe8 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -29,7 +29,7 @@ LL | x = 1; LL | x = 2; | ^^^^^ cannot assign twice to immutable variable -error[E0384]: cannot assign twice to immutable variable `x` (Mir) +error[E0384]: cannot assign twice to immutable variable `x` (Body) --> $DIR/liveness-assign-imm-local-notes.rs:13:9 | LL | let x; @@ -40,7 +40,7 @@ LL | x = 2; LL | x = 3; | ^^^^^ cannot assign twice to immutable variable -error[E0384]: cannot assign twice to immutable variable `x` (Mir) +error[E0384]: cannot assign twice to immutable variable `x` (Body) --> $DIR/liveness-assign-imm-local-notes.rs:25:13 | LL | let x; @@ -51,7 +51,7 @@ LL | x = 2; LL | x = 3; | ^^^^^ cannot assign twice to immutable variable -error[E0384]: cannot assign twice to immutable variable `x` (Mir) +error[E0384]: cannot assign twice to immutable variable `x` (Body) --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | LL | let x; @@ -60,7 +60,7 @@ LL | let x; LL | x = 1; | ^^^^^ cannot assign twice to immutable variable -error[E0384]: cannot assign twice to immutable variable `x` (Mir) +error[E0384]: cannot assign twice to immutable variable `x` (Body) --> $DIR/liveness-assign-imm-local-notes.rs:38:13 | LL | let x; diff --git a/src/test/ui/moves/moves-based-on-type-tuple.rs b/src/test/ui/moves/moves-based-on-type-tuple.rs index d99fe51931a1f..cfc2da2956794 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.rs +++ b/src/test/ui/moves/moves-based-on-type-tuple.rs @@ -5,7 +5,7 @@ fn dup(x: Box) -> Box<(Box,Box)> { box (x, x) //~^ use of moved value: `x` (Ast) [E0382] - //~| use of moved value: `x` (Mir) [E0382] + //~| use of moved value: `x` (Body) [E0382] } fn main() { diff --git a/src/test/ui/moves/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr index c49dbdab40210..64865fd05ffb1 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.stderr +++ b/src/test/ui/moves/moves-based-on-type-tuple.stderr @@ -8,7 +8,7 @@ LL | box (x, x) | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `x` (Mir) +error[E0382]: use of moved value: `x` (Body) --> $DIR/moves-based-on-type-tuple.rs:6:13 | LL | fn dup(x: Box) -> Box<(Box,Box)> { diff --git a/src/test/ui/nll/get_default.rs b/src/test/ui/nll/get_default.rs index 89f693bfb654e..db402adb312dc 100644 --- a/src/test/ui/nll/get_default.rs +++ b/src/test/ui/nll/get_default.rs @@ -22,7 +22,7 @@ fn ok(map: &mut Map) -> &String { None => { map.set(String::new()); // Ideally, this would not error. //~^ ERROR borrowed as immutable (Ast) - //~| ERROR borrowed as immutable (Mir) + //~| ERROR borrowed as immutable (Body) } } } @@ -33,14 +33,14 @@ fn err(map: &mut Map) -> &String { match map.get() { Some(v) => { map.set(String::new()); // Both AST and MIR error here - //~^ ERROR borrowed as immutable (Mir) + //~^ ERROR borrowed as immutable (Body) //~| ERROR borrowed as immutable (Ast) return v; } None => { map.set(String::new()); // Ideally, just AST would error here //~^ ERROR borrowed as immutable (Ast) - //~| ERROR borrowed as immutable (Mir) + //~| ERROR borrowed as immutable (Body) } } } diff --git a/src/test/ui/nll/get_default.stderr b/src/test/ui/nll/get_default.stderr index abb5343845b57..40c6437f13a47 100644 --- a/src/test/ui/nll/get_default.stderr +++ b/src/test/ui/nll/get_default.stderr @@ -34,7 +34,7 @@ LL | map.set(String::new()); // Ideally, just AST would error he LL | } | - immutable borrow ends here -error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Body) --> $DIR/get_default.rs:23:17 | LL | fn ok(map: &mut Map) -> &String { @@ -49,7 +49,7 @@ LL | return v; LL | map.set(String::new()); // Ideally, this would not error. | ^^^ mutable borrow occurs here -error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Body) --> $DIR/get_default.rs:35:17 | LL | fn err(map: &mut Map) -> &String { @@ -64,7 +64,7 @@ LL | map.set(String::new()); // Both AST and MIR error here LL | return v; | - returning this value requires that `*map` is borrowed for `'1` -error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Body) --> $DIR/get_default.rs:41:17 | LL | fn err(map: &mut Map) -> &String { diff --git a/src/test/ui/nll/loan_ends_mid_block_pair.rs b/src/test/ui/nll/loan_ends_mid_block_pair.rs index bad214deac129..30723340b8b45 100644 --- a/src/test/ui/nll/loan_ends_mid_block_pair.rs +++ b/src/test/ui/nll/loan_ends_mid_block_pair.rs @@ -13,7 +13,7 @@ fn nll_fail() { capitalize(c); data.0 = 'e'; //~^ ERROR (Ast) [E0506] - //~| ERROR (Mir) [E0506] + //~| ERROR (Body) [E0506] data.0 = 'f'; //~^ ERROR (Ast) [E0506] data.0 = 'g'; diff --git a/src/test/ui/nll/loan_ends_mid_block_pair.stderr b/src/test/ui/nll/loan_ends_mid_block_pair.stderr index 85703bda31c4e..b0e5d2c0c97ca 100644 --- a/src/test/ui/nll/loan_ends_mid_block_pair.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_pair.stderr @@ -52,7 +52,7 @@ LL | let c = &mut data.0; LL | data.0 = 'g'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here -error[E0506]: cannot assign to `data.0` because it is borrowed (Mir) +error[E0506]: cannot assign to `data.0` because it is borrowed (Body) --> $DIR/loan_ends_mid_block_pair.rs:14:5 | LL | let c = &mut data.0; diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.rs b/src/test/ui/nll/loan_ends_mid_block_vec.rs index 682e7e3e96fee..73d2c8102b85f 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.rs +++ b/src/test/ui/nll/loan_ends_mid_block_vec.rs @@ -12,13 +12,13 @@ fn nll_fail() { capitalize(slice); data.push('d'); //~^ ERROR (Ast) [E0499] - //~| ERROR (Mir) [E0499] + //~| ERROR (Body) [E0499] data.push('e'); //~^ ERROR (Ast) [E0499] - //~| ERROR (Mir) [E0499] + //~| ERROR (Body) [E0499] data.push('f'); //~^ ERROR (Ast) [E0499] - //~| ERROR (Mir) [E0499] + //~| ERROR (Body) [E0499] capitalize(slice); } diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.stderr b/src/test/ui/nll/loan_ends_mid_block_vec.stderr index a3f1391f00140..b599945733b48 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_vec.stderr @@ -70,7 +70,7 @@ LL | LL | } | - first borrow ends here -error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `data` as mutable more than once at a time (Body) --> $DIR/loan_ends_mid_block_vec.rs:13:5 | LL | let slice = &mut data; @@ -82,7 +82,7 @@ LL | data.push('d'); LL | capitalize(slice); | ----- first borrow later used here -error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `data` as mutable more than once at a time (Body) --> $DIR/loan_ends_mid_block_vec.rs:16:5 | LL | let slice = &mut data; @@ -94,7 +94,7 @@ LL | data.push('e'); LL | capitalize(slice); | ----- first borrow later used here -error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `data` as mutable more than once at a time (Body) --> $DIR/loan_ends_mid_block_vec.rs:19:5 | LL | let slice = &mut data; diff --git a/src/test/ui/nll/region-ends-after-if-condition.rs b/src/test/ui/nll/region-ends-after-if-condition.rs index 1bf13a91b9116..7e8473f6e0e2c 100644 --- a/src/test/ui/nll/region-ends-after-if-condition.rs +++ b/src/test/ui/nll/region-ends-after-if-condition.rs @@ -28,7 +28,7 @@ fn foo2() { if value.is_empty() { my_struct.field.push_str("Hello, world!"); //~^ ERROR (Ast) [E0502] - //~| ERROR (Mir) [E0502] + //~| ERROR (Body) [E0502] } drop(value); } diff --git a/src/test/ui/nll/region-ends-after-if-condition.stderr b/src/test/ui/nll/region-ends-after-if-condition.stderr index aa876a0bcb3bf..be69f046ed937 100644 --- a/src/test/ui/nll/region-ends-after-if-condition.stderr +++ b/src/test/ui/nll/region-ends-after-if-condition.stderr @@ -22,7 +22,7 @@ LL | my_struct.field.push_str("Hello, world!"); LL | } | - immutable borrow ends here -error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir) +error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Body) --> $DIR/region-ends-after-if-condition.rs:29:9 | LL | let value = &my_struct.field; diff --git a/src/test/ui/nll/return_from_loop.rs b/src/test/ui/nll/return_from_loop.rs index 23a1e0b816cbd..f7533b6743443 100644 --- a/src/test/ui/nll/return_from_loop.rs +++ b/src/test/ui/nll/return_from_loop.rs @@ -21,7 +21,7 @@ fn nll_fail() { loop { my_struct.field.push_str("Hello, world!"); //~^ ERROR (Ast) [E0499] - //~| ERROR (Mir) [E0499] + //~| ERROR (Body) [E0499] value.len(); return; } diff --git a/src/test/ui/nll/return_from_loop.stderr b/src/test/ui/nll/return_from_loop.stderr index 09882d55cb70e..eca5fb8042859 100644 --- a/src/test/ui/nll/return_from_loop.stderr +++ b/src/test/ui/nll/return_from_loop.stderr @@ -22,7 +22,7 @@ LL | my_struct.field.push_str("Hello, world!"); LL | } | - first borrow ends here -error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Mir) +error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Body) --> $DIR/return_from_loop.rs:22:9 | LL | let value = &mut my_struct.field;