Skip to content

Commit 406d2ab

Browse files
committed
rename mir -> thir around abstract consts
1 parent 15101c8 commit 406d2ab

File tree

22 files changed

+287
-284
lines changed

22 files changed

+287
-284
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use rustc_middle::middle::cstore::{ForeignModule, LinkagePreference, NativeLib};
2626
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
2727
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
2828
use rustc_middle::mir::{self, Body, Promoted};
29+
use rustc_middle::thir;
2930
use rustc_middle::ty::codec::TyDecoder;
3031
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
3132
use rustc_serialize::{opaque, Decodable, Decoder};
@@ -540,7 +541,7 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
540541
}
541542
}
542543

543-
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
544+
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
544545
fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String> {
545546
ty::codec::RefDecodable::decode(d)
546547
}
@@ -1198,14 +1199,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11981199
.decode((self, tcx))
11991200
}
12001201

1201-
fn get_mir_abstract_const(
1202+
fn get_thir_abstract_const(
12021203
&self,
12031204
tcx: TyCtxt<'tcx>,
12041205
id: DefIndex,
1205-
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
1206+
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
12061207
self.root
12071208
.tables
1208-
.mir_abstract_consts
1209+
.thir_abstract_consts
12091210
.get(self, id)
12101211
.map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx)))))
12111212
}

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
117117
optimized_mir => { tcx.arena.alloc(cdata.get_optimized_mir(tcx, def_id.index)) }
118118
mir_for_ctfe => { tcx.arena.alloc(cdata.get_mir_for_ctfe(tcx, def_id.index)) }
119119
promoted_mir => { tcx.arena.alloc(cdata.get_promoted_mir(tcx, def_id.index)) }
120-
mir_abstract_const => { cdata.get_mir_abstract_const(tcx, def_id.index) }
120+
thir_abstract_const => { cdata.get_thir_abstract_const(tcx, def_id.index) }
121121
unused_generic_params => { cdata.get_unused_generic_params(def_id.index) }
122122
const_param_default => { tcx.mk_const(cdata.get_const_param_default(tcx, def_id.index)) }
123123
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rustc_middle::middle::exported_symbols::{
2323
metadata_symbol_name, ExportedSymbol, SymbolExportLevel,
2424
};
2525
use rustc_middle::mir::interpret;
26+
use rustc_middle::thir;
2627
use rustc_middle::traits::specialization_graph;
2728
use rustc_middle::ty::codec::TyEncoder;
2829
use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt};
@@ -344,7 +345,7 @@ impl<'a, 'tcx> TyEncoder<'tcx> for EncodeContext<'a, 'tcx> {
344345
}
345346
}
346347

347-
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
348+
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
348349
fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
349350
(**self).encode(s)
350351
}
@@ -1304,9 +1305,10 @@ impl EncodeContext<'a, 'tcx> {
13041305
if encode_const {
13051306
record!(self.tables.mir_for_ctfe[def_id.to_def_id()] <- self.tcx.mir_for_ctfe(def_id));
13061307

1307-
let abstract_const = self.tcx.mir_abstract_const(def_id);
1308+
// FIXME this feels wrong to have in `encode_mir`
1309+
let abstract_const = self.tcx.thir_abstract_const(def_id);
13081310
if let Ok(Some(abstract_const)) = abstract_const {
1309-
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
1311+
record!(self.tables.thir_abstract_consts[def_id.to_def_id()] <- abstract_const);
13101312
}
13111313
}
13121314
record!(self.tables.promoted_mir[def_id.to_def_id()] <- self.tcx.promoted_mir(def_id));

compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_middle::hir::exports::Export;
1515
use rustc_middle::middle::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
1616
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
1717
use rustc_middle::mir;
18+
use rustc_middle::thir;
1819
use rustc_middle::ty::{self, ReprOptions, Ty};
1920
use rustc_serialize::opaque::Encoder;
2021
use rustc_session::config::SymbolManglingVersion;
@@ -305,7 +306,7 @@ define_tables! {
305306
mir: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
306307
mir_for_ctfe: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
307308
promoted_mir: Table<DefIndex, Lazy!(IndexVec<mir::Promoted, mir::Body<'tcx>>)>,
308-
mir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [mir::abstract_const::Node<'tcx>])>,
309+
thir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [thir::abstract_const::Node<'tcx>])>,
309310
const_defaults: Table<DefIndex, Lazy<rustc_middle::ty::Const<'tcx>>>,
310311
unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u32>>>,
311312
// `def_keys` and `def_path_hashes` represent a lazy version of a

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use self::graph_cyclic_cache::GraphIsCyclicCache;
4040
use self::predecessors::{PredecessorCache, Predecessors};
4141
pub use self::query::*;
4242

43-
pub mod abstract_const;
4443
pub mod coverage;
4544
mod generic_graph;
4645
pub mod generic_graphviz;

compiler/rustc_middle/src/mir/query.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Values computed by queries that use MIR.
22
3-
use crate::mir::{abstract_const, Body, Promoted};
3+
use crate::mir::{Body, Promoted};
4+
use crate::thir::abstract_const;
45
use crate::ty::{self, Ty, TyCtxt};
56
use rustc_data_structures::sync::Lrc;
67
use rustc_data_structures::vec_map::VecMap;
@@ -433,14 +434,14 @@ impl<'tcx> TyCtxt<'tcx> {
433434
}
434435

435436
#[inline]
436-
pub fn mir_abstract_const_opt_const_arg(
437+
pub fn thir_abstract_const_opt_const_arg(
437438
self,
438439
def: ty::WithOptConstParam<DefId>,
439440
) -> Result<Option<&'tcx [abstract_const::Node<'tcx>]>, ErrorReported> {
440441
if let Some((did, param_did)) = def.as_const_arg() {
441-
self.mir_abstract_const_of_const_arg((did, param_did))
442+
self.thir_abstract_const_of_const_arg((did, param_did))
442443
} else {
443-
self.mir_abstract_const(def.did)
444+
self.thir_abstract_const(def.did)
444445
}
445446
}
446447
}

compiler/rustc_middle/src/query/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,17 @@ rustc_queries! {
295295
}
296296

297297
/// Try to build an abstract representation of the given constant.
298-
query mir_abstract_const(
298+
query thir_abstract_const(
299299
key: DefId
300-
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
300+
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
301301
desc {
302302
|tcx| "building an abstract representation for {}", tcx.def_path_str(key),
303303
}
304304
}
305305
/// Try to build an abstract representation of the given constant.
306-
query mir_abstract_const_of_const_arg(
306+
query thir_abstract_const_of_const_arg(
307307
key: (LocalDefId, DefId)
308-
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
308+
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
309309
desc {
310310
|tcx|
311311
"building an abstract representation for the const argument {}",

0 commit comments

Comments
 (0)