Skip to content

Commit 567b90f

Browse files
committed
auto merge of #19582 : nikomatsakis/rust/crateification, r=alexcrichton
r? @alexcrichton
2 parents 2bfb64e + 2854d1b commit 567b90f

File tree

18 files changed

+140
-153
lines changed

18 files changed

+140
-153
lines changed

mk/crates.mk

+6-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test time rand \
5454
log regex graphviz core rbml alloc rustrt \
5555
unicode
56-
RUSTC_CRATES := rustc rustc_typeck rustc_driver rustc_trans rustc_back rustc_llvm
56+
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_driver rustc_trans rustc_back rustc_llvm
5757
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
5858
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
@@ -67,11 +67,12 @@ DEPS_std := core libc rand alloc collections rustrt unicode \
6767
native:rust_builtin native:backtrace
6868
DEPS_graphviz := std
6969
DEPS_syntax := std term serialize log fmt_macros arena libc
70-
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back \
70+
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
7171
rustc_typeck log syntax serialize rustc_llvm rustc_trans
7272
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
7373
log syntax serialize rustc_llvm
7474
DEPS_rustc_typeck := rustc syntax
75+
DEPS_rustc_borrowck := rustc log graphviz syntax
7576
DEPS_rustc := syntax flate arena serialize getopts rbml \
7677
time log graphviz rustc_llvm rustc_back
7778
DEPS_rustc_llvm := native:rustllvm libc std
@@ -117,9 +118,10 @@ ONLY_RLIB_unicode := 1
117118
DOC_CRATES := $(filter-out rustc, \
118119
$(filter-out rustc_trans, \
119120
$(filter-out rustc_typeck, \
121+
$(filter-out rustc_borrowck, \
120122
$(filter-out rustc_driver, \
121-
$(filter-out syntax, $(CRATES))))))
122-
COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck rustc_driver syntax
123+
$(filter-out syntax, $(CRATES)))))))
124+
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_typeck rustc_driver syntax
123125

124126
# This macro creates some simple definitions for each crate being built, just
125127
# some munging of all of the parameters above.

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $(eval $(call RUST_CRATE,coretest))
2121

2222
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
2323
TEST_DOC_CRATES = $(DOC_CRATES)
24-
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_trans,$(HOST_CRATES))
24+
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_trans,$(HOST_CRATES))
2525
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2626

2727
######################################################################

src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub mod back {
6161
pub mod middle {
6262
pub mod astconv_util;
6363
pub mod astencode;
64-
pub mod borrowck;
6564
pub mod cfg;
6665
pub mod check_const;
6766
pub mod check_static_recursion;

src/librustc/middle/borrowck/check_loans.rs renamed to src/librustc_borrowck/borrowck/check_loans.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@
1818
// 4. moves do not affect things loaned out in any way
1919
use self::UseError::*;
2020

21-
use middle::borrowck::*;
22-
use middle::borrowck::LoanPathElem::*;
23-
use middle::borrowck::LoanPathKind::*;
24-
use middle::expr_use_visitor as euv;
25-
use middle::mem_categorization as mc;
26-
use middle::region;
27-
use middle::ty::ParameterEnvironment;
28-
use middle::ty;
29-
use syntax::ast::NodeId;
21+
use borrowck::*;
22+
use borrowck::LoanPathElem::*;
23+
use borrowck::LoanPathKind::*;
24+
use rustc::middle::expr_use_visitor as euv;
25+
use rustc::middle::mem_categorization as mc;
26+
use rustc::middle::region;
27+
use rustc::middle::ty;
28+
use rustc::util::ppaux::Repr;
3029
use syntax::ast;
3130
use syntax::codemap::Span;
32-
use util::ppaux::Repr;
3331

3432
use std::rc::Rc;
3533

@@ -91,7 +89,7 @@ struct CheckLoanCtxt<'a, 'tcx: 'a> {
9189
dfcx_loans: &'a LoanDataFlow<'a, 'tcx>,
9290
move_data: move_data::FlowedMoveData<'a, 'tcx>,
9391
all_loans: &'a [Loan<'tcx>],
94-
param_env: &'a ParameterEnvironment<'tcx>,
92+
param_env: &'a ty::ParameterEnvironment<'tcx>,
9593
}
9694

9795
impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
@@ -196,12 +194,12 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
196194
dfcx_loans: &LoanDataFlow<'b, 'tcx>,
197195
move_data: move_data::FlowedMoveData<'c, 'tcx>,
198196
all_loans: &[Loan<'tcx>],
199-
fn_id: NodeId,
197+
fn_id: ast::NodeId,
200198
decl: &ast::FnDecl,
201199
body: &ast::Block) {
202200
debug!("check_loans(body id={})", body.id);
203201

204-
let param_env = ParameterEnvironment::for_item(bccx.tcx, fn_id);
202+
let param_env = ty::ParameterEnvironment::for_item(bccx.tcx, fn_id);
205203

206204
let mut clcx = CheckLoanCtxt {
207205
bccx: bccx,

src/librustc/middle/borrowck/fragments.rs renamed to src/librustc_borrowck/borrowck/fragments.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
1515
use self::Fragment::*;
1616

17-
use session::config;
18-
use middle::borrowck::{LoanPath};
19-
use middle::borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
20-
use middle::borrowck::LoanPathElem::{LpDeref, LpInterior};
21-
use middle::borrowck::move_data::{InvalidMovePathIndex};
22-
use middle::borrowck::move_data::{MoveData, MovePathIndex};
23-
use middle::ty;
24-
use middle::mem_categorization as mc;
25-
use util::ppaux::{Repr, UserString};
26-
17+
use borrowck::{LoanPath};
18+
use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
19+
use borrowck::LoanPathElem::{LpDeref, LpInterior};
20+
use borrowck::move_data::{InvalidMovePathIndex};
21+
use borrowck::move_data::{MoveData, MovePathIndex};
22+
use rustc::session::config;
23+
use rustc::middle::ty;
24+
use rustc::middle::mem_categorization as mc;
25+
use rustc::util::ppaux::{Repr, UserString};
2726
use std::mem;
2827
use std::rc::Rc;
2928
use std::slice;

src/librustc/middle/borrowck/gather_loans/gather_moves.rs renamed to src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010

1111
//! Computes moves.
1212
13-
use middle::borrowck::*;
14-
use middle::borrowck::LoanPathKind::*;
15-
use middle::borrowck::gather_loans::move_error::MoveSpanAndPath;
16-
use middle::borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector};
17-
use middle::borrowck::move_data::*;
18-
use middle::expr_use_visitor as euv;
19-
use middle::mem_categorization as mc;
20-
use middle::ty;
13+
use borrowck::*;
14+
use borrowck::LoanPathKind::*;
15+
use borrowck::gather_loans::move_error::MoveSpanAndPath;
16+
use borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector};
17+
use borrowck::move_data::*;
18+
use rustc::middle::expr_use_visitor as euv;
19+
use rustc::middle::mem_categorization as mc;
20+
use rustc::middle::ty;
21+
use rustc::util::ppaux::Repr;
22+
use std::rc::Rc;
2123
use syntax::ast;
2224
use syntax::codemap::Span;
23-
use util::ppaux::Repr;
24-
25-
use std::rc::Rc;
2625

2726
struct GatherMoveInfo<'tcx> {
2827
id: ast::NodeId,

src/librustc/middle/borrowck/gather_loans/lifetime.rs renamed to src/librustc_borrowck/borrowck/gather_loans/lifetime.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
//! This module implements the check that the lifetime of a borrow
1212
//! does not exceed the lifetime of the value being borrowed.
1313
14-
use middle::borrowck::*;
15-
use middle::expr_use_visitor as euv;
16-
use middle::mem_categorization as mc;
17-
use middle::region;
18-
use middle::ty;
19-
use util::ppaux::Repr;
14+
use borrowck::*;
15+
use rustc::middle::expr_use_visitor as euv;
16+
use rustc::middle::mem_categorization as mc;
17+
use rustc::middle::region;
18+
use rustc::middle::ty;
19+
use rustc::util::ppaux::Repr;
2020
use syntax::ast;
2121
use syntax::codemap::Span;
2222

src/librustc/middle/borrowck/gather_loans/mod.rs renamed to src/librustc_borrowck/borrowck/gather_loans/mod.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@
1616
// their associated scopes. In phase two, checking loans, we will then make
1717
// sure that all of these loans are honored.
1818

19-
use middle::borrowck::*;
20-
use middle::borrowck::LoanPathKind::*;
21-
use middle::borrowck::move_data::MoveData;
22-
use middle::expr_use_visitor as euv;
23-
use middle::mem_categorization as mc;
24-
use middle::region;
25-
use middle::ty::ParameterEnvironment;
26-
use middle::ty;
27-
use util::ppaux::{Repr};
28-
19+
use borrowck::*;
20+
use borrowck::LoanPathKind::*;
21+
use borrowck::move_data::MoveData;
22+
use rustc::middle::expr_use_visitor as euv;
23+
use rustc::middle::mem_categorization as mc;
24+
use rustc::middle::region;
25+
use rustc::middle::ty;
26+
use rustc::util::ppaux::{Repr};
2927
use syntax::ast;
3028
use syntax::codemap::Span;
3129
use syntax::visit;
@@ -51,7 +49,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
5149
move_error_collector: move_error::MoveErrorCollector::new(),
5250
};
5351

54-
let param_env = ParameterEnvironment::for_item(bccx.tcx, fn_id);
52+
let param_env = ty::ParameterEnvironment::for_item(bccx.tcx, fn_id);
5553

5654
{
5755
let mut euv = euv::ExprUseVisitor::new(&mut glcx,

src/librustc/middle/borrowck/gather_loans/move_error.rs renamed to src/librustc_borrowck/borrowck/gather_loans/move_error.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use middle::mem_categorization as mc;
12-
use middle::borrowck::BorrowckCtxt;
13-
use middle::ty;
14-
11+
use borrowck::BorrowckCtxt;
12+
use rustc::middle::mem_categorization as mc;
13+
use rustc::middle::ty;
14+
use rustc::util::ppaux::UserString;
1515
use std::cell::RefCell;
1616
use syntax::ast;
1717
use syntax::codemap;
1818
use syntax::print::pprust;
19-
use util::ppaux::UserString;
2019

2120
pub struct MoveErrorCollector<'tcx> {
2221
errors: RefCell<Vec<MoveError<'tcx>>>

src/librustc/middle/borrowck/gather_loans/restrictions.rs renamed to src/librustc_borrowck/borrowck/gather_loans/restrictions.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
1313
pub use self::RestrictionResult::*;
1414

15-
use middle::borrowck::*;
16-
use middle::borrowck::LoanPathElem::*;
17-
use middle::borrowck::LoanPathKind::*;
18-
use middle::expr_use_visitor as euv;
19-
use middle::mem_categorization as mc;
20-
use middle::ty;
15+
use borrowck::*;
16+
use borrowck::LoanPathElem::*;
17+
use borrowck::LoanPathKind::*;
18+
use rustc::middle::expr_use_visitor as euv;
19+
use rustc::middle::mem_categorization as mc;
20+
use rustc::middle::ty;
21+
use rustc::util::ppaux::Repr;
2122
use syntax::codemap::Span;
22-
use util::ppaux::Repr;
2323

2424
use std::rc::Rc;
2525

src/librustc/middle/borrowck/mod.rs renamed to src/librustc_borrowck/borrowck/mod.rs

+10-25
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ pub use self::bckerr_code::*;
1818
pub use self::AliasableViolationKind::*;
1919
pub use self::MovedValueUseKind::*;
2020

21-
use middle::cfg;
22-
use middle::dataflow::DataFlowContext;
23-
use middle::dataflow::BitwiseOperator;
24-
use middle::dataflow::DataFlowOperator;
25-
use middle::expr_use_visitor as euv;
26-
use middle::mem_categorization as mc;
27-
use middle::region;
28-
use middle::ty::{mod, ParameterEnvironment, Ty};
29-
use util::ppaux::{note_and_explain_region, Repr, UserString};
30-
21+
use rustc::middle::cfg;
22+
use rustc::middle::dataflow::DataFlowContext;
23+
use rustc::middle::dataflow::BitwiseOperator;
24+
use rustc::middle::dataflow::DataFlowOperator;
25+
use rustc::middle::expr_use_visitor as euv;
26+
use rustc::middle::mem_categorization as mc;
27+
use rustc::middle::region;
28+
use rustc::middle::ty::{mod, Ty};
29+
use rustc::util::ppaux::{note_and_explain_region, Repr, UserString};
3130
use std::rc::Rc;
3231
use std::string::String;
3332
use syntax::ast;
@@ -55,8 +54,6 @@ pub mod check_loans;
5554

5655
pub mod gather_loans;
5756

58-
pub mod graphviz;
59-
6057
pub mod move_data;
6158

6259
#[deriving(Clone)]
@@ -298,18 +295,6 @@ pub struct LoanPath<'tcx> {
298295
ty: ty::Ty<'tcx>,
299296
}
300297

301-
impl<'tcx> LoanPath<'tcx> {
302-
pub fn eq_debug(&self, that: &LoanPath<'tcx>, tcx: &ty::ctxt<'tcx>) -> bool {
303-
let r = self.kind == that.kind;
304-
if r && self.ty != that.ty {
305-
panic!("eq variants ineq types: {} == {}, {} != {}",
306-
self.repr(tcx), that.repr(tcx),
307-
self.ty.repr(tcx), that.ty.repr(tcx));
308-
}
309-
r
310-
}
311-
}
312-
313298
impl<'tcx> PartialEq for LoanPath<'tcx> {
314299
fn eq(&self, that: &LoanPath<'tcx>) -> bool {
315300
let r = self.kind == that.kind;
@@ -560,7 +545,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
560545
lp: &LoanPath<'tcx>,
561546
the_move: &move_data::Move,
562547
moved_lp: &LoanPath<'tcx>,
563-
param_env: &ParameterEnvironment<'tcx>) {
548+
param_env: &ty::ParameterEnvironment<'tcx>) {
564549
let verb = match use_kind {
565550
MovedInUse => "use",
566551
MovedInCapture => "capture",

src/librustc/middle/borrowck/move_data.rs renamed to src/librustc_borrowck/borrowck/move_data.rs

+12-43
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
1414
pub use self::MoveKind::*;
1515

16+
use borrowck::*;
17+
use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
18+
use borrowck::LoanPathElem::{LpInterior};
19+
use rustc::middle::cfg;
20+
use rustc::middle::dataflow::DataFlowContext;
21+
use rustc::middle::dataflow::BitwiseOperator;
22+
use rustc::middle::dataflow::DataFlowOperator;
23+
use rustc::middle::expr_use_visitor as euv;
24+
use rustc::middle::mem_categorization as mc;
25+
use rustc::middle::ty;
26+
use rustc::util::nodemap::{FnvHashMap, NodeSet};
27+
use rustc::util::ppaux::Repr;
1628
use std::cell::RefCell;
1729
use std::rc::Rc;
1830
use std::uint;
19-
use middle::borrowck::*;
20-
use middle::borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
21-
use middle::borrowck::LoanPathElem::{LpInterior};
22-
use middle::cfg;
23-
use middle::dataflow::DataFlowContext;
24-
use middle::dataflow::BitwiseOperator;
25-
use middle::dataflow::DataFlowOperator;
26-
use middle::expr_use_visitor as euv;
27-
use middle::mem_categorization as mc;
28-
use middle::ty;
2931
use syntax::ast;
3032
use syntax::ast_util;
3133
use syntax::codemap::Span;
32-
use util::nodemap::{FnvHashMap, NodeSet};
33-
use util::ppaux::Repr;
3434

3535
#[path="fragments.rs"]
3636
pub mod fragments;
@@ -220,37 +220,6 @@ fn loan_path_is_precise(loan_path: &LoanPath) -> bool {
220220
}
221221
}
222222

223-
impl Move {
224-
pub fn to_string<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
225-
format!("Move{} path: {}, id: {}, kind: {} {}",
226-
"{",
227-
move_data.path_loan_path(self.path).repr(tcx),
228-
self.id,
229-
self.kind,
230-
"}")
231-
}
232-
}
233-
234-
impl Assignment {
235-
pub fn to_string<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
236-
format!("Assignment{} path: {}, id: {} {}",
237-
"{",
238-
move_data.path_loan_path(self.path).repr(tcx),
239-
self.id,
240-
"}")
241-
}
242-
}
243-
244-
impl VariantMatch {
245-
pub fn to_string<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String {
246-
format!("VariantMatch{} path: {}, id: {} {}",
247-
"{",
248-
move_data.path_loan_path(self.path).repr(tcx),
249-
self.id,
250-
"}")
251-
}
252-
}
253-
254223
impl<'tcx> MoveData<'tcx> {
255224
pub fn new() -> MoveData<'tcx> {
256225
MoveData {

0 commit comments

Comments
 (0)