introduce idea of "stealable" MIR
This is a more principled version of the `RefCell` we were using before. We now allocate a `Steal<Mir<'tcx>>` for each intermediate MIR pass; when the next pass steals the entry, any later attempts to use it will panic (there is no way to *test* if MIR is stolen, you're just supposed to *know*).
This commit is contained in:
parent
e89a321dff
commit
29263fdb54
12 changed files with 93 additions and 66 deletions
|
|
@ -30,7 +30,6 @@ use rustc::util::nodemap::{NodeSet, DefIdMap};
|
|||
use rustc_back::PanicStrategy;
|
||||
|
||||
use std::any::Any;
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
|
||||
use syntax::ast;
|
||||
|
|
@ -102,9 +101,6 @@ provide! { <'tcx> tcx, def_id, cdata
|
|||
|
||||
let mir = tcx.alloc_mir(mir);
|
||||
|
||||
// Perma-borrow MIR from extern crates to prevent mutation.
|
||||
mem::forget(mir.borrow());
|
||||
|
||||
mir
|
||||
}
|
||||
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue