Skip to content

Commit c7ccb09

Browse files
committed
---
yaml --- r: 172479 b: refs/heads/auto c: 9d2e9b9 h: refs/heads/master i: 172477: 3c249ee 172475: c9dddf8 172471: e15632e 172463: cc7084a 172447: 4ccf30c 172415: d02c9ce v: v3
1 parent 4840ee1 commit c7ccb09

32 files changed

+202
-80
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: a03ae681d3f52ca6a6aaf7ebfd32a51af6d4e4da
13+
refs/heads/auto: 9d2e9b9be62316f0bae4ac833c2485f55915ee6c
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/compiletest/header.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ pub struct TestProps {
4242
pub pretty_compare_only: bool,
4343
// Patterns which must not appear in the output of a cfail test.
4444
pub forbid_output: Vec<String>,
45-
// Ignore errors which originate from a command line span
46-
pub ignore_command_line: bool,
4745
}
4846

4947
// Load any test directives embedded in the file
@@ -62,8 +60,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
6260
let mut pretty_mode = None;
6361
let mut pretty_compare_only = false;
6462
let mut forbid_output = Vec::new();
65-
let mut ignore_command_line = false;
66-
6763
iter_header(testfile, |ln| {
6864
match parse_error_pattern(ln) {
6965
Some(ep) => error_patterns.push(ep),
@@ -106,10 +102,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
106102
pretty_compare_only = parse_pretty_compare_only(ln);
107103
}
108104

109-
if !ignore_command_line {
110-
ignore_command_line = parse_ignore_command_line(ln);
111-
}
112-
113105
match parse_aux_build(ln) {
114106
Some(ab) => { aux_builds.push(ab); }
115107
None => {}
@@ -148,7 +140,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
148140
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
149141
pretty_compare_only: pretty_compare_only,
150142
forbid_output: forbid_output,
151-
ignore_command_line: ignore_command_line,
152143
}
153144
}
154145

@@ -300,10 +291,6 @@ fn parse_pretty_compare_only(line: &str) -> bool {
300291
parse_name_directive(line, "pretty-compare-only")
301292
}
302293

303-
fn parse_ignore_command_line(line: &str) -> bool {
304-
parse_name_directive(line, "ignore-command-line")
305-
}
306-
307294
fn parse_exec_env(line: &str) -> Option<(String, String)> {
308295
parse_name_value_directive(line, "exec-env").map(|nv| {
309296
// nv is either FOO or FOO=BAR

branches/auto/src/compiletest/runtest.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
104104
if !props.error_patterns.is_empty() {
105105
fatal("both error pattern and expected errors specified");
106106
}
107-
check_expected_errors(props, expected_errors, testfile, &proc_res);
107+
check_expected_errors(expected_errors, testfile, &proc_res);
108108
} else {
109109
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
110110
}
@@ -941,8 +941,7 @@ fn check_forbid_output(props: &TestProps,
941941
}
942942
}
943943

944-
fn check_expected_errors(props: &TestProps,
945-
expected_errors: Vec<errors::ExpectedError> ,
944+
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
946945
testfile: &Path,
947946
proc_res: &ProcRes) {
948947

@@ -997,11 +996,6 @@ fn check_expected_errors(props: &TestProps,
997996
was_expected = true;
998997
}
999998

1000-
if line.starts_with("<command line option>") &&
1001-
props.ignore_command_line {
1002-
was_expected = true;
1003-
}
1004-
1005999
if !was_expected && is_compiler_error_or_warning(line) {
10061000
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
10071001
line).as_slice(),

branches/auto/src/doc/trpl/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ navigate through the menu on the left.
1111
## Basics
1212

1313
This section is a linear introduction to the basic syntax and semantics of
14-
Rust. It has individual sections on each part of Rust's syntax, and cumulates
14+
Rust. It has individual sections on each part of Rust's syntax, and culminates
1515
in a small project: a guessing game.
1616

1717
After reading "Basics," you will have a good foundation to learn more about
@@ -27,7 +27,7 @@ and will be able to understand most Rust code and write more complex programs.
2727

2828
## Advanced
2929

30-
In a similar fashion to "Intermediate," this setion is full of individual,
30+
In a similar fashion to "Intermediate," this section is full of individual,
3131
deep-dive chapters, which stand alone and can be read in any order. These
3232
chapters focus on the most complex features, as well as some things that
3333
are only available in upcoming versions of Rust.

branches/auto/src/doc/trpl/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% Advanced
22

3-
In a similar fashion to "Intermediate," this setion is full of individual,
3+
In a similar fashion to "Intermediate," this section is full of individual,
44
deep-dive chapters, which stand alone and can be read in any order. These
55
chapters focus on the most complex features, as well as some things that
66
are only available in upcoming versions of Rust.
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
% Conclusion
22

33
We covered a lot of ground here. When you've mastered everything in this Guide,
4-
you will have a firm grasp of basic Rust development. There's a whole lot more
5-
out there, we've just covered the surface. There's tons of topics that you can
6-
dig deeper into, and we've built specialized guides for many of them. To learn
7-
more, dig into the [full documentation
8-
index](index.html).
4+
you will have a firm grasp of Rust development. There's a whole lot more
5+
out there, though, we've just covered the surface. There's tons of topics that
6+
you can dig deeper into, e.g. by reading the API documentation of the
7+
[standard library](http://doc.rust-lang.org/std/), by discovering solutions for
8+
common problems on [Rust by Example](http://rustbyexample.com/), or by browsing
9+
crates written by the community on [crates.io](https://crates.io/).
910

1011
Happy hacking!

branches/auto/src/doc/trpl/hello-cargo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Rust projects, and so it is assumed that Rust projects will use Cargo from the
77
beginning.
88

99
Cargo manages three things: building your code, downloading the dependencies
10-
your code needs, and building the dependencies your code needs. At first, your
10+
your code needs, and building those dependencies. At first, your
1111
program doesn't have any dependencies, so we'll only be using the first part of
1212
its functionality. Eventually, we'll add more. Since we started off by using
1313
Cargo, it'll be easy to add later.

branches/auto/src/doc/trpl/ownership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Here are the three rules:
488488
parameter.
489489

490490
* If there is exactly one input lifetime, elided or not, that lifetime is
491-
assigned to all elided lifetimes in the return values of that function..
491+
assigned to all elided lifetimes in the return values of that function.
492492

493493
* If there are multiple input lifetimes, but one of them is `&self` or `&mut
494494
self`, the lifetime of `self` is assigned to all elided output lifetimes.

branches/auto/src/doc/trpl/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ extern crate adder;
309309
310310
#[test]
311311
fn it_works() {
312-
assert_eq(4, adder::add_two(2));
312+
assert_eq!(4, adder::add_two(2));
313313
}
314314
```
315315

branches/auto/src/libcollections/macros.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -12,6 +12,10 @@
1212
#[macro_export]
1313
#[stable]
1414
macro_rules! vec {
15+
($x:expr; $y:expr) => ({
16+
let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$x; $y]);
17+
$crate::slice::SliceExt::into_vec(xs)
18+
});
1519
($($x:expr),*) => ({
1620
let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$($x),*]);
1721
$crate::slice::SliceExt::into_vec(xs)

branches/auto/src/libcore/fmt/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl<'a> Arguments<'a> {
180180
/// unsafety, but will ignore invalid .
181181
#[doc(hidden)] #[inline]
182182
#[unstable = "implementation detail of the `format_args!` macro"]
183+
#[cfg(stage0)] // SNAP 9e4e524
183184
pub fn with_placeholders(pieces: &'a [&'a str],
184185
fmt: &'a [rt::Argument<'a>],
185186
args: &'a [Argument<'a>]) -> Arguments<'a> {
@@ -189,6 +190,24 @@ impl<'a> Arguments<'a> {
189190
args: args
190191
}
191192
}
193+
/// This function is used to specify nonstandard formatting parameters.
194+
/// The `pieces` array must be at least as long as `fmt` to construct
195+
/// a valid Arguments structure. Also, any `Count` within `fmt` that is
196+
/// `CountIsParam` or `CountIsNextParam` has to point to an argument
197+
/// created with `argumentuint`. However, failing to do so doesn't cause
198+
/// unsafety, but will ignore invalid .
199+
#[doc(hidden)] #[inline]
200+
#[unstable = "implementation detail of the `format_args!` macro"]
201+
#[cfg(not(stage0))]
202+
pub fn with_placeholders(pieces: &'a [&'a str],
203+
fmt: &'a [rt::Argument],
204+
args: &'a [Argument<'a>]) -> Arguments<'a> {
205+
Arguments {
206+
pieces: pieces,
207+
fmt: Some(fmt),
208+
args: args
209+
}
210+
}
192211
}
193212

194213
/// This structure represents a safely precompiled version of a format string
@@ -207,7 +226,11 @@ pub struct Arguments<'a> {
207226
pieces: &'a [&'a str],
208227

209228
// Placeholder specs, or `None` if all specs are default (as in "{}{}").
229+
// SNAP 9e4e524
230+
#[cfg(stage0)]
210231
fmt: Option<&'a [rt::Argument<'a>]>,
232+
#[cfg(not(stage0))]
233+
fmt: Option<&'a [rt::Argument]>,
211234

212235
// Dynamic arguments for interpolation, to be interleaved with string
213236
// pieces. (Every argument is preceded by a string piece.)

branches/auto/src/libcore/fmt/rt.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ pub use self::Count::*;
2121
pub use self::Position::*;
2222
pub use self::Flag::*;
2323

24+
// SNAP 9e4e524
2425
#[doc(hidden)]
2526
#[derive(Copy)]
27+
#[cfg(not(stage0))]
28+
pub struct Argument {
29+
pub position: Position,
30+
pub format: FormatSpec,
31+
}
32+
#[doc(hidden)]
33+
#[derive(Copy)]
34+
#[cfg(stage0)]
2635
pub struct Argument<'a> {
2736
pub position: Position,
2837
pub format: FormatSpec,

branches/auto/src/libcore/iter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub trait FromIterator<A> {
110110
#[stable]
111111
pub trait Extend<A> {
112112
/// Extend a container with the elements yielded by an arbitrary iterator
113+
#[stable]
113114
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T);
114115
}
115116

@@ -965,6 +966,7 @@ impl<I> IteratorExt for I where I: Iterator {}
965966
#[stable]
966967
pub trait DoubleEndedIterator: Iterator {
967968
/// Yield an element from the end of the range, returning `None` if the range is empty.
969+
#[stable]
968970
fn next_back(&mut self) -> Option<Self::Item>;
969971
}
970972

branches/auto/src/librustc_trans/trans/base.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,11 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
10541054
C_undef(type_of::type_of(cx.ccx(), t))
10551055
} else if ty::type_is_bool(t) {
10561056
Trunc(cx, LoadRangeAssert(cx, ptr, 0, 2, llvm::False), Type::i1(cx.ccx()))
1057+
} else if type_is_immediate(cx.ccx(), t) && type_of::type_of(cx.ccx(), t).is_aggregate() {
1058+
// We want to pass small aggregates as immediate values, but using an aggregate LLVM type
1059+
// for this leads to bad optimizations, so its arg type is an appropriately sized integer
1060+
// and we have to convert it
1061+
Load(cx, BitCast(cx, ptr, type_of::arg_type_of(cx.ccx(), t).ptr_to()))
10571062
} else if ty::type_is_char(t) {
10581063
// a char is a Unicode codepoint, and so takes values from 0
10591064
// to 0x10FFFF inclusive only.
@@ -1065,9 +1070,14 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
10651070

10661071
/// Helper for storing values in memory. Does the necessary conversion if the in-memory type
10671072
/// differs from the type used for SSA values.
1068-
pub fn store_ty(cx: Block, v: ValueRef, dst: ValueRef, t: Ty) {
1073+
pub fn store_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t: Ty<'tcx>) {
10691074
if ty::type_is_bool(t) {
10701075
Store(cx, ZExt(cx, v, Type::i8(cx.ccx())), dst);
1076+
} else if type_is_immediate(cx.ccx(), t) && type_of::type_of(cx.ccx(), t).is_aggregate() {
1077+
// We want to pass small aggregates as immediate values, but using an aggregate LLVM type
1078+
// for this leads to bad optimizations, so its arg type is an appropriately sized integer
1079+
// and we have to convert it
1080+
Store(cx, v, BitCast(cx, dst, type_of::arg_type_of(cx.ccx(), t).ptr_to()));
10711081
} else {
10721082
Store(cx, v, dst);
10731083
};

branches/auto/src/librustc_trans/trans/common.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,7 @@ fn type_is_newtype_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
222222
match ty.sty {
223223
ty::ty_struct(def_id, substs) => {
224224
let fields = ty::struct_fields(ccx.tcx(), def_id, substs);
225-
fields.len() == 1 &&
226-
fields[0].name ==
227-
token::special_idents::unnamed_field.name &&
228-
type_is_immediate(ccx, fields[0].mt.ty)
225+
fields.len() == 1 && type_is_immediate(ccx, fields[0].mt.ty)
229226
}
230227
_ => false
231228
}
@@ -247,7 +244,7 @@ pub fn type_is_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -
247244
return false;
248245
}
249246
match ty.sty {
250-
ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) |
247+
ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) | ty::ty_vec(_, Some(_)) |
251248
ty::ty_unboxed_closure(..) => {
252249
let llty = sizing_type_of(ccx, ty);
253250
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type())

branches/auto/src/librustc_trans/trans/foreign.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,13 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
736736
if ty::type_is_bool(rust_ty) {
737737
let tmp = builder.load_range_assert(llforeign_arg, 0, 2, llvm::False);
738738
builder.trunc(tmp, Type::i1(ccx))
739+
} else if type_of::type_of(ccx, rust_ty).is_aggregate() {
740+
// We want to pass small aggregates as immediate values, but using an aggregate
741+
// LLVM type for this leads to bad optimizations, so its arg type is an
742+
// appropriately sized integer and we have to convert it
743+
let tmp = builder.bitcast(llforeign_arg,
744+
type_of::arg_type_of(ccx, rust_ty).ptr_to());
745+
builder.load(tmp)
739746
} else {
740747
builder.load(llforeign_arg)
741748
}
@@ -834,10 +841,10 @@ fn foreign_signature<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
834841
fn_sig: &ty::FnSig<'tcx>,
835842
arg_tys: &[Ty<'tcx>])
836843
-> LlvmSignature {
837-
let llarg_tys = arg_tys.iter().map(|&arg| arg_type_of(ccx, arg)).collect();
844+
let llarg_tys = arg_tys.iter().map(|&arg| foreign_arg_type_of(ccx, arg)).collect();
838845
let (llret_ty, ret_def) = match fn_sig.output {
839846
ty::FnConverging(ret_ty) =>
840-
(type_of::arg_type_of(ccx, ret_ty), !return_type_is_void(ccx, ret_ty)),
847+
(type_of::foreign_arg_type_of(ccx, ret_ty), !return_type_is_void(ccx, ret_ty)),
841848
ty::FnDiverging =>
842849
(Type::nil(ccx), false)
843850
};

branches/auto/src/librustc_trans/trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn drop_ty_immediate<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
138138
-> Block<'blk, 'tcx> {
139139
let _icx = push_ctxt("drop_ty_immediate");
140140
let vp = alloca(bcx, type_of(bcx.ccx(), t), "");
141-
Store(bcx, v, vp);
141+
store_ty(bcx, v, vp, t);
142142
drop_ty(bcx, vp, t, source_location)
143143
}
144144

branches/auto/src/librustc_trans/trans/intrinsic.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
357357
&ccx.link_meta().crate_hash);
358358
// NB: This needs to be kept in lockstep with the TypeId struct in
359359
// the intrinsic module
360-
C_named_struct(llret_ty, &[C_u64(ccx, hash)])
360+
C_u64(ccx, hash)
361361
}
362362
(_, "init") => {
363363
let tp_ty = *substs.types.get(FnSpace, 0);
364-
let lltp_ty = type_of::type_of(ccx, tp_ty);
364+
let lltp_ty = type_of::arg_type_of(ccx, tp_ty);
365365
if return_type_is_void(ccx, tp_ty) {
366366
C_nil(ccx)
367367
} else {
@@ -686,6 +686,11 @@ fn with_overflow_intrinsic<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, name: &'static st
686686
let ret = C_undef(type_of::type_of(bcx.ccx(), t));
687687
let ret = InsertValue(bcx, ret, result, 0);
688688
let ret = InsertValue(bcx, ret, overflow, 1);
689-
690-
ret
689+
if type_is_immediate(bcx.ccx(), t) {
690+
let tmp = alloc_ty(bcx, t, "tmp");
691+
Store(bcx, ret, tmp);
692+
load_ty(bcx, tmp, t)
693+
} else {
694+
ret
695+
}
691696
}

branches/auto/src/librustc_trans/trans/type_.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ impl Type {
8282
ty!(llvm::LLVMInt64TypeInContext(ccx.llcx()))
8383
}
8484

85+
// Creates an integer type with the given number of bits, e.g. i24
86+
pub fn ix(ccx: &CrateContext, num_bits: u64) -> Type {
87+
ty!(llvm::LLVMIntTypeInContext(ccx.llcx(), num_bits as c_uint))
88+
}
89+
8590
pub fn f32(ccx: &CrateContext) -> Type {
8691
ty!(llvm::LLVMFloatTypeInContext(ccx.llcx()))
8792
}
@@ -260,6 +265,13 @@ impl Type {
260265
ty!(llvm::LLVMPointerType(self.to_ref(), 0))
261266
}
262267

268+
pub fn is_aggregate(&self) -> bool {
269+
match self.kind() {
270+
TypeKind::Struct | TypeKind::Array => true,
271+
_ => false
272+
}
273+
}
274+
263275
pub fn is_packed(&self) -> bool {
264276
unsafe {
265277
llvm::LLVMIsPackedStruct(self.to_ref()) == True

0 commit comments

Comments
 (0)