Skip to content

Commit 8578869

Browse files
committed
---
yaml --- r: 81786 b: refs/heads/master c: 7eed184 h: refs/heads/master v: v3
1 parent 94fbaff commit 8578869

File tree

18 files changed

+55
-212
lines changed

18 files changed

+55
-212
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 97053995046636c0e11d23c4f0523d278a4210c9
2+
refs/heads/master: 7eed184dbb07c18b27dab8d444e62a96e85313cc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729

trunk/RELEASES.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Version 0.8 (October 2013)
3131
* `ref` bindings in irrefutable patterns work correctly now.
3232
* `char` is now prevented from containing invalid code points.
3333
* Casting to `bool` is no longer allowed.
34-
* `\0` is now accepted as an escape in chars and strings.
3534
* `yield` is a reserved keyword.
3635
* `typeof` is a reserved keyword.
3736
* Crates may be imported by URL with `extern mod foo = "url";`.
@@ -112,9 +111,6 @@ Version 0.8 (October 2013)
112111
the `MutableSet` and `MutableMap` traits. `Container::is_empty`,
113112
`Map::contains_key`, `MutableMap::insert`, and `MutableMap::remove` have
114113
default implementations.
115-
* std: Various `from_str` functions were removed in favor of a generic
116-
`from_str` which is available in the prelude.
117-
* std: `util::unreachable` removed in favor of the `unreachable!` macro.
118114
* extra: `dlist`, the doubly-linked list was modernized.
119115
* extra: Added a `hex` module with `ToHex` and `FromHex` traits.
120116
* extra: Added `glob` module, replacing `std::os::glob`.
@@ -129,9 +125,6 @@ Version 0.8 (October 2013)
129125
* extra: `semver` updated to SemVer 2.0.0.
130126
* extra: `term` handles more terminals correctly.
131127
* extra: `dbg` module removed.
132-
* extra: `par` module removed.
133-
* extra: `future` was cleaned up, with some method renames.
134-
* extra: Most free functions in `getopts` were converted to methods.
135128

136129
* Other
137130
* rustc's debug info generation (`-Z debug-info`) is greatly improved.
@@ -212,7 +205,6 @@ Version 0.7 (July 2013)
212205
* std: Many old internal vector and string iterators,
213206
incl. `any`, `all`. removed.
214207
* std: The `finalize` method of `Drop` renamed to `drop`.
215-
* std: The `drop` method now takes `&mut self` instead of `&self`.
216208
* std: The prelude no longer reexports any modules, only types and traits.
217209
* std: Prelude additions: `print`, `println`, `FromStr`, `ApproxEq`, `Equiv`,
218210
`Iterator`, `IteratorUtil`, many numeric traits, many tuple traits.

trunk/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use util::ppaux::Repr;
3333

3434
#[deriving(Clone)]
3535
struct CheckLoanCtxt<'self> {
36-
bccx: @BorrowckCtxt,
36+
bccx: &'self BorrowckCtxt,
3737
dfcx_loans: &'self LoanDataFlow,
3838
move_data: @move_data::FlowedMoveData,
3939
all_loans: &'self [Loan],
@@ -60,7 +60,7 @@ impl<'self> Visitor<()> for CheckLoanCtxt<'self> {
6060
}
6161
}
6262

63-
pub fn check_loans(bccx: @BorrowckCtxt,
63+
pub fn check_loans(bccx: &BorrowckCtxt,
6464
dfcx_loans: &LoanDataFlow,
6565
move_data: move_data::FlowedMoveData,
6666
all_loans: &[Loan],

trunk/src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use syntax::ast_util;
2222
use syntax::codemap::Span;
2323
use util::ppaux::{UserString};
2424

25-
pub fn gather_decl(bccx: @BorrowckCtxt,
25+
pub fn gather_decl(bccx: &BorrowckCtxt,
2626
move_data: &mut MoveData,
2727
decl_id: ast::NodeId,
2828
_decl_span: Span,
@@ -31,23 +31,23 @@ pub fn gather_decl(bccx: @BorrowckCtxt,
3131
move_data.add_move(bccx.tcx, loan_path, decl_id, Declared);
3232
}
3333

34-
pub fn gather_move_from_expr(bccx: @BorrowckCtxt,
34+
pub fn gather_move_from_expr(bccx: &BorrowckCtxt,
3535
move_data: &mut MoveData,
3636
move_expr: @ast::Expr,
3737
cmt: mc::cmt) {
3838
gather_move_from_expr_or_pat(bccx, move_data, move_expr.id,
3939
MoveExpr(move_expr), cmt);
4040
}
4141

42-
pub fn gather_move_from_pat(bccx: @BorrowckCtxt,
42+
pub fn gather_move_from_pat(bccx: &BorrowckCtxt,
4343
move_data: &mut MoveData,
4444
move_pat: @ast::Pat,
4545
cmt: mc::cmt) {
4646
gather_move_from_expr_or_pat(bccx, move_data, move_pat.id,
4747
MovePat(move_pat), cmt);
4848
}
4949

50-
fn gather_move_from_expr_or_pat(bccx: @BorrowckCtxt,
50+
fn gather_move_from_expr_or_pat(bccx: &BorrowckCtxt,
5151
move_data: &mut MoveData,
5252
move_id: ast::NodeId,
5353
move_kind: MoveKind,
@@ -66,7 +66,7 @@ fn gather_move_from_expr_or_pat(bccx: @BorrowckCtxt,
6666
}
6767
}
6868

69-
pub fn gather_captures(bccx: @BorrowckCtxt,
69+
pub fn gather_captures(bccx: &BorrowckCtxt,
7070
move_data: &mut MoveData,
7171
closure_expr: @ast::Expr) {
7272
let captured_vars = bccx.capture_map.get(&closure_expr.id);
@@ -83,7 +83,7 @@ pub fn gather_captures(bccx: @BorrowckCtxt,
8383
}
8484
}
8585

86-
pub fn gather_assignment(bccx: @BorrowckCtxt,
86+
pub fn gather_assignment(bccx: &BorrowckCtxt,
8787
move_data: &mut MoveData,
8888
assignment_id: ast::NodeId,
8989
assignment_span: Span,
@@ -96,7 +96,7 @@ pub fn gather_assignment(bccx: @BorrowckCtxt,
9696
assignee_id);
9797
}
9898

99-
fn check_is_legal_to_move_from(bccx: @BorrowckCtxt,
99+
fn check_is_legal_to_move_from(bccx: &BorrowckCtxt,
100100
cmt0: mc::cmt,
101101
cmt: mc::cmt) -> bool {
102102
match cmt.cat {

trunk/src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax::ast;
2020
use syntax::codemap::Span;
2121
use util::ppaux::{note_and_explain_region};
2222

23-
pub fn guarantee_lifetime(bccx: @BorrowckCtxt,
23+
pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
2424
item_scope_id: ast::NodeId,
2525
root_scope_id: ast::NodeId,
2626
span: Span,
@@ -42,8 +42,8 @@ pub fn guarantee_lifetime(bccx: @BorrowckCtxt,
4242
///////////////////////////////////////////////////////////////////////////
4343
// Private
4444

45-
struct GuaranteeLifetimeContext {
46-
bccx: @BorrowckCtxt,
45+
struct GuaranteeLifetimeContext<'self> {
46+
bccx: &'self BorrowckCtxt,
4747

4848
// the node id of the function body for the enclosing item
4949
item_scope_id: ast::NodeId,
@@ -58,7 +58,7 @@ struct GuaranteeLifetimeContext {
5858
cmt_original: mc::cmt
5959
}
6060

61-
impl GuaranteeLifetimeContext {
61+
impl<'self> GuaranteeLifetimeContext<'self> {
6262
fn tcx(&self) -> ty::ctxt {
6363
self.bccx.tcx
6464
}

trunk/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ mod gather_moves;
6464
/// No good. Instead what will happen is that `root_ub` will be set to the
6565
/// body of the while loop and we will refuse to root the pointer `&*x`
6666
/// because it would have to be rooted for a region greater than `root_ub`.
67-
struct GatherLoanCtxt {
68-
bccx: @BorrowckCtxt,
67+
struct GatherLoanCtxt<'self> {
68+
bccx: &'self BorrowckCtxt,
6969
id_range: id_range,
7070
move_data: @mut move_data::MoveData,
7171
all_loans: @mut ~[Loan],
7272
item_ub: ast::NodeId,
7373
repeating_ids: ~[ast::NodeId]
7474
}
7575

76-
impl visit::Visitor<()> for GatherLoanCtxt {
76+
impl<'self> visit::Visitor<()> for GatherLoanCtxt<'self> {
7777
fn visit_expr(&mut self, ex:@Expr, _:()) {
7878
gather_loans_in_expr(self, ex);
7979
}
@@ -100,7 +100,7 @@ impl visit::Visitor<()> for GatherLoanCtxt {
100100
fn visit_item(&mut self, _:@ast::item, _:()) { }
101101
}
102102

103-
pub fn gather_loans(bccx: @BorrowckCtxt,
103+
pub fn gather_loans(bccx: &BorrowckCtxt,
104104
decl: &ast::fn_decl,
105105
body: &ast::Block)
106106
-> (id_range, @mut ~[Loan], @mut move_data::MoveData) {
@@ -315,7 +315,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
315315
}
316316
}
317317

318-
impl GatherLoanCtxt {
318+
impl<'self> GatherLoanCtxt<'self> {
319319
pub fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
320320

321321
pub fn push_repeating_id(&mut self, id: ast::NodeId) {
@@ -532,7 +532,7 @@ impl GatherLoanCtxt {
532532
// }
533533
// }
534534

535-
fn check_mutability(bccx: @BorrowckCtxt,
535+
fn check_mutability(bccx: &BorrowckCtxt,
536536
borrow_span: Span,
537537
cmt: mc::cmt,
538538
req_mutbl: LoanMutability) {

trunk/src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub enum RestrictionResult {
2323
SafeIf(@LoanPath, ~[Restriction])
2424
}
2525

26-
pub fn compute_restrictions(bccx: @BorrowckCtxt,
26+
pub fn compute_restrictions(bccx: &BorrowckCtxt,
2727
span: Span,
2828
cmt: mc::cmt,
2929
restr: RestrictionSet) -> RestrictionResult {
@@ -39,13 +39,13 @@ pub fn compute_restrictions(bccx: @BorrowckCtxt,
3939
///////////////////////////////////////////////////////////////////////////
4040
// Private
4141

42-
struct RestrictionsContext {
43-
bccx: @BorrowckCtxt,
42+
struct RestrictionsContext<'self> {
43+
bccx: &'self BorrowckCtxt,
4444
span: Span,
4545
cmt_original: mc::cmt
4646
}
4747

48-
impl RestrictionsContext {
48+
impl<'self> RestrictionsContext<'self> {
4949
fn tcx(&self) -> ty::ctxt {
5050
self.bccx.tcx
5151
}

trunk/src/librustc/middle/borrowck/mod.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ impl Clone for LoanDataFlowOperator {
6161

6262
pub type LoanDataFlow = DataFlowContext<LoanDataFlowOperator>;
6363

64-
struct BorrowckVisitor;
65-
66-
impl Visitor<@BorrowckCtxt> for BorrowckVisitor {
64+
impl Visitor<()> for BorrowckCtxt {
6765
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl,
68-
b:&Block, s:Span, n:NodeId, e:@BorrowckCtxt) {
69-
borrowck_fn(self, fk, fd, b, s, n, e);
66+
b:&Block, s:Span, n:NodeId, _:()) {
67+
borrowck_fn(self, fk, fd, b, s, n);
7068
}
7169
}
7270

@@ -78,7 +76,7 @@ pub fn check_crate(
7876
capture_map: moves::CaptureMap,
7977
crate: &ast::Crate) -> (root_map, write_guard_map)
8078
{
81-
let bccx = @BorrowckCtxt {
79+
let mut bccx = BorrowckCtxt {
8280
tcx: tcx,
8381
method_map: method_map,
8482
moves_map: moves_map,
@@ -96,9 +94,9 @@ pub fn check_crate(
9694
guaranteed_paths: 0,
9795
}
9896
};
97+
let bccx = &mut bccx;
9998

100-
let mut v = BorrowckVisitor;
101-
visit::walk_crate(&mut v, crate, bccx);
99+
visit::walk_crate(bccx, crate, ());
102100

103101
if tcx.sess.borrowck_stats() {
104102
io::println("--- borrowck stats ---");
@@ -116,20 +114,19 @@ pub fn check_crate(
116114

117115
return (bccx.root_map, bccx.write_guard_map);
118116

119-
fn make_stat(bccx: &BorrowckCtxt, stat: uint) -> ~str {
117+
fn make_stat(bccx: &mut BorrowckCtxt, stat: uint) -> ~str {
120118
let stat_f = stat as float;
121119
let total = bccx.stats.guaranteed_paths as float;
122120
fmt!("%u (%.0f%%)", stat , stat_f * 100f / total)
123121
}
124122
}
125123

126-
fn borrowck_fn(v: &mut BorrowckVisitor,
124+
fn borrowck_fn(this: &mut BorrowckCtxt,
127125
fk: &visit::fn_kind,
128126
decl: &ast::fn_decl,
129127
body: &ast::Block,
130128
sp: Span,
131-
id: ast::NodeId,
132-
this: @BorrowckCtxt) {
129+
id: ast::NodeId) {
133130
match fk {
134131
&visit::fk_anon(*) |
135132
&visit::fk_fn_block(*) => {
@@ -166,7 +163,7 @@ fn borrowck_fn(v: &mut BorrowckVisitor,
166163
}
167164
}
168165

169-
visit::walk_fn(v, fk, decl, body, sp, id, this);
166+
visit::walk_fn(this, fk, decl, body, sp, id, ());
170167
}
171168

172169
// ----------------------------------------------------------------------

trunk/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,6 +2416,11 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
24162416
unsafe {
24172417
llvm::LLVMPositionBuilderAtEnd(bld, llbb);
24182418

2419+
let crate_map = ccx.crate_map;
2420+
let opaque_crate_map = do "crate_map".with_c_str |buf| {
2421+
llvm::LLVMBuildPointerCast(bld, crate_map, Type::i8p().to_ref(), buf)
2422+
};
2423+
24192424
let (start_fn, args) = if use_start_lang_item {
24202425
let start_def_id = match ccx.tcx.lang_items.require(StartFnLangItem) {
24212426
Ok(id) => id,
@@ -2438,7 +2443,8 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
24382443
C_null(Type::opaque_box(ccx).ptr_to()),
24392444
opaque_rust_main,
24402445
llvm::LLVMGetParam(llfn, 0),
2441-
llvm::LLVMGetParam(llfn, 1)
2446+
llvm::LLVMGetParam(llfn, 1),
2447+
opaque_crate_map
24422448
]
24432449
};
24442450
(start_fn, args)
@@ -2447,7 +2453,8 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
24472453
let args = ~[
24482454
C_null(Type::opaque_box(ccx).ptr_to()),
24492455
llvm::LLVMGetParam(llfn, 0 as c_uint),
2450-
llvm::LLVMGetParam(llfn, 1 as c_uint)
2456+
llvm::LLVMGetParam(llfn, 1 as c_uint),
2457+
opaque_crate_map
24512458
];
24522459

24532460
(rust_main, args)
@@ -2628,16 +2635,13 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
26282635
}
26292636
ast::foreign_item_static(*) => {
26302637
let ident = foreign::link_name(ccx, ni);
2631-
unsafe {
2632-
let g = do ident.with_c_str |buf| {
2638+
let g = do ident.with_c_str |buf| {
2639+
unsafe {
26332640
let ty = type_of(ccx, ty);
26342641
llvm::LLVMAddGlobal(ccx.llmod, ty.to_ref(), buf)
2635-
};
2636-
if attr::contains_name(ni.attrs, "weak_linkage") {
2637-
lib::llvm::SetLinkage(g, lib::llvm::ExternalWeakLinkage);
26382642
}
2639-
g
2640-
}
2643+
};
2644+
g
26412645
}
26422646
}
26432647
}
@@ -2955,14 +2959,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29552959
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
29562960
}
29572961
};
2958-
// On windows we'd like to export the toplevel cratemap
2959-
// such that we can find it from libstd.
2960-
if targ_cfg.os == session::OsWin32 && "toplevel" == mapname {
2961-
lib::llvm::SetLinkage(map, lib::llvm::DLLExportLinkage);
2962-
} else {
2963-
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2964-
}
2965-
2962+
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
29662963
return map;
29672964
}
29682965

@@ -3117,26 +3114,6 @@ pub fn trans_crate(sess: session::Session,
31173114

31183115
decl_gc_metadata(ccx, llmod_id);
31193116
fill_crate_map(ccx, ccx.crate_map);
3120-
3121-
// NOTE win32: wart with exporting crate_map symbol
3122-
// We set the crate map (_rust_crate_map_toplevel) to use dll_export
3123-
// linkage but that ends up causing the linker to look for a
3124-
// __rust_crate_map_toplevel symbol (extra underscore) which it will
3125-
// subsequently fail to find. So to mitigate that we just introduce
3126-
// an alias from the symbol it expects to the one that actually exists.
3127-
if ccx.sess.targ_cfg.os == session::OsWin32 &&
3128-
!*ccx.sess.building_library {
3129-
3130-
let maptype = val_ty(ccx.crate_map).to_ref();
3131-
3132-
do "__rust_crate_map_toplevel".with_c_str |buf| {
3133-
unsafe {
3134-
llvm::LLVMAddAlias(ccx.llmod, maptype,
3135-
ccx.crate_map, buf);
3136-
}
3137-
}
3138-
}
3139-
31403117
glue::emit_tydescs(ccx);
31413118
write_abi_version(ccx);
31423119
if ccx.sess.opts.debuginfo {

0 commit comments

Comments
 (0)