Skip to content

Commit c5fc260

Browse files
committed
Rename rustc_mir to rustc_const_eval.
1 parent fd9c04f commit c5fc260

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+66
-66
lines changed

Cargo.lock

+28-28
Original file line numberDiff line numberDiff line change
@@ -3605,6 +3605,7 @@ dependencies = [
36053605
"either",
36063606
"itertools 0.9.0",
36073607
"polonius-engine",
3608+
"rustc_const_eval",
36083609
"rustc_data_structures",
36093610
"rustc_errors",
36103611
"rustc_graphviz",
@@ -3613,7 +3614,6 @@ dependencies = [
36133614
"rustc_infer",
36143615
"rustc_lexer",
36153616
"rustc_middle",
3616-
"rustc_mir",
36173617
"rustc_mir_dataflow",
36183618
"rustc_serialize",
36193619
"rustc_session",
@@ -3708,6 +3708,30 @@ dependencies = [
37083708
"tracing",
37093709
]
37103710

3711+
[[package]]
3712+
name = "rustc_const_eval"
3713+
version = "0.0.0"
3714+
dependencies = [
3715+
"either",
3716+
"gsgdt",
3717+
"rustc_apfloat",
3718+
"rustc_ast",
3719+
"rustc_attr",
3720+
"rustc_data_structures",
3721+
"rustc_errors",
3722+
"rustc_hir",
3723+
"rustc_index",
3724+
"rustc_infer",
3725+
"rustc_macros",
3726+
"rustc_middle",
3727+
"rustc_mir_dataflow",
3728+
"rustc_session",
3729+
"rustc_span",
3730+
"rustc_target",
3731+
"rustc_trait_selection",
3732+
"tracing",
3733+
]
3734+
37113735
[[package]]
37123736
name = "rustc_data_structures"
37133737
version = "0.0.0"
@@ -3746,6 +3770,7 @@ dependencies = [
37463770
"rustc_ast",
37473771
"rustc_ast_pretty",
37483772
"rustc_codegen_ssa",
3773+
"rustc_const_eval",
37493774
"rustc_data_structures",
37503775
"rustc_error_codes",
37513776
"rustc_errors",
@@ -3756,7 +3781,6 @@ dependencies = [
37563781
"rustc_lint",
37573782
"rustc_metadata",
37583783
"rustc_middle",
3759-
"rustc_mir",
37603784
"rustc_parse",
37613785
"rustc_plugin_impl",
37623786
"rustc_save_analysis",
@@ -3919,6 +3943,7 @@ dependencies = [
39193943
"rustc_builtin_macros",
39203944
"rustc_codegen_llvm",
39213945
"rustc_codegen_ssa",
3946+
"rustc_const_eval",
39223947
"rustc_data_structures",
39233948
"rustc_errors",
39243949
"rustc_expand",
@@ -3927,7 +3952,6 @@ dependencies = [
39273952
"rustc_lint",
39283953
"rustc_metadata",
39293954
"rustc_middle",
3930-
"rustc_mir",
39313955
"rustc_mir_build",
39323956
"rustc_mir_transform",
39333957
"rustc_monomorphize",
@@ -4073,30 +4097,6 @@ dependencies = [
40734097
"tracing",
40744098
]
40754099

4076-
[[package]]
4077-
name = "rustc_mir"
4078-
version = "0.0.0"
4079-
dependencies = [
4080-
"either",
4081-
"gsgdt",
4082-
"rustc_apfloat",
4083-
"rustc_ast",
4084-
"rustc_attr",
4085-
"rustc_data_structures",
4086-
"rustc_errors",
4087-
"rustc_hir",
4088-
"rustc_index",
4089-
"rustc_infer",
4090-
"rustc_macros",
4091-
"rustc_middle",
4092-
"rustc_mir_dataflow",
4093-
"rustc_session",
4094-
"rustc_span",
4095-
"rustc_target",
4096-
"rustc_trait_selection",
4097-
"tracing",
4098-
]
4099-
41004100
[[package]]
41014101
name = "rustc_mir_build"
41024102
version = "0.0.0"
@@ -4148,12 +4148,12 @@ dependencies = [
41484148
"itertools 0.9.0",
41494149
"rustc_ast",
41504150
"rustc_attr",
4151+
"rustc_const_eval",
41514152
"rustc_data_structures",
41524153
"rustc_errors",
41534154
"rustc_hir",
41544155
"rustc_index",
41554156
"rustc_middle",
4156-
"rustc_mir",
41574157
"rustc_mir_dataflow",
41584158
"rustc_serialize",
41594159
"rustc_session",

compiler/rustc_borrowck/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rustc_index = { path = "../rustc_index" }
2121
rustc_infer = { path = "../rustc_infer" }
2222
rustc_lexer = { path = "../rustc_lexer" }
2323
rustc_middle = { path = "../rustc_middle" }
24-
rustc_mir = { path = "../rustc_mir" }
24+
rustc_const_eval = { path = "../rustc_const_eval" }
2525
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
2626
rustc_serialize = { path = "../rustc_serialize" }
2727
rustc_session = { path = "../rustc_session" }

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16951695
Some((method_did, method_substs)),
16961696
) = (
16971697
&self.body[loan.reserve_location.block].terminator,
1698-
rustc_mir::util::find_self_call(
1698+
rustc_const_eval::util::find_self_call(
16991699
tcx,
17001700
self.body,
17011701
loan.assigned_place.local,

compiler/rustc_borrowck/src/diagnostics/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -899,12 +899,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
899899
kind: TerminatorKind::Call { fn_span, from_hir_call, .. }, ..
900900
}) = &self.body[location.block].terminator
901901
{
902-
let (method_did, method_substs) = if let Some(info) = rustc_mir::util::find_self_call(
903-
self.infcx.tcx,
904-
&self.body,
905-
target_temp,
906-
location.block,
907-
) {
902+
let (method_did, method_substs) = if let Some(info) =
903+
rustc_const_eval::util::find_self_call(
904+
self.infcx.tcx,
905+
&self.body,
906+
target_temp,
907+
location.block,
908+
) {
908909
info
909910
} else {
910911
return normal_ret;

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_span::{BytePos, Span};
1616

1717
use crate::diagnostics::BorrowedContentSource;
1818
use crate::MirBorrowckCtxt;
19+
use rustc_const_eval::util::collect_writes::FindAssignments;
1920
use rustc_errors::{Applicability, DiagnosticBuilder};
20-
use rustc_mir::util::collect_writes::FindAssignments;
2121

2222
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2323
pub(crate) enum AccessKind {

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
4141
use rustc_trait_selection::traits::query::Fallible;
4242
use rustc_trait_selection::traits::{self, ObligationCause, PredicateObligations};
4343

44-
use rustc_mir::transform::{
44+
use rustc_const_eval::transform::{
4545
check_consts::ConstCx, promote_consts::is_const_fn_in_array_repeat_expression,
4646
};
4747
use rustc_mir_dataflow::impls::MaybeInitializedPlaces;

compiler/rustc_mir/Cargo.toml renamed to compiler/rustc_const_eval/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "rustc_mir"
2+
name = "rustc_const_eval"
33
version = "0.0.0"
44
edition = "2018"
55

File renamed without changes.

compiler/rustc_driver/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rustc_feature = { path = "../rustc_feature" }
2222
rustc_hir = { path = "../rustc_hir" }
2323
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
2424
rustc_metadata = { path = "../rustc_metadata" }
25-
rustc_mir = { path = "../rustc_mir" }
25+
rustc_const_eval = { path = "../rustc_const_eval" }
2626
rustc_parse = { path = "../rustc_parse" }
2727
rustc_plugin_impl = { path = "../rustc_plugin_impl" }
2828
rustc_save_analysis = { path = "../rustc_save_analysis" }

compiler/rustc_interface/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
3232
rustc_codegen_llvm = { path = "../rustc_codegen_llvm", optional = true }
3333
rustc_hir = { path = "../rustc_hir" }
3434
rustc_metadata = { path = "../rustc_metadata" }
35-
rustc_mir = { path = "../rustc_mir" }
35+
rustc_const_eval = { path = "../rustc_const_eval" }
3636
rustc_mir_build = { path = "../rustc_mir_build" }
3737
rustc_mir_transform = { path = "../rustc_mir_transform" }
3838
rustc_monomorphize = { path = "../rustc_monomorphize" }

compiler/rustc_interface/src/passes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use rustc_middle::middle;
2222
use rustc_middle::middle::cstore::{MetadataLoader, MetadataLoaderDyn};
2323
use rustc_middle::ty::query::Providers;
2424
use rustc_middle::ty::{self, GlobalCtxt, ResolverOutputs, TyCtxt};
25-
use rustc_mir as mir;
2625
use rustc_mir_build as mir_build;
2726
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
2827
use rustc_passes::{self, hir_stats, layout_test};
@@ -738,8 +737,8 @@ pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
738737
let providers = &mut Providers::default();
739738
providers.analysis = analysis;
740739
proc_macro_decls::provide(providers);
740+
rustc_const_eval::provide(providers);
741741
rustc_middle::hir::provide(providers);
742-
mir::provide(providers);
743742
mir_borrowck::provide(providers);
744743
mir_build::provide(providers);
745744
rustc_mir_transform::provide(providers);

compiler/rustc_middle/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
99
//! defined in the `mir` module. This module contains only the
1010
//! *definition* of the MIR; the passes that transform and operate
11-
//! on MIR are found in `rustc_mir` crate.
11+
//! on MIR are found in `rustc_const_eval` crate.
1212
//! - **Types.** The internal representation of types used in rustc is
1313
//! defined in the `ty` module. This includes the **type context**
1414
//! (or `tcx`), which is the central context during most of

compiler/rustc_middle/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ rustc_index::newtype_index! {
11701170
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
11711171
/// [data-flow analyses]:
11721172
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
1173-
/// [`CriticalCallEdges`]: ../../rustc_mir/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
1173+
/// [`CriticalCallEdges`]: ../../rustc_const_eval/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
11741174
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
11751175
pub struct BasicBlock {
11761176
derive [HashStable]

compiler/rustc_middle/src/mir/query.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub struct BorrowCheckResult<'tcx> {
219219
/// The result of the `mir_const_qualif` query.
220220
///
221221
/// Each field (except `error_occured`) corresponds to an implementer of the `Qualif` trait in
222-
/// `rustc_mir/src/transform/check_consts/qualifs.rs`. See that file for more information on each
222+
/// `rustc_const_eval/src/transform/check_consts/qualifs.rs`. See that file for more information on each
223223
/// `Qualif`.
224224
#[derive(Clone, Copy, Debug, Default, TyEncodable, TyDecodable, HashStable)]
225225
pub struct ConstQualifs {
@@ -313,7 +313,7 @@ pub struct ClosureOutlivesRequirement<'tcx> {
313313
/// are interesting (for error reporting). Order of variants indicates sort
314314
/// order of the category, thereby influencing diagnostic output.
315315
///
316-
/// See also `rustc_mir::borrow_check::constraints`.
316+
/// See also `rustc_const_eval::borrow_check::constraints`.
317317
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
318318
#[derive(TyEncodable, TyDecodable, HashStable)]
319319
pub enum ConstraintCategory {

compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
643643
}
644644

645645
/// This returns the types of the MIR locals which had to be stored across suspension points.
646-
/// It is calculated in rustc_mir::transform::generator::StateTransform.
646+
/// It is calculated in rustc_const_eval::transform::generator::StateTransform.
647647
/// All the types here must be in the tuple in GeneratorInterior.
648648
///
649649
/// The locals are grouped by their variant number. Note that some locals may
@@ -1268,7 +1268,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
12681268
/// Representation of regions. Note that the NLL checker uses a distinct
12691269
/// representation of regions. For this reason, it internally replaces all the
12701270
/// regions with inference variables -- the index of the variable is then used
1271-
/// to index into internal NLL data structures. See `rustc_mir::borrow_check`
1271+
/// to index into internal NLL data structures. See `rustc_const_eval::borrow_check`
12721272
/// module for more information.
12731273
///
12741274
/// ## The Region lattice within a given function

compiler/rustc_mir_dataflow/src/framework/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! `visit_results`. The following example uses the `ResultsCursor` approach.
1212
//!
1313
//! ```ignore (cross-crate-imports)
14-
//! use rustc_mir::dataflow::Analysis; // Makes `into_engine` available.
14+
//! use rustc_const_eval::dataflow::Analysis; // Makes `into_engine` available.
1515
//!
1616
//! fn do_my_analysis(tcx: TyCtxt<'tcx>, body: &mir::Body<'tcx>) {
1717
//! let analysis = MyAnalysis::new()

compiler/rustc_mir_transform/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rustc_errors = { path = "../rustc_errors" }
1818
rustc_hir = { path = "../rustc_hir" }
1919
rustc_index = { path = "../rustc_index" }
2020
rustc_middle = { path = "../rustc_middle" }
21-
rustc_mir = { path = "../rustc_mir" }
21+
rustc_const_eval = { path = "../rustc_const_eval" }
2222
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
2323
rustc_serialize = { path = "../rustc_serialize" }
2424
rustc_session = { path = "../rustc_session" }

compiler/rustc_mir_transform/src/const_prop.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use rustc_target::spec::abi::Abi;
2929
use rustc_trait_selection::traits;
3030

3131
use crate::MirPass;
32-
use rustc_mir::const_eval::ConstEvalErr;
33-
use rustc_mir::interpret::{
32+
use rustc_const_eval::const_eval::ConstEvalErr;
33+
use rustc_const_eval::interpret::{
3434
self, compile_time_machine, AllocId, Allocation, ConstValue, CtfeValidationMode, Frame, ImmTy,
3535
Immediate, InterpCx, InterpResult, LocalState, LocalValue, MemPlace, MemoryKind, OpTy,
3636
Operand as InterpOperand, PlaceTy, Scalar, ScalarMaybeUninit, StackPopCleanup, StackPopUnwind,

compiler/rustc_mir_transform/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extern crate tracing;
1919
extern crate rustc_middle;
2020

2121
use required_consts::RequiredConstsVisitor;
22+
use rustc_const_eval::util;
2223
use rustc_data_structures::fx::FxHashSet;
2324
use rustc_data_structures::steal::Steal;
2425
use rustc_hir as hir;
@@ -29,7 +30,6 @@ use rustc_middle::mir::visit::Visitor as _;
2930
use rustc_middle::mir::{traversal, Body, ConstQualifs, MirPhase, Promoted};
3031
use rustc_middle::ty::query::Providers;
3132
use rustc_middle::ty::{self, TyCtxt, TypeFoldable};
32-
use rustc_mir::util;
3333
use rustc_span::{Span, Symbol};
3434

3535
mod abort_unwinding_calls;
@@ -73,10 +73,10 @@ mod simplify_try;
7373
mod uninhabited_enum_branching;
7474
mod unreachable_prop;
7575

76-
use rustc_mir::transform::check_consts;
77-
use rustc_mir::transform::promote_consts;
78-
use rustc_mir::transform::validate;
79-
use rustc_mir::transform::MirPass;
76+
use rustc_const_eval::transform::check_consts;
77+
use rustc_const_eval::transform::promote_consts;
78+
use rustc_const_eval::transform::validate;
79+
use rustc_const_eval::transform::MirPass;
8080
use rustc_mir_dataflow::rustc_peek;
8181

8282
pub fn provide(providers: &mut Providers) {

compiler/rustc_mir_transform/src/lower_slice_len.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! This pass lowers calls to core::slice::len to just Len op.
22
//! It should run before inlining!
33
4+
use crate::MirPass;
45
use rustc_hir::def_id::DefId;
56
use rustc_index::vec::IndexVec;
67
use rustc_middle::mir::*;
78
use rustc_middle::ty::{self, TyCtxt};
8-
use rustc_mir::transform::MirPass;
99

1010
pub struct LowerSliceLenCalls;
1111

compiler/rustc_mir_transform/src/match_branches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
134134
let const_cmp = Operand::const_from_scalar(
135135
tcx,
136136
switch_ty,
137-
rustc_mir::interpret::Scalar::from_uint(val, size),
137+
rustc_const_eval::interpret::Scalar::from_uint(val, size),
138138
rustc_span::DUMMY_SP,
139139
);
140140
let op = if f_b { BinOp::Eq } else { BinOp::Ne };

compiler/rustc_typeck/src/check/generator_interior.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This calculates the types which has storage which lives across a suspension point in a
22
//! generator from the perspective of typeck. The actual types used at runtime
3-
//! is calculated in `rustc_mir::transform::generator` and may be a subset of the
3+
//! is calculated in `rustc_const_eval::transform::generator` and may be a subset of the
44
//! types computed here.
55
66
use super::FnCtxt;

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ crate mod utils;
1111

1212
use rustc_ast as ast;
1313
use rustc_attr as attr;
14+
use rustc_const_eval::const_eval::{is_const_fn, is_unstable_const_fn};
1415
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1516
use rustc_hir as hir;
1617
use rustc_hir::def::{CtorKind, DefKind, Res};
@@ -22,7 +23,6 @@ use rustc_middle::ty::fold::TypeFolder;
2223
use rustc_middle::ty::subst::{InternalSubsts, Subst};
2324
use rustc_middle::ty::{self, AdtKind, DefIdTree, Lift, Ty, TyCtxt};
2425
use rustc_middle::{bug, span_bug};
25-
use rustc_mir::const_eval::{is_const_fn, is_unstable_const_fn};
2626
use rustc_span::hygiene::{AstPass, MacroKind};
2727
use rustc_span::symbol::{kw, sym, Ident, Symbol};
2828
use rustc_span::{self, ExpnKind};

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extern crate rustc_ast;
3434
extern crate rustc_ast_lowering;
3535
extern crate rustc_ast_pretty;
3636
extern crate rustc_attr;
37+
extern crate rustc_const_eval;
3738
extern crate rustc_data_structures;
3839
extern crate rustc_driver;
3940
extern crate rustc_errors;
@@ -49,7 +50,6 @@ extern crate rustc_lint;
4950
extern crate rustc_lint_defs;
5051
extern crate rustc_metadata;
5152
extern crate rustc_middle;
52-
extern crate rustc_mir;
5353
extern crate rustc_parse;
5454
extern crate rustc_passes;
5555
extern crate rustc_resolve;

0 commit comments

Comments
 (0)