Skip to content

Commit

Permalink
Auto merge of #80522 - cjgillot:borrowcrate, r=oli-obk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Sep 8, 2021
2 parents 47ae8de + 924dbc3 commit 97032a6
Show file tree
Hide file tree
Showing 200 changed files with 938 additions and 706 deletions.
119 changes: 102 additions & 17 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3621,6 +3621,33 @@ dependencies = [
"rustc_span",
]

[[package]]
name = "rustc_borrowck"
version = "0.0.0"
dependencies = [
"either",
"itertools 0.9.0",
"polonius-engine",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lexer",
"rustc_middle",
"rustc_mir_dataflow",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_traits",
"smallvec",
"tracing",
]

[[package]]
name = "rustc_builtin_macros"
version = "0.0.0"
Expand Down Expand Up @@ -3704,6 +3731,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 @@ -3742,6 +3793,7 @@ dependencies = [
"rustc_ast",
"rustc_ast_pretty",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
Expand All @@ -3752,7 +3804,6 @@ dependencies = [
"rustc_lint",
"rustc_metadata",
"rustc_middle",
"rustc_mir",
"rustc_parse",
"rustc_plugin_impl",
"rustc_save_analysis",
Expand Down Expand Up @@ -3911,9 +3962,11 @@ dependencies = [
"rustc_ast_lowering",
"rustc_ast_passes",
"rustc_attr",
"rustc_borrowck",
"rustc_builtin_macros",
"rustc_codegen_llvm",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
Expand All @@ -3922,8 +3975,9 @@ dependencies = [
"rustc_lint",
"rustc_metadata",
"rustc_middle",
"rustc_mir",
"rustc_mir_build",
"rustc_mir_transform",
"rustc_monomorphize",
"rustc_parse",
"rustc_passes",
"rustc_plugin_impl",
Expand Down Expand Up @@ -4041,6 +4095,8 @@ version = "0.0.0"
dependencies = [
"bitflags",
"chalk-ir",
"either",
"gsgdt",
"polonius-engine",
"rustc-rayon-core",
"rustc_apfloat",
Expand All @@ -4050,6 +4106,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_macros",
Expand All @@ -4064,51 +4121,63 @@ dependencies = [
]

[[package]]
name = "rustc_mir"
name = "rustc_mir_build"
version = "0.0.0"
dependencies = [
"coverage_test_macros",
"either",
"gsgdt",
"itertools 0.9.0",
"polonius-engine",
"regex",
"rustc_apfloat",
"rustc_arena",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lexer",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"rustc_traits",
"smallvec",
"tracing",
]

[[package]]
name = "rustc_mir_build"
name = "rustc_mir_dataflow"
version = "0.0.0"
dependencies = [
"rustc_apfloat",
"rustc_arena",
"polonius-engine",
"regex",
"rustc_ast",
"rustc_data_structures",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
"smallvec",
"tracing",
]

[[package]]
name = "rustc_mir_transform"
version = "0.0.0"
dependencies = [
"coverage_test_macros",
"itertools 0.9.0",
"rustc_ast",
"rustc_attr",
"rustc_const_eval",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_middle",
"rustc_mir_dataflow",
"rustc_serialize",
"rustc_session",
"rustc_span",
Expand All @@ -4118,6 +4187,22 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_monomorphize"
version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_middle",
"rustc_session",
"rustc_span",
"rustc_target",
"smallvec",
"tracing",
]

[[package]]
name = "rustc_parse"
version = "0.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rustc_mir"
name = "rustc_borrowck"
version = "0.0.0"
edition = "2018"

Expand All @@ -8,30 +8,23 @@ doctest = false

[dependencies]
either = "1.5.0"
rustc_graphviz = { path = "../rustc_graphviz" }
gsgdt = "0.1.2"
itertools = "0.9"
tracing = "0.1"
polonius-engine = "0.13.0"
regex = "1"
rustc_middle = { path = "../rustc_middle" }
rustc_attr = { path = "../rustc_attr" }
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
rustc_target = { path = "../rustc_target" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_traits = { path = "../rustc_traits" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
rustc_apfloat = { path = "../rustc_apfloat" }
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }

[dev-dependencies]
coverage_test_macros = { path = "src/transform/coverage/test_macros" }
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::borrow_check::nll::ToRegionVid;
use crate::borrow_check::path_utils::allow_two_phase_borrow;
use crate::borrow_check::place_ext::PlaceExt;
use crate::dataflow::indexes::BorrowIndex;
use crate::dataflow::move_paths::MoveData;
use crate::nll::ToRegionVid;
use crate::path_utils::allow_two_phase_borrow;
use crate::place_ext::PlaceExt;
use crate::BorrowIndex;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::traversal;
use rustc_middle::mir::visit::{MutatingUseContext, NonUseContext, PlaceContext, Visitor};
use rustc_middle::mir::{self, Body, Local, Location};
use rustc_middle::ty::{RegionVid, TyCtxt};
use rustc_mir_dataflow::move_paths::MoveData;
use std::fmt;
use std::ops::Index;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc_errors::{struct_span_err, DiagnosticBuilder, DiagnosticId};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::{MultiSpan, Span};

impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
crate fn cannot_move_when_borrowed(&self, span: Span, desc: &str) -> DiagnosticBuilder<'cx> {
struct_span_err!(self, span, E0505, "cannot move out of {} because it is borrowed", desc,)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, RegionVid, Ty};

use crate::borrow_check::{
use crate::{
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, nll::ToRegionVid,
places_conflict, region_infer::values::LivenessValues,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc_middle::mir::ConstraintCategory;
use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
use rustc_span::DUMMY_SP;

use crate::borrow_check::{
use crate::{
constraints::OutlivesConstraintIndex,
constraints::{OutlivesConstraint, OutlivesConstraintSet},
type_check::Locations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
use std::fmt;
use std::ops::Index;

use crate::borrow_check::type_check::Locations;
use crate::type_check::Locations;

crate mod graph;

Expand Down
File renamed without changes.
Loading

0 comments on commit 97032a6

Please sign in to comment.