From c5fc2609f0f81698616734e22adee9b9ed67f729 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 5 Jan 2021 20:08:11 +0100 Subject: [PATCH] Rename rustc_mir to rustc_const_eval. --- Cargo.lock | 56 +++++++++---------- compiler/rustc_borrowck/Cargo.toml | 2 +- .../src/diagnostics/conflict_errors.rs | 2 +- .../rustc_borrowck/src/diagnostics/mod.rs | 13 +++-- .../src/diagnostics/mutability_errors.rs | 2 +- compiler/rustc_borrowck/src/type_check/mod.rs | 2 +- .../Cargo.toml | 2 +- .../src/const_eval/error.rs | 0 .../src/const_eval/eval_queries.rs | 0 .../src/const_eval/fn_queries.rs | 0 .../src/const_eval/machine.rs | 0 .../src/const_eval/mod.rs | 0 .../src/interpret/cast.rs | 0 .../src/interpret/eval_context.rs | 0 .../src/interpret/intern.rs | 0 .../src/interpret/intrinsics.rs | 0 .../interpret/intrinsics/caller_location.rs | 0 .../src/interpret/intrinsics/type_name.rs | 0 .../src/interpret/machine.rs | 0 .../src/interpret/memory.rs | 0 .../src/interpret/mod.rs | 0 .../src/interpret/operand.rs | 0 .../src/interpret/operator.rs | 0 .../src/interpret/place.rs | 0 .../src/interpret/step.rs | 0 .../src/interpret/terminator.rs | 0 .../src/interpret/traits.rs | 0 .../src/interpret/util.rs | 0 .../src/interpret/validity.rs | 0 .../src/interpret/visitor.rs | 0 .../src/lib.rs | 0 .../src/transform/check_consts/check.rs | 0 .../src/transform/check_consts/mod.rs | 0 .../src/transform/check_consts/ops.rs | 0 .../check_consts/post_drop_elaboration.rs | 0 .../src/transform/check_consts/qualifs.rs | 0 .../src/transform/check_consts/resolver.rs | 0 .../src/transform/mod.rs | 0 .../src/transform/promote_consts.rs | 0 .../src/transform/validate.rs | 0 .../src/util/aggregate.rs | 0 .../src/util/alignment.rs | 0 .../src/util/collect_writes.rs | 0 .../src/util/find_self_call.rs | 0 .../src/util/mod.rs | 0 compiler/rustc_driver/Cargo.toml | 2 +- compiler/rustc_interface/Cargo.toml | 2 +- compiler/rustc_interface/src/passes.rs | 3 +- compiler/rustc_middle/src/lib.rs | 2 +- compiler/rustc_middle/src/mir/mod.rs | 2 +- compiler/rustc_middle/src/mir/query.rs | 4 +- compiler/rustc_middle/src/ty/sty.rs | 4 +- .../rustc_mir_dataflow/src/framework/mod.rs | 2 +- compiler/rustc_mir_transform/Cargo.toml | 2 +- .../rustc_mir_transform/src/const_prop.rs | 4 +- compiler/rustc_mir_transform/src/lib.rs | 10 ++-- .../src/lower_slice_len.rs | 2 +- .../rustc_mir_transform/src/match_branches.rs | 2 +- .../src/check/generator_interior.rs | 2 +- src/librustdoc/clean/mod.rs | 2 +- src/librustdoc/lib.rs | 2 +- .../sepcomp-cci-copies/Makefile | 2 +- src/tools/clippy/clippy_utils/src/lib.rs | 2 +- .../clippy_utils/src/qualify_min_const_fn.rs | 2 +- 64 files changed, 66 insertions(+), 66 deletions(-) rename compiler/{rustc_mir => rustc_const_eval}/Cargo.toml (96%) rename compiler/{rustc_mir => rustc_const_eval}/src/const_eval/error.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/const_eval/eval_queries.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/const_eval/fn_queries.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/const_eval/machine.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/const_eval/mod.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/cast.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/eval_context.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/intern.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/intrinsics.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/intrinsics/caller_location.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/intrinsics/type_name.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/machine.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/memory.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/mod.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/operand.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/operator.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/place.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/step.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/terminator.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/traits.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/util.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/validity.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/interpret/visitor.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/lib.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/check.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/mod.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/ops.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/post_drop_elaboration.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/qualifs.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/check_consts/resolver.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/mod.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/promote_consts.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/transform/validate.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/util/aggregate.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/util/alignment.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/util/collect_writes.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/util/find_self_call.rs (100%) rename compiler/{rustc_mir => rustc_const_eval}/src/util/mod.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index ab9126fb5f9a5..3875ea9921642 100644 --- a/Cargo.lock +++ b/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", diff --git a/compiler/rustc_borrowck/Cargo.toml b/compiler/rustc_borrowck/Cargo.toml index 11b3ec28d45ff..543631de2dced 100644 --- a/compiler/rustc_borrowck/Cargo.toml +++ b/compiler/rustc_borrowck/Cargo.toml @@ -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" } diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 758a660525d7a..ce1e7c14b1ff6 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -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, diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index cc09db0e3dc20..50130dc2a27ed 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -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; diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index b3578afbbb635..7ca72cbed8de8 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -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 { diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 19224ca43dd91..2c8ff45b00da4 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -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; diff --git a/compiler/rustc_mir/Cargo.toml b/compiler/rustc_const_eval/Cargo.toml similarity index 96% rename from compiler/rustc_mir/Cargo.toml rename to compiler/rustc_const_eval/Cargo.toml index b187b716199c8..1653d5cf6c560 100644 --- a/compiler/rustc_mir/Cargo.toml +++ b/compiler/rustc_const_eval/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rustc_mir" +name = "rustc_const_eval" version = "0.0.0" edition = "2018" diff --git a/compiler/rustc_mir/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs similarity index 100% rename from compiler/rustc_mir/src/const_eval/error.rs rename to compiler/rustc_const_eval/src/const_eval/error.rs diff --git a/compiler/rustc_mir/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs similarity index 100% rename from compiler/rustc_mir/src/const_eval/eval_queries.rs rename to compiler/rustc_const_eval/src/const_eval/eval_queries.rs diff --git a/compiler/rustc_mir/src/const_eval/fn_queries.rs b/compiler/rustc_const_eval/src/const_eval/fn_queries.rs similarity index 100% rename from compiler/rustc_mir/src/const_eval/fn_queries.rs rename to compiler/rustc_const_eval/src/const_eval/fn_queries.rs diff --git a/compiler/rustc_mir/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs similarity index 100% rename from compiler/rustc_mir/src/const_eval/machine.rs rename to compiler/rustc_const_eval/src/const_eval/machine.rs diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs similarity index 100% rename from compiler/rustc_mir/src/const_eval/mod.rs rename to compiler/rustc_const_eval/src/const_eval/mod.rs diff --git a/compiler/rustc_mir/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/cast.rs rename to compiler/rustc_const_eval/src/interpret/cast.rs diff --git a/compiler/rustc_mir/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/eval_context.rs rename to compiler/rustc_const_eval/src/interpret/eval_context.rs diff --git a/compiler/rustc_mir/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/intern.rs rename to compiler/rustc_const_eval/src/interpret/intern.rs diff --git a/compiler/rustc_mir/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/intrinsics.rs rename to compiler/rustc_const_eval/src/interpret/intrinsics.rs diff --git a/compiler/rustc_mir/src/interpret/intrinsics/caller_location.rs b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/intrinsics/caller_location.rs rename to compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs diff --git a/compiler/rustc_mir/src/interpret/intrinsics/type_name.rs b/compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/intrinsics/type_name.rs rename to compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs diff --git a/compiler/rustc_mir/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/machine.rs rename to compiler/rustc_const_eval/src/interpret/machine.rs diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/memory.rs rename to compiler/rustc_const_eval/src/interpret/memory.rs diff --git a/compiler/rustc_mir/src/interpret/mod.rs b/compiler/rustc_const_eval/src/interpret/mod.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/mod.rs rename to compiler/rustc_const_eval/src/interpret/mod.rs diff --git a/compiler/rustc_mir/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/operand.rs rename to compiler/rustc_const_eval/src/interpret/operand.rs diff --git a/compiler/rustc_mir/src/interpret/operator.rs b/compiler/rustc_const_eval/src/interpret/operator.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/operator.rs rename to compiler/rustc_const_eval/src/interpret/operator.rs diff --git a/compiler/rustc_mir/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/place.rs rename to compiler/rustc_const_eval/src/interpret/place.rs diff --git a/compiler/rustc_mir/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/step.rs rename to compiler/rustc_const_eval/src/interpret/step.rs diff --git a/compiler/rustc_mir/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/terminator.rs rename to compiler/rustc_const_eval/src/interpret/terminator.rs diff --git a/compiler/rustc_mir/src/interpret/traits.rs b/compiler/rustc_const_eval/src/interpret/traits.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/traits.rs rename to compiler/rustc_const_eval/src/interpret/traits.rs diff --git a/compiler/rustc_mir/src/interpret/util.rs b/compiler/rustc_const_eval/src/interpret/util.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/util.rs rename to compiler/rustc_const_eval/src/interpret/util.rs diff --git a/compiler/rustc_mir/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/validity.rs rename to compiler/rustc_const_eval/src/interpret/validity.rs diff --git a/compiler/rustc_mir/src/interpret/visitor.rs b/compiler/rustc_const_eval/src/interpret/visitor.rs similarity index 100% rename from compiler/rustc_mir/src/interpret/visitor.rs rename to compiler/rustc_const_eval/src/interpret/visitor.rs diff --git a/compiler/rustc_mir/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs similarity index 100% rename from compiler/rustc_mir/src/lib.rs rename to compiler/rustc_const_eval/src/lib.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/check.rs rename to compiler/rustc_const_eval/src/transform/check_consts/check.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/mod.rs b/compiler/rustc_const_eval/src/transform/check_consts/mod.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/mod.rs rename to compiler/rustc_const_eval/src/transform/check_consts/mod.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/ops.rs rename to compiler/rustc_const_eval/src/transform/check_consts/ops.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/post_drop_elaboration.rs b/compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/post_drop_elaboration.rs rename to compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/qualifs.rs rename to compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs diff --git a/compiler/rustc_mir/src/transform/check_consts/resolver.rs b/compiler/rustc_const_eval/src/transform/check_consts/resolver.rs similarity index 100% rename from compiler/rustc_mir/src/transform/check_consts/resolver.rs rename to compiler/rustc_const_eval/src/transform/check_consts/resolver.rs diff --git a/compiler/rustc_mir/src/transform/mod.rs b/compiler/rustc_const_eval/src/transform/mod.rs similarity index 100% rename from compiler/rustc_mir/src/transform/mod.rs rename to compiler/rustc_const_eval/src/transform/mod.rs diff --git a/compiler/rustc_mir/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs similarity index 100% rename from compiler/rustc_mir/src/transform/promote_consts.rs rename to compiler/rustc_const_eval/src/transform/promote_consts.rs diff --git a/compiler/rustc_mir/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs similarity index 100% rename from compiler/rustc_mir/src/transform/validate.rs rename to compiler/rustc_const_eval/src/transform/validate.rs diff --git a/compiler/rustc_mir/src/util/aggregate.rs b/compiler/rustc_const_eval/src/util/aggregate.rs similarity index 100% rename from compiler/rustc_mir/src/util/aggregate.rs rename to compiler/rustc_const_eval/src/util/aggregate.rs diff --git a/compiler/rustc_mir/src/util/alignment.rs b/compiler/rustc_const_eval/src/util/alignment.rs similarity index 100% rename from compiler/rustc_mir/src/util/alignment.rs rename to compiler/rustc_const_eval/src/util/alignment.rs diff --git a/compiler/rustc_mir/src/util/collect_writes.rs b/compiler/rustc_const_eval/src/util/collect_writes.rs similarity index 100% rename from compiler/rustc_mir/src/util/collect_writes.rs rename to compiler/rustc_const_eval/src/util/collect_writes.rs diff --git a/compiler/rustc_mir/src/util/find_self_call.rs b/compiler/rustc_const_eval/src/util/find_self_call.rs similarity index 100% rename from compiler/rustc_mir/src/util/find_self_call.rs rename to compiler/rustc_const_eval/src/util/find_self_call.rs diff --git a/compiler/rustc_mir/src/util/mod.rs b/compiler/rustc_const_eval/src/util/mod.rs similarity index 100% rename from compiler/rustc_mir/src/util/mod.rs rename to compiler/rustc_const_eval/src/util/mod.rs diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml index 57159962a9e68..ba8616cc6ef73 100644 --- a/compiler/rustc_driver/Cargo.toml +++ b/compiler/rustc_driver/Cargo.toml @@ -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" } diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml index 306728dbeac59..e76fa6d8a1bc6 100644 --- a/compiler/rustc_interface/Cargo.toml +++ b/compiler/rustc_interface/Cargo.toml @@ -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" } diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 547823a067cf5..1f3d6f70ff837 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -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 = 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); diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index c7c26cf599094..a366232c349d7 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -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 diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index ef2154b31f4b3..38d4c5b4bd10e 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -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] diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 4fb737f463a86..1bdb6ca012b4a 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -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 { diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 65dd61b63295c..0fbaf81c21e40 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -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 diff --git a/compiler/rustc_mir_dataflow/src/framework/mod.rs b/compiler/rustc_mir_dataflow/src/framework/mod.rs index 0bf62db1adac9..f0c9ac4c504a3 100644 --- a/compiler/rustc_mir_dataflow/src/framework/mod.rs +++ b/compiler/rustc_mir_dataflow/src/framework/mod.rs @@ -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() diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index bc0f69d190cd2..7956bf8ffcf11 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -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" } diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 51240ee067711..71b3a555587f7 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -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, diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 2c8bdf4a20750..771c3ed72db31 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -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) { diff --git a/compiler/rustc_mir_transform/src/lower_slice_len.rs b/compiler/rustc_mir_transform/src/lower_slice_len.rs index eac2b97a14cf1..30de374a2d822 100644 --- a/compiler/rustc_mir_transform/src/lower_slice_len.rs +++ b/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; diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs index 24eaf27897715..c618abe9d0599 100644 --- a/compiler/rustc_mir_transform/src/match_branches.rs +++ b/compiler/rustc_mir_transform/src/match_branches.rs @@ -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 }; diff --git a/compiler/rustc_typeck/src/check/generator_interior.rs b/compiler/rustc_typeck/src/check/generator_interior.rs index 5f26e701c0ab7..3da9fd159a728 100644 --- a/compiler/rustc_typeck/src/check/generator_interior.rs +++ b/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; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 71348b3eb65ff..f2941e67ac30a 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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}; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 2dbe4c42b888e..8246834a74688 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -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; diff --git a/src/test/run-make-fulldeps/sepcomp-cci-copies/Makefile b/src/test/run-make-fulldeps/sepcomp-cci-copies/Makefile index 36f913ff3faac..77d1d71e9b269 100644 --- a/src/test/run-make-fulldeps/sepcomp-cci-copies/Makefile +++ b/src/test/run-make-fulldeps/sepcomp-cci-copies/Makefile @@ -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 diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index ddff1686ba2ce..0906f958cfb1f 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/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; diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index e5bbf75c3b0a1..4fb9e6b07e71a 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs @@ -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