Rename rustc_mir to rustc_const_eval.
This commit is contained in:
parent
fd9c04fe32
commit
c5fc2609f0
64 changed files with 66 additions and 66 deletions
56
Cargo.lock
56
Cargo.lock
|
@ -3605,6 +3605,7 @@ dependencies = [
|
|||
"either",
|
||||
"itertools 0.9.0",
|
||||
"polonius-engine",
|
||||
"rustc_const_eval",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_graphviz",
|
||||
|
@ -3613,7 +3614,6 @@ dependencies = [
|
|||
"rustc_infer",
|
||||
"rustc_lexer",
|
||||
"rustc_middle",
|
||||
"rustc_mir",
|
||||
"rustc_mir_dataflow",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
|
@ -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"
|
||||
|
@ -3746,6 +3770,7 @@ dependencies = [
|
|||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_codegen_ssa",
|
||||
"rustc_const_eval",
|
||||
"rustc_data_structures",
|
||||
"rustc_error_codes",
|
||||
"rustc_errors",
|
||||
|
@ -3756,7 +3781,6 @@ dependencies = [
|
|||
"rustc_lint",
|
||||
"rustc_metadata",
|
||||
"rustc_middle",
|
||||
"rustc_mir",
|
||||
"rustc_parse",
|
||||
"rustc_plugin_impl",
|
||||
"rustc_save_analysis",
|
||||
|
@ -3919,6 +3943,7 @@ dependencies = [
|
|||
"rustc_builtin_macros",
|
||||
"rustc_codegen_llvm",
|
||||
"rustc_codegen_ssa",
|
||||
"rustc_const_eval",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_expand",
|
||||
|
@ -3927,7 +3952,6 @@ dependencies = [
|
|||
"rustc_lint",
|
||||
"rustc_metadata",
|
||||
"rustc_middle",
|
||||
"rustc_mir",
|
||||
"rustc_mir_build",
|
||||
"rustc_mir_transform",
|
||||
"rustc_monomorphize",
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "rustc_mir"
|
||||
name = "rustc_const_eval"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
|
@ -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" }
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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};
|
||||
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Check that cross-crate inlined items are inlined in all compilation units
|
||||
# that refer to them, and not in any other compilation units.
|
||||
# Note that we have to pass `-C codegen-units=6` because up to two CGUs may be
|
||||
# created for each source module (see `rustc_mir::monomorphize::partitioning`).
|
||||
# created for each source module (see `rustc_const_eval::monomorphize::partitioning`).
|
||||
|
||||
all:
|
||||
$(RUSTC) cci_lib.rs
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
extern crate rustc_ast;
|
||||
extern crate rustc_ast_pretty;
|
||||
extern crate rustc_attr;
|
||||
extern crate rustc_const_eval;
|
||||
extern crate rustc_data_structures;
|
||||
extern crate rustc_errors;
|
||||
extern crate rustc_hir;
|
||||
|
@ -24,7 +25,6 @@ extern crate rustc_infer;
|
|||
extern crate rustc_lexer;
|
||||
extern crate rustc_lint;
|
||||
extern crate rustc_middle;
|
||||
extern crate rustc_mir;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
extern crate rustc_target;
|
||||
|
|
|
@ -366,7 +366,7 @@ fn check_terminator(
|
|||
}
|
||||
|
||||
fn is_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: Option<&RustcVersion>) -> bool {
|
||||
rustc_mir::const_eval::is_const_fn(tcx, def_id)
|
||||
rustc_const_eval::const_eval::is_const_fn(tcx, def_id)
|
||||
&& tcx.lookup_const_stability(def_id).map_or(true, |const_stab| {
|
||||
if let rustc_attr::StabilityLevel::Stable { since } = const_stab.level {
|
||||
// Checking MSRV is manually necessary because `rustc` has no such concept. This entire
|
||||
|
|
Loading…
Add table
Reference in a new issue