Skip to content

Commit 97032a6

Browse files
committed
Auto merge of #80522 - cjgillot:borrowcrate, r=oli-obk
Split rustc_mir The `rustc_mir` crate is the second largest in the compiler. This PR splits it up into 5 crates: - rustc_borrowck; - rustc_const_eval; - rustc_mir_dataflow; - rustc_mir_transform; - rustc_monomorphize.
2 parents 47ae8de + 924dbc3 commit 97032a6

File tree

200 files changed

+938
-706
lines changed

Some content is hidden

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

200 files changed

+938
-706
lines changed

Diff for: Cargo.lock

+102-17
Original file line numberDiff line numberDiff line change
@@ -3621,6 +3621,33 @@ dependencies = [
36213621
"rustc_span",
36223622
]
36233623

3624+
[[package]]
3625+
name = "rustc_borrowck"
3626+
version = "0.0.0"
3627+
dependencies = [
3628+
"either",
3629+
"itertools 0.9.0",
3630+
"polonius-engine",
3631+
"rustc_const_eval",
3632+
"rustc_data_structures",
3633+
"rustc_errors",
3634+
"rustc_graphviz",
3635+
"rustc_hir",
3636+
"rustc_index",
3637+
"rustc_infer",
3638+
"rustc_lexer",
3639+
"rustc_middle",
3640+
"rustc_mir_dataflow",
3641+
"rustc_serialize",
3642+
"rustc_session",
3643+
"rustc_span",
3644+
"rustc_target",
3645+
"rustc_trait_selection",
3646+
"rustc_traits",
3647+
"smallvec",
3648+
"tracing",
3649+
]
3650+
36243651
[[package]]
36253652
name = "rustc_builtin_macros"
36263653
version = "0.0.0"
@@ -3704,6 +3731,30 @@ dependencies = [
37043731
"tracing",
37053732
]
37063733

3734+
[[package]]
3735+
name = "rustc_const_eval"
3736+
version = "0.0.0"
3737+
dependencies = [
3738+
"either",
3739+
"gsgdt",
3740+
"rustc_apfloat",
3741+
"rustc_ast",
3742+
"rustc_attr",
3743+
"rustc_data_structures",
3744+
"rustc_errors",
3745+
"rustc_hir",
3746+
"rustc_index",
3747+
"rustc_infer",
3748+
"rustc_macros",
3749+
"rustc_middle",
3750+
"rustc_mir_dataflow",
3751+
"rustc_session",
3752+
"rustc_span",
3753+
"rustc_target",
3754+
"rustc_trait_selection",
3755+
"tracing",
3756+
]
3757+
37073758
[[package]]
37083759
name = "rustc_data_structures"
37093760
version = "0.0.0"
@@ -3742,6 +3793,7 @@ dependencies = [
37423793
"rustc_ast",
37433794
"rustc_ast_pretty",
37443795
"rustc_codegen_ssa",
3796+
"rustc_const_eval",
37453797
"rustc_data_structures",
37463798
"rustc_error_codes",
37473799
"rustc_errors",
@@ -3752,7 +3804,6 @@ dependencies = [
37523804
"rustc_lint",
37533805
"rustc_metadata",
37543806
"rustc_middle",
3755-
"rustc_mir",
37563807
"rustc_parse",
37573808
"rustc_plugin_impl",
37583809
"rustc_save_analysis",
@@ -3911,9 +3962,11 @@ dependencies = [
39113962
"rustc_ast_lowering",
39123963
"rustc_ast_passes",
39133964
"rustc_attr",
3965+
"rustc_borrowck",
39143966
"rustc_builtin_macros",
39153967
"rustc_codegen_llvm",
39163968
"rustc_codegen_ssa",
3969+
"rustc_const_eval",
39173970
"rustc_data_structures",
39183971
"rustc_errors",
39193972
"rustc_expand",
@@ -3922,8 +3975,9 @@ dependencies = [
39223975
"rustc_lint",
39233976
"rustc_metadata",
39243977
"rustc_middle",
3925-
"rustc_mir",
39263978
"rustc_mir_build",
3979+
"rustc_mir_transform",
3980+
"rustc_monomorphize",
39273981
"rustc_parse",
39283982
"rustc_passes",
39293983
"rustc_plugin_impl",
@@ -4041,6 +4095,8 @@ version = "0.0.0"
40414095
dependencies = [
40424096
"bitflags",
40434097
"chalk-ir",
4098+
"either",
4099+
"gsgdt",
40444100
"polonius-engine",
40454101
"rustc-rayon-core",
40464102
"rustc_apfloat",
@@ -4050,6 +4106,7 @@ dependencies = [
40504106
"rustc_data_structures",
40514107
"rustc_errors",
40524108
"rustc_feature",
4109+
"rustc_graphviz",
40534110
"rustc_hir",
40544111
"rustc_index",
40554112
"rustc_macros",
@@ -4064,51 +4121,63 @@ dependencies = [
40644121
]
40654122

40664123
[[package]]
4067-
name = "rustc_mir"
4124+
name = "rustc_mir_build"
40684125
version = "0.0.0"
40694126
dependencies = [
4070-
"coverage_test_macros",
4071-
"either",
4072-
"gsgdt",
4073-
"itertools 0.9.0",
4074-
"polonius-engine",
4075-
"regex",
40764127
"rustc_apfloat",
4128+
"rustc_arena",
40774129
"rustc_ast",
40784130
"rustc_attr",
40794131
"rustc_data_structures",
40804132
"rustc_errors",
4081-
"rustc_graphviz",
40824133
"rustc_hir",
40834134
"rustc_index",
40844135
"rustc_infer",
4085-
"rustc_lexer",
4086-
"rustc_macros",
40874136
"rustc_middle",
40884137
"rustc_serialize",
40894138
"rustc_session",
40904139
"rustc_span",
40914140
"rustc_target",
40924141
"rustc_trait_selection",
4093-
"rustc_traits",
40944142
"smallvec",
40954143
"tracing",
40964144
]
40974145

40984146
[[package]]
4099-
name = "rustc_mir_build"
4147+
name = "rustc_mir_dataflow"
41004148
version = "0.0.0"
41014149
dependencies = [
4102-
"rustc_apfloat",
4103-
"rustc_arena",
4150+
"polonius-engine",
4151+
"regex",
4152+
"rustc_ast",
4153+
"rustc_data_structures",
4154+
"rustc_graphviz",
4155+
"rustc_hir",
4156+
"rustc_index",
4157+
"rustc_middle",
4158+
"rustc_serialize",
4159+
"rustc_session",
4160+
"rustc_span",
4161+
"rustc_target",
4162+
"smallvec",
4163+
"tracing",
4164+
]
4165+
4166+
[[package]]
4167+
name = "rustc_mir_transform"
4168+
version = "0.0.0"
4169+
dependencies = [
4170+
"coverage_test_macros",
4171+
"itertools 0.9.0",
41044172
"rustc_ast",
41054173
"rustc_attr",
4174+
"rustc_const_eval",
41064175
"rustc_data_structures",
41074176
"rustc_errors",
41084177
"rustc_hir",
41094178
"rustc_index",
4110-
"rustc_infer",
41114179
"rustc_middle",
4180+
"rustc_mir_dataflow",
41124181
"rustc_serialize",
41134182
"rustc_session",
41144183
"rustc_span",
@@ -4118,6 +4187,22 @@ dependencies = [
41184187
"tracing",
41194188
]
41204189

4190+
[[package]]
4191+
name = "rustc_monomorphize"
4192+
version = "0.0.0"
4193+
dependencies = [
4194+
"rustc_data_structures",
4195+
"rustc_errors",
4196+
"rustc_hir",
4197+
"rustc_index",
4198+
"rustc_middle",
4199+
"rustc_session",
4200+
"rustc_span",
4201+
"rustc_target",
4202+
"smallvec",
4203+
"tracing",
4204+
]
4205+
41214206
[[package]]
41224207
name = "rustc_parse"
41234208
version = "0.0.0"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "rustc_mir"
2+
name = "rustc_borrowck"
33
version = "0.0.0"
44
edition = "2018"
55

@@ -8,30 +8,23 @@ doctest = false
88

99
[dependencies]
1010
either = "1.5.0"
11-
rustc_graphviz = { path = "../rustc_graphviz" }
12-
gsgdt = "0.1.2"
1311
itertools = "0.9"
1412
tracing = "0.1"
1513
polonius-engine = "0.13.0"
16-
regex = "1"
17-
rustc_middle = { path = "../rustc_middle" }
18-
rustc_attr = { path = "../rustc_attr" }
14+
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
1915
rustc_data_structures = { path = "../rustc_data_structures" }
2016
rustc_errors = { path = "../rustc_errors" }
17+
rustc_graphviz = { path = "../rustc_graphviz" }
2118
rustc_hir = { path = "../rustc_hir" }
2219
rustc_index = { path = "../rustc_index" }
2320
rustc_infer = { path = "../rustc_infer" }
2421
rustc_lexer = { path = "../rustc_lexer" }
25-
rustc_macros = { path = "../rustc_macros" }
22+
rustc_middle = { path = "../rustc_middle" }
23+
rustc_const_eval = { path = "../rustc_const_eval" }
24+
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
2625
rustc_serialize = { path = "../rustc_serialize" }
2726
rustc_session = { path = "../rustc_session" }
2827
rustc_target = { path = "../rustc_target" }
2928
rustc_trait_selection = { path = "../rustc_trait_selection" }
3029
rustc_traits = { path = "../rustc_traits" }
31-
rustc_ast = { path = "../rustc_ast" }
3230
rustc_span = { path = "../rustc_span" }
33-
rustc_apfloat = { path = "../rustc_apfloat" }
34-
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
35-
36-
[dev-dependencies]
37-
coverage_test_macros = { path = "src/transform/coverage/test_macros" }

Diff for: compiler/rustc_mir/src/borrow_check/borrow_set.rs renamed to compiler/rustc_borrowck/src/borrow_set.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
use crate::borrow_check::nll::ToRegionVid;
2-
use crate::borrow_check::path_utils::allow_two_phase_borrow;
3-
use crate::borrow_check::place_ext::PlaceExt;
4-
use crate::dataflow::indexes::BorrowIndex;
5-
use crate::dataflow::move_paths::MoveData;
1+
use crate::nll::ToRegionVid;
2+
use crate::path_utils::allow_two_phase_borrow;
3+
use crate::place_ext::PlaceExt;
4+
use crate::BorrowIndex;
65
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
76
use rustc_index::bit_set::BitSet;
87
use rustc_middle::mir::traversal;
98
use rustc_middle::mir::visit::{MutatingUseContext, NonUseContext, PlaceContext, Visitor};
109
use rustc_middle::mir::{self, Body, Local, Location};
1110
use rustc_middle::ty::{RegionVid, TyCtxt};
11+
use rustc_mir_dataflow::move_paths::MoveData;
1212
use std::fmt;
1313
use std::ops::Index;
1414

Diff for: compiler/rustc_mir/src/util/borrowck_errors.rs renamed to compiler/rustc_borrowck/src/borrowck_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_errors::{struct_span_err, DiagnosticBuilder, DiagnosticId};
22
use rustc_middle::ty::{self, Ty, TyCtxt};
33
use rustc_span::{MultiSpan, Span};
44

5-
impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
5+
impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
66
crate fn cannot_move_when_borrowed(&self, span: Span, desc: &str) -> DiagnosticBuilder<'cx> {
77
struct_span_err!(self, span, E0505, "cannot move out of {} because it is borrowed", desc,)
88
}

Diff for: compiler/rustc_mir/src/borrow_check/constraint_generation.rs renamed to compiler/rustc_borrowck/src/constraint_generation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::fold::TypeFoldable;
99
use rustc_middle::ty::subst::SubstsRef;
1010
use rustc_middle::ty::{self, RegionVid, Ty};
1111

12-
use crate::borrow_check::{
12+
use crate::{
1313
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, nll::ToRegionVid,
1414
places_conflict, region_infer::values::LivenessValues,
1515
};

Diff for: compiler/rustc_mir/src/borrow_check/constraints/graph.rs renamed to compiler/rustc_borrowck/src/constraints/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_middle::mir::ConstraintCategory;
44
use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
55
use rustc_span::DUMMY_SP;
66

7-
use crate::borrow_check::{
7+
use crate::{
88
constraints::OutlivesConstraintIndex,
99
constraints::{OutlivesConstraint, OutlivesConstraintSet},
1010
type_check::Locations,

Diff for: compiler/rustc_mir/src/borrow_check/constraints/mod.rs renamed to compiler/rustc_borrowck/src/constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
55
use std::fmt;
66
use std::ops::Index;
77

8-
use crate::borrow_check::type_check::Locations;
8+
use crate::type_check::Locations;
99

1010
crate mod graph;
1111

0 commit comments

Comments
 (0)