Skip to content

Commit 6f2da24

Browse files
committed
---
yaml --- r: 146407 b: refs/heads/try2 c: ff859ed h: refs/heads/master i: 146405: 3654618 146403: e794a7a 146399: c0ef563 v: v3
1 parent e95e8ff commit 6f2da24

File tree

13 files changed

+116
-105
lines changed

13 files changed

+116
-105
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 556088cfb115b5aa39050043058eb345a55e3764
8+
refs/heads/try2: ff859edb8579be4694fe490249e9800cefe50c8c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ The currently implemented features of the compiler are:
20632063

20642064
* `once_fns` - Onceness guarantees a closure is only executed once. Defining a
20652065
closure as `once` is unlikely to be supported going forward. So
2066-
they are hidden behind this feature until they are to be removed.
2066+
they are hidden behind this feature until they are to be removed.
20672067

20682068
If a feature is promoted to a language feature, then all existing programs will
20692069
start to receive compilation warnings about #[feature] directives which enabled
@@ -2748,10 +2748,11 @@ do k(3) |j| {
27482748

27492749
~~~~ {.ebnf .gram}
27502750
for_expr : "for" pat "in" expr '{' block '}' ;
2751-
~~~~
2751+
~~~~
27522752

2753-
A `for` expression is a syntactic construct for looping over elements
2754-
provided by an implementation of `std::iter::Iterator`.
2753+
A `for` expression is a syntactic construct for looping
2754+
over elements provided by an implementation of
2755+
`std::iterator::Iterator`.
27552756

27562757
An example of a for loop over the contents of a vector:
27572758

branches/try2/doc/tutorial-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ heapsort.
6969
## Iteration protocol
7070

7171
The iteration protocol is defined by the `Iterator` trait in the
72-
`std::iter` module. The minimal implementation of the trait is a `next`
72+
`std::iterator` module. The minimal implementation of the trait is a `next`
7373
method, yielding the next element from an iterator object:
7474

7575
~~~

branches/try2/doc/tutorial.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ different type from `Bar(1, 2)`), and tuple structs' _fields_ do not have
759759
names.
760760

761761
For example:
762-
763762
~~~~
764763
struct MyTup(int, int, f64);
765764
let mytup: MyTup = MyTup(10, 20, 30.0);

branches/try2/src/librustc/middle/trans/intrinsic.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,14 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
7474
}
7575
}
7676

77-
fn copy_intrinsic(bcx: @mut Block, allow_overlap: bool, tp_ty: ty::t) {
77+
fn memcpy_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) {
7878
let ccx = bcx.ccx();
7979
let lltp_ty = type_of::type_of(ccx, tp_ty);
8080
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
81-
let size = machine::llsize_of(ccx, lltp_ty);
82-
let int_size = machine::llbitsize_of_real(ccx, ccx.int_type);
83-
let name = if allow_overlap {
84-
if int_size == 32 {
85-
"llvm.memmove.p0i8.p0i8.i32"
86-
} else {
87-
"llvm.memmove.p0i8.p0i8.i64"
88-
}
89-
} else {
90-
if int_size == 32 {
91-
"llvm.memcpy.p0i8.p0i8.i32"
92-
} else {
93-
"llvm.memcpy.p0i8.p0i8.i64"
94-
}
81+
let size = match sizebits {
82+
32 => C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32),
83+
64 => C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64),
84+
_ => ccx.sess.fatal("Invalid value for sizebits")
9585
};
9686

9787
let decl = bcx.fcx.llfn;
@@ -105,15 +95,14 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
10595
RetVoid(bcx);
10696
}
10797

108-
fn memset_intrinsic(bcx: @mut Block, tp_ty: ty::t) {
98+
fn memset_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) {
10999
let ccx = bcx.ccx();
110100
let lltp_ty = type_of::type_of(ccx, tp_ty);
111101
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
112-
let size = machine::llsize_of(ccx, lltp_ty);
113-
let name = if machine::llbitsize_of_real(ccx, ccx.int_type) == 32 {
114-
"llvm.memset.p0i8.i32"
115-
} else {
116-
"llvm.memset.p0i8.i64"
102+
let size = match sizebits {
103+
32 => C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32),
104+
64 => C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64),
105+
_ => ccx.sess.fatal("Invalid value for sizebits")
117106
};
118107

119108
let decl = bcx.fcx.llfn;
@@ -410,9 +399,12 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
410399
let lladdr = InBoundsGEP(bcx, ptr, [offset]);
411400
Ret(bcx, lladdr);
412401
}
413-
"copy_nonoverlapping_memory" => copy_intrinsic(bcx, false, substs.tys[0]),
414-
"copy_memory" => copy_intrinsic(bcx, true, substs.tys[0]),
415-
"set_memory" => memset_intrinsic(bcx, substs.tys[0]),
402+
"memcpy32" => memcpy_intrinsic(bcx, "llvm.memcpy.p0i8.p0i8.i32", substs.tys[0], 32),
403+
"memcpy64" => memcpy_intrinsic(bcx, "llvm.memcpy.p0i8.p0i8.i64", substs.tys[0], 64),
404+
"memmove32" => memcpy_intrinsic(bcx, "llvm.memmove.p0i8.p0i8.i32", substs.tys[0], 32),
405+
"memmove64" => memcpy_intrinsic(bcx, "llvm.memmove.p0i8.p0i8.i64", substs.tys[0], 64),
406+
"memset32" => memset_intrinsic(bcx, "llvm.memset.p0i8.i32", substs.tys[0], 32),
407+
"memset64" => memset_intrinsic(bcx, "llvm.memset.p0i8.i64", substs.tys[0], 64),
416408
"sqrtf32" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f32", 1),
417409
"sqrtf64" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f64", 1),
418410
"powif32" => simple_llvm_intrinsic(bcx, "llvm.powi.f32", 2),

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,7 +3734,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37343734
mutbl: ast::MutImmutable
37353735
}))
37363736
}
3737-
"copy_nonoverlapping_memory" => {
3737+
"memcpy32" => {
37383738
(1,
37393739
~[
37403740
ty::mk_ptr(tcx, ty::mt {
@@ -3745,11 +3745,11 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37453745
ty: param(ccx, 0),
37463746
mutbl: ast::MutImmutable
37473747
}),
3748-
ty::mk_uint()
3748+
ty::mk_u32()
37493749
],
37503750
ty::mk_nil())
37513751
}
3752-
"copy_memory" => {
3752+
"memcpy64" => {
37533753
(1,
37543754
~[
37553755
ty::mk_ptr(tcx, ty::mt {
@@ -3760,19 +3760,61 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37603760
ty: param(ccx, 0),
37613761
mutbl: ast::MutImmutable
37623762
}),
3763-
ty::mk_uint()
3763+
ty::mk_u64()
37643764
],
37653765
ty::mk_nil())
37663766
}
3767-
"set_memory" => {
3767+
"memmove32" => {
3768+
(1,
3769+
~[
3770+
ty::mk_ptr(tcx, ty::mt {
3771+
ty: param(ccx, 0),
3772+
mutbl: ast::MutMutable
3773+
}),
3774+
ty::mk_ptr(tcx, ty::mt {
3775+
ty: param(ccx, 0),
3776+
mutbl: ast::MutImmutable
3777+
}),
3778+
ty::mk_u32()
3779+
],
3780+
ty::mk_nil())
3781+
}
3782+
"memmove64" => {
3783+
(1,
3784+
~[
3785+
ty::mk_ptr(tcx, ty::mt {
3786+
ty: param(ccx, 0),
3787+
mutbl: ast::MutMutable
3788+
}),
3789+
ty::mk_ptr(tcx, ty::mt {
3790+
ty: param(ccx, 0),
3791+
mutbl: ast::MutImmutable
3792+
}),
3793+
ty::mk_u64()
3794+
],
3795+
ty::mk_nil())
3796+
}
3797+
"memset32" => {
3798+
(1,
3799+
~[
3800+
ty::mk_ptr(tcx, ty::mt {
3801+
ty: param(ccx, 0),
3802+
mutbl: ast::MutMutable
3803+
}),
3804+
ty::mk_u8(),
3805+
ty::mk_u32()
3806+
],
3807+
ty::mk_nil())
3808+
}
3809+
"memset64" => {
37683810
(1,
37693811
~[
37703812
ty::mk_ptr(tcx, ty::mt {
37713813
ty: param(ccx, 0),
37723814
mutbl: ast::MutMutable
37733815
}),
37743816
ty::mk_u8(),
3775-
ty::mk_uint()
3817+
ty::mk_u64()
37763818
],
37773819
ty::mk_nil())
37783820
}

branches/try2/src/librustpkg/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,9 @@ impl CtxMethods for BuildContext {
699699
debug!("test: test_exec = {}", test_exec.display());
700700
// FIXME (#9639): This needs to handle non-utf8 paths
701701
let status = run::process_status(test_exec.as_str().unwrap(), [~"--test"]);
702-
os::set_exit_status(status);
702+
if status != 0 {
703+
fail!("Some tests failed");
704+
}
703705
}
704706
None => {
705707
error(format!("Internal error: test executable for package ID {} in workspace {} \

branches/try2/src/librustpkg/tests.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,20 @@ fn test_rustpkg_test_output() {
20972097
assert!(output_str.contains("1 passed; 0 failed; 0 ignored; 0 measured"));
20982098
}
20992099
2100+
#[test]
2101+
fn test_rustpkg_test_failure_exit_status() {
2102+
let foo_id = PkgId::new("foo");
2103+
let foo_workspace = create_local_package(&foo_id);
2104+
let foo_workspace = foo_workspace.path();
2105+
writeFile(&foo_workspace.join_many(["src", "foo-0.1", "test.rs"]),
2106+
"#[test] fn f() { assert!('a' != 'a'); }");
2107+
let res = command_line_test_partial([~"test", ~"foo"], foo_workspace);
2108+
match res {
2109+
Fail(_) => {},
2110+
Success(*) => fail!("Expected test failure but got success")
2111+
}
2112+
}
2113+
21002114
#[test]
21012115
fn test_rebuild_when_needed() {
21022116
let foo_id = PkgId::new("foo");
@@ -2118,6 +2132,7 @@ fn test_rebuild_when_needed() {
21182132
}
21192133
21202134
#[test]
2135+
#[ignore] // FIXME (#10257): This doesn't work as is since a read only file can't execute
21212136
fn test_no_rebuilding() {
21222137
let foo_id = PkgId::new("foo");
21232138
let foo_workspace = create_local_package(&foo_id);

branches/try2/src/libstd/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) {
330330

331331
/// External iterator for a CString's bytes.
332332
///
333-
/// Use with the `std::iter` module.
333+
/// Use with the `std::iterator` module.
334334
pub struct CStringIterator<'self> {
335335
priv ptr: *libc::c_char,
336336
priv lifetime: &'self libc::c_char, // FIXME: #5922

branches/try2/src/libstd/cast.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,26 @@
1313
use ptr::RawPtr;
1414
use mem;
1515
use unstable::intrinsics;
16-
use ptr::copy_nonoverlapping_memory;
1716

1817
/// Casts the value at `src` to U. The two types must have the same length.
18+
#[cfg(target_word_size = "32")]
1919
#[inline]
2020
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
2121
let mut dest: U = intrinsics::uninit();
2222
let dest_ptr: *mut u8 = transmute(&mut dest);
2323
let src_ptr: *u8 = transmute(src);
24-
copy_nonoverlapping_memory(dest_ptr, src_ptr, mem::size_of::<U>());
24+
intrinsics::memcpy32(dest_ptr, src_ptr, mem::size_of::<U>() as u32);
25+
dest
26+
}
27+
28+
/// Casts the value at `src` to U. The two types must have the same length.
29+
#[cfg(target_word_size = "64")]
30+
#[inline]
31+
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
32+
let mut dest: U = intrinsics::uninit();
33+
let dest_ptr: *mut u8 = transmute(&mut dest);
34+
let src_ptr: *u8 = transmute(src);
35+
intrinsics::memcpy64(dest_ptr, src_ptr, mem::size_of::<U>() as u64);
2536
dest
2637
}
2738

branches/try2/src/libstd/ptr.rs

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub fn is_not_null<T,P:RawPtr<T>>(ptr: P) -> bool { ptr.is_not_null() }
8787
* and destination may overlap.
8888
*/
8989
#[inline]
90-
#[cfg(target_word_size = "32", stage0)]
90+
#[cfg(target_word_size = "32")]
9191
pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
9292
intrinsics::memmove32(dst,
9393
cast::transmute_immut_unsafe(src),
@@ -101,33 +101,21 @@ pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
101101
* and destination may overlap.
102102
*/
103103
#[inline]
104-
#[cfg(target_word_size = "64", stage0)]
104+
#[cfg(target_word_size = "64")]
105105
pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
106106
intrinsics::memmove64(dst,
107107
cast::transmute_immut_unsafe(src),
108108
count as u64);
109109
}
110110

111-
/**
112-
* Copies data from one location to another.
113-
*
114-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
115-
* and destination may overlap.
116-
*/
117-
#[inline]
118-
#[cfg(not(stage0))]
119-
pub unsafe fn copy_memory<T,P:RawPtr<T>>(dst: *mut T, src: P, count: uint) {
120-
intrinsics::copy_memory(dst, cast::transmute_immut_unsafe(src), count)
121-
}
122-
123111
/**
124112
* Copies data from one location to another.
125113
*
126114
* Copies `count` elements (not bytes) from `src` to `dst`. The source
127115
* and destination may *not* overlap.
128116
*/
129117
#[inline]
130-
#[cfg(target_word_size = "32", stage0)]
118+
#[cfg(target_word_size = "32")]
131119
pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
132120
src: P,
133121
count: uint) {
@@ -143,7 +131,7 @@ pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
143131
* and destination may *not* overlap.
144132
*/
145133
#[inline]
146-
#[cfg(target_word_size = "64", stage0)]
134+
#[cfg(target_word_size = "64")]
147135
pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
148136
src: P,
149137
count: uint) {
@@ -152,26 +140,12 @@ pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
152140
count as u64);
153141
}
154142

155-
/**
156-
* Copies data from one location to another.
157-
*
158-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
159-
* and destination may *not* overlap.
160-
*/
161-
#[inline]
162-
#[cfg(not(stage0))]
163-
pub unsafe fn copy_nonoverlapping_memory<T,P:RawPtr<T>>(dst: *mut T,
164-
src: P,
165-
count: uint) {
166-
intrinsics::copy_nonoverlapping_memory(dst, cast::transmute_immut_unsafe(src), count)
167-
}
168-
169143
/**
170144
* Invokes memset on the specified pointer, setting `count * size_of::<T>()`
171145
* bytes of memory starting at `dst` to `c`.
172146
*/
173147
#[inline]
174-
#[cfg(target_word_size = "32", stage0)]
148+
#[cfg(target_word_size = "32")]
175149
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
176150
intrinsics::memset32(dst, c, count as u32);
177151
}
@@ -181,21 +155,11 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
181155
* bytes of memory starting at `dst` to `c`.
182156
*/
183157
#[inline]
184-
#[cfg(target_word_size = "64", stage0)]
158+
#[cfg(target_word_size = "64")]
185159
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
186160
intrinsics::memset64(dst, c, count as u64);
187161
}
188162

189-
/**
190-
* Invokes memset on the specified pointer, setting `count * size_of::<T>()`
191-
* bytes of memory starting at `dst` to `c`.
192-
*/
193-
#[inline]
194-
#[cfg(not(stage0))]
195-
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
196-
intrinsics::set_memory(dst, c, count)
197-
}
198-
199163
/**
200164
* Zeroes out `count * size_of::<T>` bytes of memory at `dst`
201165
*/

0 commit comments

Comments
 (0)