Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames mir::Mir to mir::Body #60242

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix the comments from Body -> mir::Body
marimeireles committed Apr 26, 2019
commit 570405bee2da7f610529cf23412fba2ef0f0237b
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ pub struct Body<'tcx> {
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,

/// Rvalues promoted from this function, such as borrows of constants.
/// Each of them is the Body of a constant with the fn's type parameters
/// Each of them is the mir::Body of a constant with the fn's type parameters
/// in scope, but a separate set of locals.
pub promoted: IndexVec<Promoted, Body<'tcx>>,

2 changes: 1 addition & 1 deletion src/librustc/mir/visit.rs
Original file line number Diff line number Diff line change
@@ -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 Body::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());
2 changes: 1 addition & 1 deletion src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ rustc_queries! {
desc { "getting a list of all mir_keys" }
}

/// Maps DefId's that have an associated Body 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, Lrc<BitSet<mir::Local>>) {
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/mod.rs
Original file line number Diff line number Diff line change
@@ -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 `Body`.
/// See field with the same name on `mir::Body`.
control_flow_destroyed: Vec<(Span, String)>,
}

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

/// Where a specific Body comes from.
/// Where a specific mir::Body comes from.
#[derive(Debug, Copy, Clone)]
pub struct MirSource<'tcx> {
pub instance: InstanceDef<'tcx>,
@@ -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> {
// (Body-)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> {
// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
// execute before we can steal.
tcx.ensure().mir_borrowck(def_id);

2 changes: 1 addition & 1 deletion src/librustc_mir/transform/promote_consts.rs
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 2 additions & 2 deletions src/test/incremental/hashes/call_expressions.rs
Original file line number Diff line number Diff line change
@@ -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/Body, but it actually
// results in slightly different Hir/Body.
// One might think this would be expanded in the {hir,mir}::Body, but it actually
// results in slightly different {hir,mir}::Body.
pub fn change_to_ufcs() {
let s = Struct;
Struct::method1(&s, 'x', true);
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-reinit.rs
Original file line number Diff line number Diff line change
@@ -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` (Body)
//~^ ERROR use of moved value: `x` (mir::Body)
}
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-storage-dead.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ fn fail() {
loop {
let x: i32;
let _ = x + 1; //~ERROR (Ast) [E0381]
//~^ ERROR (Body) [E0381]
//~^ ERROR (mir::Body) [E0381]
}
}

2 changes: 1 addition & 1 deletion src/test/ui/borrowck/immutable-arg.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

fn foo(_x: u32) {
_x = 4;
//~^ ERROR cannot assign to immutable argument `_x` (Body)
//~^ ERROR cannot assign to immutable argument `_x` (mir::Body)
//~^^ ERROR cannot assign twice to immutable variable `_x` (Ast)
}

2 changes: 1 addition & 1 deletion src/test/ui/borrowck/issue-41962.rs
Original file line number Diff line number Diff line change
@@ -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 (Body) [E0382]
//~| ERROR use of moved value (mir::Body) [E0382]
}
}
4 changes: 2 additions & 2 deletions src/test/ui/generator/yield-while-local-borrowed.rs
Original file line number Diff line number Diff line change
@@ -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 (Body)
//~| ERROR borrow may still be in use when generator yields (mir::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 (Body)
//~| ERROR borrow may still be in use when generator yields (mir::Body)
yield();
println!("{}", b);
}
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-45697-1.rs
Original file line number Diff line number Diff line change
@@ -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 (Body) [E0503]
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (Body) [E0506]
//~| ERROR cannot use `*y.pointer` because it was mutably borrowed (mir::Body) [E0503]
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (mir::Body) [E0506]
*z.pointer += 1;
}
}
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-45697.rs
Original file line number Diff line number Diff line change
@@ -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 (Body) [E0503]
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (Body) [E0506]
//~| ERROR cannot use `*y.pointer` because it was mutably borrowed (mir::Body) [E0503]
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (mir::Body) [E0506]
*z.pointer += 1;
}
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-46471-1.rs
Original file line number Diff line number Diff line change
@@ -6,6 +6,6 @@ fn main() {
&mut z
};
//~^^ ERROR `z` does not live long enough (Ast) [E0597]
//~| ERROR `z` does not live long enough (Body) [E0597]
//~| ERROR `z` does not live long enough (mir::Body) [E0597]
println!("{}", y);
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-46471.rs
Original file line number Diff line number Diff line change
@@ -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` (Body) [E0515]
//~| ERROR cannot return reference to local variable `x` (mir::Body) [E0515]
}

fn main() { }
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-46472.rs
Original file line number Diff line number Diff line change
@@ -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 (Body) [E0515]
//~| ERROR cannot return reference to temporary value (mir::Body) [E0515]
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ fn test() {
} else {
x = 2;
x = 3; //~ ERROR (Ast) [E0384]
//~^ ERROR (Body) [E0384]
//~^ ERROR (mir::Body) [E0384]
}
}

@@ -23,7 +23,7 @@ fn test_in_loop() {
} else {
x = 2;
x = 3; //~ ERROR (Ast) [E0384]
//~^ ERROR (Body) [E0384]
//~^ ERROR (mir::Body) [E0384]
}
}
}
@@ -33,10 +33,10 @@ fn test_using_loop() {
loop {
if true {
x = 1; //~ ERROR (Ast) [E0384]
//~^ ERROR (Body) [E0384]
//~^ ERROR (mir::Body) [E0384]
} else {
x = 2; //~ ERROR (Ast) [E0384]
//~^ ERROR (Body) [E0384]
//~^ ERROR (mir::Body) [E0384]
}
}
}
2 changes: 1 addition & 1 deletion src/test/ui/moves/moves-based-on-type-tuple.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> {
box (x, x)
//~^ use of moved value: `x` (Ast) [E0382]
//~| use of moved value: `x` (Body) [E0382]
//~| use of moved value: `x` (mir::Body) [E0382]
}

fn main() {
6 changes: 3 additions & 3 deletions src/test/ui/nll/get_default.rs
Original file line number Diff line number Diff line change
@@ -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 (Body)
//~| ERROR borrowed as immutable (mir::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 (Body)
//~^ ERROR borrowed as immutable (mir::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 (Body)
//~| ERROR borrowed as immutable (mir::Body)
}
}
}
2 changes: 1 addition & 1 deletion src/test/ui/nll/loan_ends_mid_block_pair.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ fn nll_fail() {
capitalize(c);
data.0 = 'e';
//~^ ERROR (Ast) [E0506]
//~| ERROR (Body) [E0506]
//~| ERROR (mir::Body) [E0506]
data.0 = 'f';
//~^ ERROR (Ast) [E0506]
data.0 = 'g';
6 changes: 3 additions & 3 deletions src/test/ui/nll/loan_ends_mid_block_vec.rs
Original file line number Diff line number Diff line change
@@ -12,13 +12,13 @@ fn nll_fail() {
capitalize(slice);
data.push('d');
//~^ ERROR (Ast) [E0499]
//~| ERROR (Body) [E0499]
//~| ERROR (mir::Body) [E0499]
data.push('e');
//~^ ERROR (Ast) [E0499]
//~| ERROR (Body) [E0499]
//~| ERROR (mir::Body) [E0499]
data.push('f');
//~^ ERROR (Ast) [E0499]
//~| ERROR (Body) [E0499]
//~| ERROR (mir::Body) [E0499]
capitalize(slice);
}

2 changes: 1 addition & 1 deletion src/test/ui/nll/region-ends-after-if-condition.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ fn foo2() {
if value.is_empty() {
my_struct.field.push_str("Hello, world!");
//~^ ERROR (Ast) [E0502]
//~| ERROR (Body) [E0502]
//~| ERROR (mir::Body) [E0502]
}
drop(value);
}
2 changes: 1 addition & 1 deletion src/test/ui/nll/return_from_loop.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ fn nll_fail() {
loop {
my_struct.field.push_str("Hello, world!");
//~^ ERROR (Ast) [E0499]
//~| ERROR (Body) [E0499]
//~| ERROR (mir::Body) [E0499]
value.len();
return;
}