rename mir -> thir around abstract consts
This commit is contained in:
parent
15101c8e95
commit
406d2ab95d
22 changed files with 287 additions and 284 deletions
|
@ -26,6 +26,7 @@ use rustc_middle::middle::cstore::{ForeignModule, LinkagePreference, NativeLib};
|
|||
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
||||
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use rustc_middle::mir::{self, Body, Promoted};
|
||||
use rustc_middle::thir;
|
||||
use rustc_middle::ty::codec::TyDecoder;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
|
||||
use rustc_serialize::{opaque, Decodable, Decoder};
|
||||
|
@ -540,7 +541,7 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
|
||||
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
|
||||
fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String> {
|
||||
ty::codec::RefDecodable::decode(d)
|
||||
}
|
||||
|
@ -1198,14 +1199,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
.decode((self, tcx))
|
||||
}
|
||||
|
||||
fn get_mir_abstract_const(
|
||||
fn get_thir_abstract_const(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
id: DefIndex,
|
||||
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
|
||||
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
|
||||
self.root
|
||||
.tables
|
||||
.mir_abstract_consts
|
||||
.thir_abstract_consts
|
||||
.get(self, id)
|
||||
.map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx)))))
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
optimized_mir => { tcx.arena.alloc(cdata.get_optimized_mir(tcx, def_id.index)) }
|
||||
mir_for_ctfe => { tcx.arena.alloc(cdata.get_mir_for_ctfe(tcx, def_id.index)) }
|
||||
promoted_mir => { tcx.arena.alloc(cdata.get_promoted_mir(tcx, def_id.index)) }
|
||||
mir_abstract_const => { cdata.get_mir_abstract_const(tcx, def_id.index) }
|
||||
thir_abstract_const => { cdata.get_thir_abstract_const(tcx, def_id.index) }
|
||||
unused_generic_params => { cdata.get_unused_generic_params(def_id.index) }
|
||||
const_param_default => { tcx.mk_const(cdata.get_const_param_default(tcx, def_id.index)) }
|
||||
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }
|
||||
|
|
|
@ -23,6 +23,7 @@ use rustc_middle::middle::exported_symbols::{
|
|||
metadata_symbol_name, ExportedSymbol, SymbolExportLevel,
|
||||
};
|
||||
use rustc_middle::mir::interpret;
|
||||
use rustc_middle::thir;
|
||||
use rustc_middle::traits::specialization_graph;
|
||||
use rustc_middle::ty::codec::TyEncoder;
|
||||
use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt};
|
||||
|
@ -344,7 +345,7 @@ impl<'a, 'tcx> TyEncoder<'tcx> for EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
|
||||
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
|
||||
fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
|
||||
(**self).encode(s)
|
||||
}
|
||||
|
@ -1304,9 +1305,10 @@ impl EncodeContext<'a, 'tcx> {
|
|||
if encode_const {
|
||||
record!(self.tables.mir_for_ctfe[def_id.to_def_id()] <- self.tcx.mir_for_ctfe(def_id));
|
||||
|
||||
let abstract_const = self.tcx.mir_abstract_const(def_id);
|
||||
// FIXME this feels wrong to have in `encode_mir`
|
||||
let abstract_const = self.tcx.thir_abstract_const(def_id);
|
||||
if let Ok(Some(abstract_const)) = abstract_const {
|
||||
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
|
||||
record!(self.tables.thir_abstract_consts[def_id.to_def_id()] <- abstract_const);
|
||||
}
|
||||
}
|
||||
record!(self.tables.promoted_mir[def_id.to_def_id()] <- self.tcx.promoted_mir(def_id));
|
||||
|
|
|
@ -15,6 +15,7 @@ use rustc_middle::hir::exports::Export;
|
|||
use rustc_middle::middle::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
|
||||
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::thir;
|
||||
use rustc_middle::ty::{self, ReprOptions, Ty};
|
||||
use rustc_serialize::opaque::Encoder;
|
||||
use rustc_session::config::SymbolManglingVersion;
|
||||
|
@ -305,7 +306,7 @@ define_tables! {
|
|||
mir: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
|
||||
mir_for_ctfe: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
|
||||
promoted_mir: Table<DefIndex, Lazy!(IndexVec<mir::Promoted, mir::Body<'tcx>>)>,
|
||||
mir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [mir::abstract_const::Node<'tcx>])>,
|
||||
thir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [thir::abstract_const::Node<'tcx>])>,
|
||||
const_defaults: Table<DefIndex, Lazy<rustc_middle::ty::Const<'tcx>>>,
|
||||
unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u32>>>,
|
||||
// `def_keys` and `def_path_hashes` represent a lazy version of a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue