Skip to content

Commit

Permalink
rustc: rename Mir to mir::Body in comments and to MIR in error strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed May 28, 2019
1 parent 6e5e0da commit 3e5beb2
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `mir::Body`.
pub promoted: Option<mir::Promoted>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,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 `mir::Body::invalidate` for
// each basic block.
macro_rules! basic_blocks {
(mut) => (mir.basic_blocks_mut().iter_enumerated_mut());
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `mir::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, &'tcx BitSet<mir::Local>) {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/steal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard};
/// optimization, but that'd be expensive. And yet we don't just want
/// to mutate it in place, because that would spoil the idea that
/// 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<Body<'tcx>>` (to be very specific). Now we can read from this
/// (since if you did the query twice, you could observe the mutations).
/// So instead we have the query produce a `&'tcx Steal<mir::Body<'tcx>>`
/// (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
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<'
build::construct_const(cx, body_id, return_ty, return_ty_span)
};

// Convert the Mir to global types.
// Convert the `mir::Body` to global types.
let mut globalizer = GlobalizeMir {
tcx,
span: mir.span
Expand Down Expand Up @@ -243,7 +243,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
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 `mir::Body` to global types.
let tcx = infcx.tcx.global_tcx();
let mut globalizer = GlobalizeMir {
tcx,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 `mir::Body`.
control_flow_destroyed: Vec<(Span, String)>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn mir_built<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea
tcx.alloc_steal_mir(mir)
}

/// Where a specific Mir comes from.
/// Where a specific `mir::Body` comes from.
#[derive(Debug, Copy, Clone)]
pub struct MirSource<'tcx> {
pub instance: InstanceDef<'tcx>,
Expand Down Expand Up @@ -228,7 +228,7 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
}

fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
// `mir_borrowck` uses `mir_validated`, so we have to force it to
// execute before we can steal.
tcx.ensure().mir_borrowck(def_id);

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Body<'tcx>,
}


// Declare return place local so that `Body::new` doesn't complain.
// Declare return place local so that `mir::Body::new` doesn't complain.
let initial_locals = iter::once(
LocalDecl::new_return_place(tcx.types.never, mir.span)
).collect();
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,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: MIR had errors");
return (1 << IsNotPromotable::IDX, tcx.arena.alloc(BitSet::new_empty(0)));
}

Expand All @@ -1447,7 +1447,7 @@ impl MirPass for QualifyAndPromoteConstants {
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: MIR had errors");
return;
}

Expand Down

0 comments on commit 3e5beb2

Please sign in to comment.