Skip to content

Commit c53d9df

Browse files
committed
---
yaml --- r: 132644 b: refs/heads/dist-snap c: d7c0f7d h: refs/heads/master v: v3
1 parent 0ef6111 commit c53d9df

File tree

22 files changed

+159
-138
lines changed

22 files changed

+159
-138
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: d4d608fabda8f39f319ebefd9aebf4ceb7c1bbf4
9+
refs/heads/dist-snap: d7c0f7d1c07a060b6d06bdd60b24c78bd2c9a6c3
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ please do two things:
1616

1717
2. Run the full Rust test suite with the `make check` command. You're
1818
not off the hook even if you just stick to documentation; code
19-
examples in the docs are tested as well! Although for simple
20-
wording or grammar fixes, this is probably unnecessary.
19+
examples in the docs are tested as well!
2120

2221
Pull requests will be treated as "review requests", and we will give
2322
feedback we expect to see corrected on

branches/dist-snap/mk/main.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ endif
139139
RUSTFLAGS_STAGE0 += -C prefer-dynamic
140140
RUSTFLAGS_STAGE1 += -C prefer-dynamic
141141

142-
# Landing pads require a lot of codegen. We can get through bootstrapping faster
143-
# by not emitting them.
144-
RUSTFLAGS_STAGE0 += -Z no-landing-pads
145-
146142
# platform-specific auto-configuration
147143
include $(CFG_SRC_DIR)mk/platform.mk
148144

branches/dist-snap/src/doc/guide-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ This part is coming soon.
655655
# Returning Pointers
656656

657657
In many languages with pointers, you'd return a pointer from a function
658-
so as to avoid copying a large data structure. For example:
658+
so as to avoid a copying a large data structure. For example:
659659

660660
```{rust}
661661
struct BigStruct {

branches/dist-snap/src/libcore/num/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl Float for f32 {
293293
#[inline]
294294
fn frac_pi_8() -> f32 { consts::FRAC_PI_8 }
295295

296-
/// 1.0 / pi
296+
/// 1 .0/ pi
297297
#[inline]
298298
fn frac_1_pi() -> f32 { consts::FRAC_1_PI }
299299

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,20 +1400,6 @@ fn link_args(cmd: &mut Command,
14001400
cmd.arg("-Wl,--gc-sections");
14011401
}
14021402

1403-
let used_link_args = sess.cstore.get_used_link_args().borrow();
1404-
1405-
// Dynamically linked executables can be compiled as position independent if the default
1406-
// relocation model of position independent code is not changed. This is a requirement to take
1407-
// advantage of ASLR, as otherwise the functions in the executable are not randomized and can
1408-
// be used during an exploit of a vulnerability in any code.
1409-
if sess.targ_cfg.os == abi::OsLinux {
1410-
let mut args = sess.opts.cg.link_args.iter().chain(used_link_args.iter());
1411-
if !dylib && sess.opts.cg.relocation_model.as_slice() == "pic" &&
1412-
!args.any(|x| x.as_slice() == "-static") {
1413-
cmd.arg("-pie");
1414-
}
1415-
}
1416-
14171403
if sess.targ_cfg.os == abi::OsLinux || sess.targ_cfg.os == abi::OsDragonfly {
14181404
// GNU-style linkers will use this to omit linking to libraries which
14191405
// don't actually fulfill any relocations, but only for libraries which
@@ -1582,7 +1568,9 @@ fn link_args(cmd: &mut Command,
15821568
// Finally add all the linker arguments provided on the command line along
15831569
// with any #[link_args] attributes found inside the crate
15841570
cmd.args(sess.opts.cg.link_args.as_slice());
1585-
cmd.args(used_link_args.as_slice());
1571+
for arg in sess.cstore.get_used_link_args().borrow().iter() {
1572+
cmd.arg(arg.as_slice());
1573+
}
15861574
}
15871575

15881576
// # Native library linking

branches/dist-snap/src/librustc/middle/trans/_match.rs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@
189189
#![allow(non_camel_case_types)]
190190

191191
use back::abi;
192+
use mc = middle::mem_categorization;
192193
use driver::config::FullDebugInfo;
194+
use euv = middle::expr_use_visitor;
193195
use llvm;
194196
use llvm::{ValueRef, BasicBlockRef};
195197
use middle::const_eval;
@@ -1292,13 +1294,55 @@ pub fn trans_match<'a>(
12921294
trans_match_inner(bcx, match_expr.id, discr_expr, arms, dest)
12931295
}
12941296

1295-
fn create_bindings_map(bcx: &Block, pat: Gc<ast::Pat>) -> BindingsMap {
1297+
/// Checks whether the binding in `discr` is assigned to anywhere in the expression `body`
1298+
fn is_discr_reassigned(bcx: &Block, discr: &ast::Expr, body: &ast::Expr) -> bool {
1299+
match discr.node {
1300+
ast::ExprPath(..) => match bcx.def(discr.id) {
1301+
def::DefLocal(vid, _) | def::DefBinding(vid, _) => {
1302+
let mut rc = ReassignmentChecker {
1303+
node: vid,
1304+
reassigned: false
1305+
};
1306+
{
1307+
let mut visitor = euv::ExprUseVisitor::new(&mut rc, bcx);
1308+
visitor.walk_expr(body);
1309+
}
1310+
rc.reassigned
1311+
}
1312+
_ => false
1313+
},
1314+
_ => false
1315+
}
1316+
}
1317+
1318+
struct ReassignmentChecker {
1319+
node: ast::NodeId,
1320+
reassigned: bool
1321+
}
1322+
1323+
impl euv::Delegate for ReassignmentChecker {
1324+
fn consume(&mut self, _: ast::NodeId, _: Span, _: mc::cmt, _: euv::ConsumeMode) {}
1325+
fn consume_pat(&mut self, _: &ast::Pat, _: mc::cmt, _: euv::ConsumeMode) {}
1326+
fn borrow(&mut self, _: ast::NodeId, _: Span, _: mc::cmt, _: ty::Region,
1327+
_: ty::BorrowKind, _: euv::LoanCause) {}
1328+
fn decl_without_init(&mut self, _: ast::NodeId, _: Span) {}
1329+
fn mutate(&mut self, _: ast::NodeId, _: Span, cmt: mc::cmt, _: euv::MutateMode) {
1330+
match cmt.cat {
1331+
mc::cat_local(vid) => self.reassigned = self.node == vid,
1332+
_ => {}
1333+
}
1334+
}
1335+
}
1336+
1337+
fn create_bindings_map(bcx: &Block, pat: Gc<ast::Pat>,
1338+
discr: &ast::Expr, body: &ast::Expr) -> BindingsMap {
12961339
// Create the bindings map, which is a mapping from each binding name
12971340
// to an alloca() that will be the value for that local variable.
12981341
// Note that we use the names because each binding will have many ids
12991342
// from the various alternatives.
13001343
let ccx = bcx.ccx();
13011344
let tcx = bcx.tcx();
1345+
let reassigned = is_discr_reassigned(bcx, discr, body);
13021346
let mut bindings_map = HashMap::new();
13031347
pat_bindings(&tcx.def_map, &*pat, |bm, p_id, span, path1| {
13041348
let ident = path1.node;
@@ -1310,7 +1354,7 @@ fn create_bindings_map(bcx: &Block, pat: Gc<ast::Pat>) -> BindingsMap {
13101354
let trmode;
13111355
match bm {
13121356
ast::BindByValue(_)
1313-
if !ty::type_moves_by_default(tcx, variable_ty) => {
1357+
if !ty::type_moves_by_default(tcx, variable_ty) || reassigned => {
13141358
llmatch = alloca_no_lifetime(bcx,
13151359
llvariable_ty.ptr_to(),
13161360
"__llmatch");
@@ -1371,7 +1415,7 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
13711415
let arm_datas: Vec<ArmData> = arms.iter().map(|arm| ArmData {
13721416
bodycx: fcx.new_id_block("case_body", arm.body.id),
13731417
arm: arm,
1374-
bindings_map: create_bindings_map(bcx, *arm.pats.get(0))
1418+
bindings_map: create_bindings_map(bcx, *arm.pats.get(0), discr_expr, &*arm.body)
13751419
}).collect();
13761420

13771421
let mut static_inliner = StaticInliner { tcx: scope_cx.tcx() };

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,8 +1932,7 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
19321932
llfn,
19331933
&param_substs::empty(),
19341934
item.id,
1935-
None,
1936-
TranslateItems);
1935+
None);
19371936
} else {
19381937
trans_fn(ccx,
19391938
&**decl,

branches/dist-snap/src/librustc/middle/trans/cabi.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ use std::option;
1313
use middle::trans::context::CrateContext;
1414
use middle::trans::cabi_x86;
1515
use middle::trans::cabi_x86_64;
16-
use middle::trans::cabi_x86_win64;
1716
use middle::trans::cabi_arm;
1817
use middle::trans::cabi_mips;
1918
use middle::trans::type_::Type;
2019
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
21-
use syntax::abi::{OsWin32};
2220

2321
#[deriving(Clone, PartialEq)]
2422
pub enum ArgKind {
@@ -109,12 +107,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
109107
ret_def: bool) -> FnType {
110108
match ccx.sess().targ_cfg.arch {
111109
X86 => cabi_x86::compute_abi_info(ccx, atys, rty, ret_def),
112-
X86_64 =>
113-
if ccx.sess().targ_cfg.os == OsWin32 {
114-
cabi_x86_win64::compute_abi_info(ccx, atys, rty, ret_def)
115-
} else {
116-
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)
117-
},
110+
X86_64 => cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def),
118111
Arm => cabi_arm::compute_abi_info(ccx, atys, rty, ret_def),
119112
Mips => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
120113
Mipsel => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),

branches/dist-snap/src/librustc/middle/trans/cabi_x86_win64.rs

Lines changed: 0 additions & 64 deletions
This file was deleted.

branches/dist-snap/src/librustc/middle/trans/common.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use driver::session::Session;
1616
use llvm;
1717
use llvm::{ValueRef, BasicBlockRef, BuilderRef};
1818
use llvm::{True, False, Bool};
19+
use mc = middle::mem_categorization;
1920
use middle::def;
2021
use middle::lang_items::LangItem;
2122
use middle::subst;
@@ -481,6 +482,36 @@ impl<'a> Block<'a> {
481482
}
482483
}
483484

485+
impl<'a> mc::Typer for Block<'a> {
486+
fn tcx<'a>(&'a self) -> &'a ty::ctxt {
487+
self.tcx()
488+
}
489+
490+
fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> {
491+
Ok(node_id_type(self, id))
492+
}
493+
494+
fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t> {
495+
self.tcx().method_map.borrow().find(&method_call).map(|method| method.ty)
496+
}
497+
498+
fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>> {
499+
&self.tcx().adjustments
500+
}
501+
502+
fn is_method_call(&self, id: ast::NodeId) -> bool {
503+
self.tcx().method_map.borrow().contains_key(&typeck::MethodCall::expr(id))
504+
}
505+
506+
fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<ast::NodeId> {
507+
self.tcx().region_maps.temporary_scope(rvalue_id)
508+
}
509+
510+
fn upvar_borrow(&self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow {
511+
self.tcx().upvar_borrow_map.borrow().get_copy(&upvar_id)
512+
}
513+
}
514+
484515
pub struct Result<'a> {
485516
pub bcx: &'a Block<'a>,
486517
pub val: ValueRef

branches/dist-snap/src/librustc/middle/trans/foreign.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
577577
llwrapfn: ValueRef,
578578
param_substs: &param_substs,
579579
id: ast::NodeId,
580-
hash: Option<&str>,
581-
handle_items: HandleItemsFlag) {
580+
hash: Option<&str>) {
582581
let _icx = push_ctxt("foreign::build_foreign_fn");
583582

584583
let fnty = ty::node_id_to_type(ccx.tcx(), id);
@@ -587,8 +586,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
587586

588587
unsafe { // unsafe because we call LLVM operations
589588
// Build up the Rust function (`foo0` above).
590-
let llrustfn = build_rust_fn(ccx, decl, body, param_substs, attrs, id,
591-
hash, handle_items);
589+
let llrustfn = build_rust_fn(ccx, decl, body, param_substs, attrs, id, hash);
592590

593591
// Build up the foreign wrapper (`foo` above).
594592
return build_wrap_fn(ccx, llrustfn, llwrapfn, &tys, mty);
@@ -600,8 +598,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
600598
param_substs: &param_substs,
601599
attrs: &[ast::Attribute],
602600
id: ast::NodeId,
603-
hash: Option<&str>,
604-
handle_items: HandleItemsFlag)
601+
hash: Option<&str>)
605602
-> ValueRef {
606603
let _icx = push_ctxt("foreign::foreign::build_rust_fn");
607604
let tcx = ccx.tcx();
@@ -633,7 +630,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
633630

634631
let llfn = base::decl_internal_rust_fn(ccx, t, ps.as_slice());
635632
base::set_llvm_fn_attrs(attrs, llfn);
636-
base::trans_fn(ccx, decl, body, llfn, param_substs, id, [], handle_items);
633+
base::trans_fn(ccx, decl, body, llfn, param_substs, id, [], TranslateItems);
637634
llfn
638635
}
639636

branches/dist-snap/src/librustc/middle/trans/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub mod meth;
3131
pub mod cabi;
3232
pub mod cabi_x86;
3333
pub mod cabi_x86_64;
34-
pub mod cabi_x86_win64;
3534
pub mod cabi_arm;
3635
pub mod cabi_mips;
3736
pub mod foreign;

branches/dist-snap/src/librustc/middle/trans/monomorphize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
164164
if abi != abi::Rust {
165165
foreign::trans_rust_fn_with_foreign_abi(
166166
ccx, &**decl, &**body, [], d, &psubsts, fn_id.node,
167-
Some(hash.as_slice()), IgnoreItems);
167+
Some(hash.as_slice()));
168168
} else {
169169
trans_fn(ccx, &**decl, &**body, d, &psubsts, fn_id.node, [],
170170
IgnoreItems);

branches/dist-snap/src/librustdoc/html/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ r##"<!DOCTYPE html>
106106
</p>
107107
<p>
108108
Accepted types are: <code>fn</code>, <code>mod</code>,
109-
<code>struct</code>, <code>enum</code>,
109+
<code>struct</code> (or <code>str</code>), <code>enum</code>,
110110
<code>trait</code>, <code>typedef</code> (or
111111
<code>tdef</code>).
112112
</p>

0 commit comments

Comments
 (0)