Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename rustc_mir to rustc_const_eval.
  • Loading branch information
cjgillot committed Sep 7, 2021
1 parent fd9c04f commit c5fc260
Show file tree
Hide file tree
Showing 64 changed files with 66 additions and 66 deletions.
56 changes: 28 additions & 28 deletions Cargo.lock
Expand Up @@ -3605,6 +3605,7 @@ dependencies = [
"either",
"itertools 0.9.0",
"polonius-engine",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_graphviz",
Expand All @@ -3613,7 +3614,6 @@ dependencies = [
"rustc_infer",
"rustc_lexer",
"rustc_middle",
"rustc_mir",
"rustc_mir_dataflow",
"rustc_serialize",
"rustc_session",
Expand Down Expand Up @@ -3708,6 +3708,30 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_const_eval"
version = "0.0.0"
dependencies = [
"either",
"gsgdt",
"rustc_apfloat",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_macros",
"rustc_middle",
"rustc_mir_dataflow",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"tracing",
]

[[package]]
name = "rustc_data_structures"
version = "0.0.0"
Expand Down Expand Up @@ -3746,6 +3770,7 @@ dependencies = [
"rustc_ast",
"rustc_ast_pretty",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
Expand All @@ -3756,7 +3781,6 @@ dependencies = [
"rustc_lint",
"rustc_metadata",
"rustc_middle",
"rustc_mir",
"rustc_parse",
"rustc_plugin_impl",
"rustc_save_analysis",
Expand Down Expand Up @@ -3919,6 +3943,7 @@ dependencies = [
"rustc_builtin_macros",
"rustc_codegen_llvm",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
Expand All @@ -3927,7 +3952,6 @@ dependencies = [
"rustc_lint",
"rustc_metadata",
"rustc_middle",
"rustc_mir",
"rustc_mir_build",
"rustc_mir_transform",
"rustc_monomorphize",
Expand Down Expand Up @@ -4073,30 +4097,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_mir"
version = "0.0.0"
dependencies = [
"either",
"gsgdt",
"rustc_apfloat",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_macros",
"rustc_middle",
"rustc_mir_dataflow",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"tracing",
]

[[package]]
name = "rustc_mir_build"
version = "0.0.0"
Expand Down Expand Up @@ -4148,12 +4148,12 @@ dependencies = [
"itertools 0.9.0",
"rustc_ast",
"rustc_attr",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_middle",
"rustc_mir",
"rustc_mir_dataflow",
"rustc_serialize",
"rustc_session",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/Cargo.toml
Expand Up @@ -21,7 +21,7 @@ rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_middle = { path = "../rustc_middle" }
rustc_mir = { path = "../rustc_mir" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Expand Up @@ -1695,7 +1695,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
Some((method_did, method_substs)),
) = (
&self.body[loan.reserve_location.block].terminator,
rustc_mir::util::find_self_call(
rustc_const_eval::util::find_self_call(
tcx,
self.body,
loan.assigned_place.local,
Expand Down
13 changes: 7 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Expand Up @@ -899,12 +899,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
kind: TerminatorKind::Call { fn_span, from_hir_call, .. }, ..
}) = &self.body[location.block].terminator
{
let (method_did, method_substs) = if let Some(info) = rustc_mir::util::find_self_call(
self.infcx.tcx,
&self.body,
target_temp,
location.block,
) {
let (method_did, method_substs) = if let Some(info) =
rustc_const_eval::util::find_self_call(
self.infcx.tcx,
&self.body,
target_temp,
location.block,
) {
info
} else {
return normal_ret;
Expand Down
Expand Up @@ -16,8 +16,8 @@ use rustc_span::{BytePos, Span};

use crate::diagnostics::BorrowedContentSource;
use crate::MirBorrowckCtxt;
use rustc_const_eval::util::collect_writes::FindAssignments;
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_mir::util::collect_writes::FindAssignments;

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub(crate) enum AccessKind {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/type_check/mod.rs
Expand Up @@ -41,7 +41,7 @@ use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
use rustc_trait_selection::traits::query::Fallible;
use rustc_trait_selection::traits::{self, ObligationCause, PredicateObligations};

use rustc_mir::transform::{
use rustc_const_eval::transform::{
check_consts::ConstCx, promote_consts::is_const_fn_in_array_repeat_expression,
};
use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
Expand Down
@@ -1,5 +1,5 @@
[package]
name = "rustc_mir"
name = "rustc_const_eval"
version = "0.0.0"
edition = "2018"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/rustc_driver/Cargo.toml
Expand Up @@ -22,7 +22,7 @@ rustc_feature = { path = "../rustc_feature" }
rustc_hir = { path = "../rustc_hir" }
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_mir = { path = "../rustc_mir" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_parse = { path = "../rustc_parse" }
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
rustc_save_analysis = { path = "../rustc_save_analysis" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/Cargo.toml
Expand Up @@ -32,7 +32,7 @@ rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
rustc_codegen_llvm = { path = "../rustc_codegen_llvm", optional = true }
rustc_hir = { path = "../rustc_hir" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_mir = { path = "../rustc_mir" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_mir_build = { path = "../rustc_mir_build" }
rustc_mir_transform = { path = "../rustc_mir_transform" }
rustc_monomorphize = { path = "../rustc_monomorphize" }
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_interface/src/passes.rs
Expand Up @@ -22,7 +22,6 @@ use rustc_middle::middle;
use rustc_middle::middle::cstore::{MetadataLoader, MetadataLoaderDyn};
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, GlobalCtxt, ResolverOutputs, TyCtxt};
use rustc_mir as mir;
use rustc_mir_build as mir_build;
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
use rustc_passes::{self, hir_stats, layout_test};
Expand Down Expand Up @@ -738,8 +737,8 @@ pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
let providers = &mut Providers::default();
providers.analysis = analysis;
proc_macro_decls::provide(providers);
rustc_const_eval::provide(providers);
rustc_middle::hir::provide(providers);
mir::provide(providers);
mir_borrowck::provide(providers);
mir_build::provide(providers);
rustc_mir_transform::provide(providers);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lib.rs
Expand Up @@ -8,7 +8,7 @@
//! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
//! defined in the `mir` module. This module contains only the
//! *definition* of the MIR; the passes that transform and operate
//! on MIR are found in `rustc_mir` crate.
//! on MIR are found in `rustc_const_eval` crate.
//! - **Types.** The internal representation of types used in rustc is
//! defined in the `ty` module. This includes the **type context**
//! (or `tcx`), which is the central context during most of
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Expand Up @@ -1170,7 +1170,7 @@ rustc_index::newtype_index! {
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
/// [data-flow analyses]:
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
/// [`CriticalCallEdges`]: ../../rustc_mir/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
/// [`CriticalCallEdges`]: ../../rustc_const_eval/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
pub struct BasicBlock {
derive [HashStable]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/mir/query.rs
Expand Up @@ -219,7 +219,7 @@ pub struct BorrowCheckResult<'tcx> {
/// The result of the `mir_const_qualif` query.
///
/// Each field (except `error_occured`) corresponds to an implementer of the `Qualif` trait in
/// `rustc_mir/src/transform/check_consts/qualifs.rs`. See that file for more information on each
/// `rustc_const_eval/src/transform/check_consts/qualifs.rs`. See that file for more information on each
/// `Qualif`.
#[derive(Clone, Copy, Debug, Default, TyEncodable, TyDecodable, HashStable)]
pub struct ConstQualifs {
Expand Down Expand Up @@ -313,7 +313,7 @@ pub struct ClosureOutlivesRequirement<'tcx> {
/// are interesting (for error reporting). Order of variants indicates sort
/// order of the category, thereby influencing diagnostic output.
///
/// See also `rustc_mir::borrow_check::constraints`.
/// See also `rustc_const_eval::borrow_check::constraints`.
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
#[derive(TyEncodable, TyDecodable, HashStable)]
pub enum ConstraintCategory {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/sty.rs
Expand Up @@ -643,7 +643,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
}

/// This returns the types of the MIR locals which had to be stored across suspension points.
/// It is calculated in rustc_mir::transform::generator::StateTransform.
/// It is calculated in rustc_const_eval::transform::generator::StateTransform.
/// All the types here must be in the tuple in GeneratorInterior.
///
/// The locals are grouped by their variant number. Note that some locals may
Expand Down Expand Up @@ -1268,7 +1268,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
/// Representation of regions. Note that the NLL checker uses a distinct
/// representation of regions. For this reason, it internally replaces all the
/// regions with inference variables -- the index of the variable is then used
/// to index into internal NLL data structures. See `rustc_mir::borrow_check`
/// to index into internal NLL data structures. See `rustc_const_eval::borrow_check`
/// module for more information.
///
/// ## The Region lattice within a given function
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/framework/mod.rs
Expand Up @@ -11,7 +11,7 @@
//! `visit_results`. The following example uses the `ResultsCursor` approach.
//!
//! ```ignore (cross-crate-imports)
//! use rustc_mir::dataflow::Analysis; // Makes `into_engine` available.
//! use rustc_const_eval::dataflow::Analysis; // Makes `into_engine` available.
//!
//! fn do_my_analysis(tcx: TyCtxt<'tcx>, body: &mir::Body<'tcx>) {
//! let analysis = MyAnalysis::new()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/Cargo.toml
Expand Up @@ -18,7 +18,7 @@ rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_middle = { path = "../rustc_middle" }
rustc_mir = { path = "../rustc_mir" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/const_prop.rs
Expand Up @@ -29,8 +29,8 @@ use rustc_target::spec::abi::Abi;
use rustc_trait_selection::traits;

use crate::MirPass;
use rustc_mir::const_eval::ConstEvalErr;
use rustc_mir::interpret::{
use rustc_const_eval::const_eval::ConstEvalErr;
use rustc_const_eval::interpret::{
self, compile_time_machine, AllocId, Allocation, ConstValue, CtfeValidationMode, Frame, ImmTy,
Immediate, InterpCx, InterpResult, LocalState, LocalValue, MemPlace, MemoryKind, OpTy,
Operand as InterpOperand, PlaceTy, Scalar, ScalarMaybeUninit, StackPopCleanup, StackPopUnwind,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_mir_transform/src/lib.rs
Expand Up @@ -19,6 +19,7 @@ extern crate tracing;
extern crate rustc_middle;

use required_consts::RequiredConstsVisitor;
use rustc_const_eval::util;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::steal::Steal;
use rustc_hir as hir;
Expand All @@ -29,7 +30,6 @@ 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::{self, TyCtxt, TypeFoldable};
use rustc_mir::util;
use rustc_span::{Span, Symbol};

mod abort_unwinding_calls;
Expand Down Expand Up @@ -73,10 +73,10 @@ mod simplify_try;
mod uninhabited_enum_branching;
mod unreachable_prop;

use rustc_mir::transform::check_consts;
use rustc_mir::transform::promote_consts;
use rustc_mir::transform::validate;
use rustc_mir::transform::MirPass;
use rustc_const_eval::transform::check_consts;
use rustc_const_eval::transform::promote_consts;
use rustc_const_eval::transform::validate;
use rustc_const_eval::transform::MirPass;
use rustc_mir_dataflow::rustc_peek;

pub fn provide(providers: &mut Providers) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/lower_slice_len.rs
@@ -1,11 +1,11 @@
//! This pass lowers calls to core::slice::len to just Len op.
//! It should run before inlining!

use crate::MirPass;
use rustc_hir::def_id::DefId;
use rustc_index::vec::IndexVec;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use rustc_mir::transform::MirPass;

pub struct LowerSliceLenCalls;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/match_branches.rs
Expand Up @@ -134,7 +134,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
let const_cmp = Operand::const_from_scalar(
tcx,
switch_ty,
rustc_mir::interpret::Scalar::from_uint(val, size),
rustc_const_eval::interpret::Scalar::from_uint(val, size),
rustc_span::DUMMY_SP,
);
let op = if f_b { BinOp::Eq } else { BinOp::Ne };
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/generator_interior.rs
@@ -1,6 +1,6 @@
//! This calculates the types which has storage which lives across a suspension point in a
//! generator from the perspective of typeck. The actual types used at runtime
//! is calculated in `rustc_mir::transform::generator` and may be a subset of the
//! is calculated in `rustc_const_eval::transform::generator` and may be a subset of the
//! types computed here.

use super::FnCtxt;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/mod.rs
Expand Up @@ -11,6 +11,7 @@ crate mod utils;

use rustc_ast as ast;
use rustc_attr as attr;
use rustc_const_eval::const_eval::{is_const_fn, is_unstable_const_fn};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
Expand All @@ -22,7 +23,6 @@ use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::subst::{InternalSubsts, Subst};
use rustc_middle::ty::{self, AdtKind, DefIdTree, Lift, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_mir::const_eval::{is_const_fn, is_unstable_const_fn};
use rustc_span::hygiene::{AstPass, MacroKind};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{self, ExpnKind};
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Expand Up @@ -34,6 +34,7 @@ extern crate rustc_ast;
extern crate rustc_ast_lowering;
extern crate rustc_ast_pretty;
extern crate rustc_attr;
extern crate rustc_const_eval;
extern crate rustc_data_structures;
extern crate rustc_driver;
extern crate rustc_errors;
Expand All @@ -49,7 +50,6 @@ extern crate rustc_lint;
extern crate rustc_lint_defs;
extern crate rustc_metadata;
extern crate rustc_middle;
extern crate rustc_mir;
extern crate rustc_parse;
extern crate rustc_passes;
extern crate rustc_resolve;
Expand Down

0 comments on commit c5fc260

Please sign in to comment.