Skip to content

Commit d53aa36

Browse files
committed
---
yaml --- r: 128701 b: refs/heads/try c: 69c58bc h: refs/heads/master i: 128699: 8f7c2b5 v: v3
1 parent 71b1e9b commit d53aa36

File tree

18 files changed

+135
-23
lines changed

18 files changed

+135
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 71df8e655c1a7a435082de753694821f359fb8a9
5+
refs/heads/try: 69c58bcf6f8392c078e5f4ea0281e904cd8e8afb
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ 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!
19+
examples in the docs are tested as well! Although for simple
20+
wording or grammar fixes, this is probably unnecessary.
2021

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

branches/try/mk/main.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ 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+
142146
# platform-specific auto-configuration
143147
include $(CFG_SRC_DIR)mk/platform.mk
144148

branches/try/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 a copying a large data structure. For example:
658+
so as to avoid copying a large data structure. For example:
659659

660660
```{rust}
661661
struct BigStruct {

branches/try/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/try/src/librustc/back/link.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,20 @@ 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+
14031417
if sess.targ_cfg.os == abi::OsLinux || sess.targ_cfg.os == abi::OsDragonfly {
14041418
// GNU-style linkers will use this to omit linking to libraries which
14051419
// don't actually fulfill any relocations, but only for libraries which
@@ -1568,9 +1582,7 @@ fn link_args(cmd: &mut Command,
15681582
// Finally add all the linker arguments provided on the command line along
15691583
// with any #[link_args] attributes found inside the crate
15701584
cmd.args(sess.opts.cg.link_args.as_slice());
1571-
for arg in sess.cstore.get_used_link_args().borrow().iter() {
1572-
cmd.arg(arg.as_slice());
1573-
}
1585+
cmd.args(used_link_args.as_slice());
15741586
}
15751587

15761588
// # Native library linking

branches/try/src/librustc/middle/trans/base.rs

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

branches/try/src/librustc/middle/trans/cabi.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ 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;
1617
use middle::trans::cabi_arm;
1718
use middle::trans::cabi_mips;
1819
use middle::trans::type_::Type;
1920
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
21+
use syntax::abi::{OsWin32};
2022

2123
#[deriving(Clone, PartialEq)]
2224
pub enum ArgKind {
@@ -107,7 +109,12 @@ pub fn compute_abi_info(ccx: &CrateContext,
107109
ret_def: bool) -> FnType {
108110
match ccx.sess().targ_cfg.arch {
109111
X86 => cabi_x86::compute_abi_info(ccx, atys, rty, ret_def),
110-
X86_64 => cabi_x86_64::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+
},
111118
Arm => cabi_arm::compute_abi_info(ccx, atys, rty, ret_def),
112119
Mips => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
113120
Mipsel => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use llvm::*;
12+
use super::cabi::*;
13+
use super::common::*;
14+
use super::machine::*;
15+
use middle::trans::type_::Type;
16+
17+
// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
18+
19+
pub fn compute_abi_info(ccx: &CrateContext,
20+
atys: &[Type],
21+
rty: Type,
22+
ret_def: bool) -> FnType {
23+
let mut arg_tys = Vec::new();
24+
25+
let ret_ty;
26+
if !ret_def {
27+
ret_ty = ArgType::direct(Type::void(ccx), None, None, None);
28+
} else if rty.kind() == Struct {
29+
ret_ty = match llsize_of_alloc(ccx, rty) {
30+
1 => ArgType::direct(rty, Some(Type::i8(ccx)), None, None),
31+
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
32+
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
33+
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
34+
_ => ArgType::indirect(rty, Some(StructRetAttribute))
35+
};
36+
} else {
37+
let attr = if rty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
38+
ret_ty = ArgType::direct(rty, None, None, attr);
39+
}
40+
41+
for &t in atys.iter() {
42+
let ty = match t.kind() {
43+
Struct => {
44+
match llsize_of_alloc(ccx, t) {
45+
1 => ArgType::direct(rty, Some(Type::i8(ccx)), None, None),
46+
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
47+
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
48+
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
49+
_ => ArgType::indirect(t, Some(ByValAttribute))
50+
}
51+
}
52+
_ => {
53+
let attr = if t == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
54+
ArgType::direct(t, None, None, attr)
55+
}
56+
};
57+
arg_tys.push(ty);
58+
}
59+
60+
return FnType {
61+
arg_tys: arg_tys,
62+
ret_ty: ret_ty,
63+
};
64+
}

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ 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>) {
580+
hash: Option<&str>,
581+
handle_items: HandleItemsFlag) {
581582
let _icx = push_ctxt("foreign::build_foreign_fn");
582583

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

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

591593
// Build up the foreign wrapper (`foo` above).
592594
return build_wrap_fn(ccx, llrustfn, llwrapfn, &tys, mty);
@@ -598,7 +600,8 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
598600
param_substs: &param_substs,
599601
attrs: &[ast::Attribute],
600602
id: ast::NodeId,
601-
hash: Option<&str>)
603+
hash: Option<&str>,
604+
handle_items: HandleItemsFlag)
602605
-> ValueRef {
603606
let _icx = push_ctxt("foreign::foreign::build_rust_fn");
604607
let tcx = ccx.tcx();
@@ -630,7 +633,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
630633

631634
let llfn = base::decl_internal_rust_fn(ccx, t, ps.as_slice());
632635
base::set_llvm_fn_attrs(attrs, llfn);
633-
base::trans_fn(ccx, decl, body, llfn, param_substs, id, [], TranslateItems);
636+
base::trans_fn(ccx, decl, body, llfn, param_substs, id, [], handle_items);
634637
llfn
635638
}
636639

branches/try/src/librustc/middle/trans/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub mod meth;
3131
pub mod cabi;
3232
pub mod cabi_x86;
3333
pub mod cabi_x86_64;
34+
pub mod cabi_x86_win64;
3435
pub mod cabi_arm;
3536
pub mod cabi_mips;
3637
pub mod foreign;

branches/try/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()));
167+
Some(hash.as_slice()), IgnoreItems);
168168
} else {
169169
trans_fn(ccx, &**decl, &**body, d, &psubsts, fn_id.node, [],
170170
IgnoreItems);

branches/try/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> (or <code>str</code>), <code>enum</code>,
109+
<code>struct</code>, <code>enum</code>,
110110
<code>trait</code>, <code>typedef</code> (or
111111
<code>tdef</code>).
112112
</p>

branches/try/src/librustdoc/html/static/main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,18 +368,19 @@
368368
}
369369

370370
function getQuery() {
371-
var matches, type, query = $('.search-input').val();
371+
var matches, type, query, raw = $('.search-input').val();
372+
query = raw;
372373

373-
matches = query.match(/^(fn|mod|str(uct)?|enum|trait|t(ype)?d(ef)?)\s*:\s*/i);
374+
matches = query.match(/^(fn|mod|struct|enum|trait|t(ype)?d(ef)?)\s*:\s*/i);
374375
if (matches) {
375376
type = matches[1].replace(/^td$/, 'typedef')
376-
.replace(/^str$/, 'struct')
377377
.replace(/^tdef$/, 'typedef')
378378
.replace(/^typed$/, 'typedef');
379379
query = query.substring(matches[0].length);
380380
}
381381

382382
return {
383+
raw: raw,
383384
query: query,
384385
type: type,
385386
id: query + type,
@@ -535,10 +536,10 @@
535536
if (browserSupportsHistoryApi()) {
536537
if (!history.state && !params.search) {
537538
history.pushState(query, "", "?search=" +
538-
encodeURIComponent(query.query));
539+
encodeURIComponent(query.raw));
539540
} else {
540541
history.replaceState(query, "", "?search=" +
541-
encodeURIComponent(query.query));
542+
encodeURIComponent(query.raw));
542543
}
543544
}
544545

branches/try/src/librustdoc/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,16 @@ pub fn main() {
120120
// So, in summary, it is unknown why this is necessary, what it is
121121
// preventing, or what the actual bug is. In the meantime, this allows
122122
// --test to work on windows, which seems good, right? Fun times.
123+
let (tx, rx) = channel();
123124
spawn(proc() {
124125
std::os::set_exit_status(main_args(std::os::args().as_slice()));
126+
tx.send(());
125127
});
128+
129+
// If the task failed, set an error'd exit status
130+
if rx.recv_opt().is_err() {
131+
std::os::set_exit_status(std::rt::DEFAULT_ERROR_CODE);
132+
}
126133
}
127134

128135
pub fn opts() -> Vec<getopts::OptGroup> {

branches/try/src/test/compile-fail/repeat_count.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ fn main() {
2323
//~^ ERROR: expected `uint` but found `&'static str`
2424
let f = [0, ..-4];
2525
//~^ ERROR expected positive integer for repeat count but found negative integer
26+
let f = [0u, ..-1];
27+
//~^ ERROR expected positive integer for repeat count but found negative integer
2628
}

branches/try/src/test/run-make/issue-7349/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Test to make sure that inner functions within a polymorphic outer function
44
# don't get re-translated when the outer function is monomorphized. The test
5-
# code monomorphizes the outer function several times, but the magic constant
6-
# `8675309` used in the inner function should appear only once in the generated
7-
# IR.
5+
# code monomorphizes the outer functions several times, but the magic constants
6+
# used in the inner functions should each appear only once in the generated IR.
87

98
all:
109
$(RUSTC) foo.rs --emit=ir
1110
[ "$$(grep -c 8675309 "$(TMPDIR)/foo.ll")" -eq "1" ]
11+
[ "$$(grep -c 11235813 "$(TMPDIR)/foo.ll")" -eq "1" ]

branches/try/src/test/run-make/issue-7349/foo.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ fn outer<T>() {
1515
}
1616
}
1717

18+
extern "C" fn outer_foreign<T>() {
19+
#[allow(dead_code)]
20+
fn inner() -> uint {
21+
11235813
22+
}
23+
}
24+
1825
fn main() {
1926
outer::<int>();
2027
outer::<uint>();
28+
outer_foreign::<int>();
29+
outer_foreign::<uint>();
2130
}

0 commit comments

Comments
 (0)