diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-10-04 11:01:13 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-10-04 11:01:13 -0700 |
| commit | 938d8fd805c682ebca4e4c3bca7bde50d120b420 (patch) | |
| tree | 7fd2de84b02f75e42c0f376d3aa6ed3c94660c38 /compiler/rustc_mir/src/transform | |
| parent | 141a977edf1319727b633843e6cd35daa17cdfb6 (diff) | |
| download | rust-938d8fd805c682ebca4e4c3bca7bde50d120b420.tar.gz rust-938d8fd805c682ebca4e4c3bca7bde50d120b420.zip | |
Move `MirSource` to `rustc_middle`
Diffstat (limited to 'compiler/rustc_mir/src/transform')
| -rw-r--r-- | compiler/rustc_mir/src/transform/mod.rs | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_mir/src/transform/mod.rs index 67193814a40..41076f8e5d5 100644 --- a/compiler/rustc_mir/src/transform/mod.rs +++ b/compiler/rustc_mir/src/transform/mod.rs @@ -9,7 +9,7 @@ use rustc_middle::mir::visit::Visitor as _; use rustc_middle::mir::{traversal, Body, ConstQualifs, MirPhase, Promoted}; use rustc_middle::ty::query::Providers; use rustc_middle::ty::steal::Steal; -use rustc_middle::ty::{self, InstanceDef, TyCtxt, TypeFoldable}; +use rustc_middle::ty::{self, TyCtxt, TypeFoldable}; use rustc_span::{Span, Symbol}; use std::borrow::Cow; @@ -49,6 +49,8 @@ pub mod uninhabited_enum_branching; pub mod unreachable_prop; pub mod validate; +pub use rustc_middle::mir::MirSource; + pub(crate) fn provide(providers: &mut Providers) { self::check_unsafety::provide(providers); *providers = Providers { @@ -132,33 +134,6 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> FxHashSet<LocalDefId> { set } -/// Where a specific `mir::Body` comes from. -#[derive(Debug, Copy, Clone)] -pub struct MirSource<'tcx> { - pub instance: InstanceDef<'tcx>, - - /// If `Some`, this is a promoted rvalue within the parent function. - pub promoted: Option<Promoted>, -} - -impl<'tcx> MirSource<'tcx> { - pub fn item(def_id: DefId) -> Self { - MirSource { - instance: InstanceDef::Item(ty::WithOptConstParam::unknown(def_id)), - promoted: None, - } - } - - pub fn with_opt_param(self) -> ty::WithOptConstParam<DefId> { - self.instance.with_opt_param() - } - - #[inline] - pub fn def_id(&self) -> DefId { - self.instance.def_id() - } -} - /// Generates a default name for the pass based on the name of the /// type `T`. pub fn default_name<T: ?Sized>() -> Cow<'static, str> { |
