Skip to content

Commit cc9b7f3

Browse files
committed
---
yaml --- r: 233718 b: refs/heads/beta c: ef3255b h: refs/heads/master v: v3
1 parent 4e1e5e4 commit cc9b7f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1008
-790
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 35eb3e8b79c60ec18e724c7a68625d7cdf9300c0
26+
refs/heads/beta: ef3255b063a28ef1ed8346192325cfac66398739
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ valopt python "" "set path to python"
602602
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
603603
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
604604
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path (deprecated)"
605+
valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
605606
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
606607
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
607608
valopt release-channel "dev" "the name of the release channel to build"
@@ -1693,6 +1694,7 @@ putvar CFG_LIBDIR_RELATIVE
16931694
putvar CFG_DISABLE_MANAGE_SUBMODULES
16941695
putvar CFG_AARCH64_LINUX_ANDROID_NDK
16951696
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
1697+
putvar CFG_I686_LINUX_ANDROID_NDK
16961698
putvar CFG_MANDIR
16971699

16981700
# Avoid spurious warnings from clang by feeding it original source on
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# i686-linux-android configuration
2+
CC_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc
3+
CXX_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-g++
4+
CPP_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -E
5+
AR_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-ar
6+
CFG_LIB_NAME_i686-linux-android=lib$(1).so
7+
CFG_STATIC_LIB_NAME_i686-linux-android=lib$(1).a
8+
CFG_LIB_GLOB_i686-linux-android=lib$(1)-*.so
9+
CFG_LIB_DSYM_GLOB_i686-linux-android=lib$(1)-*.dylib.dSYM
10+
CFG_JEMALLOC_CFLAGS_i686-linux-android := -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
11+
CFG_GCCISH_CFLAGS_i686-linux-android := -Wall -g -fPIC -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
12+
CFG_GCCISH_CXXFLAGS_i686-linux-android := -fno-rtti $(CXXFLAGS)
13+
CFG_GCCISH_LINK_FLAGS_i686-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
14+
CFG_GCCISH_DEF_FLAG_i686-linux-android := -Wl,--export-dynamic,--dynamic-list=
15+
CFG_LLC_FLAGS_i686-linux-android :=
16+
CFG_INSTALL_NAME_i686-linux-android =
17+
CFG_EXE_SUFFIX_i686-linux-android :=
18+
CFG_WINDOWSY_i686-linux-android :=
19+
CFG_UNIXY_i686-linux-android := 1
20+
CFG_LDPATH_i686-linux-android :=
21+
CFG_RUN_i686-linux-android=
22+
CFG_RUN_TARG_i686-linux-android=
23+
RUSTC_FLAGS_i686-linux-android :=
24+
RUSTC_CROSS_FLAGS_i686-linux-android :=
25+
CFG_GNU_TRIPLE_i686-linux-android := i686-linux-android

branches/beta/src/compiletest/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(str_char)]
2020
#![feature(test)]
2121
#![feature(vec_push_all)]
22+
#![feature(path_components_peek)]
2223

2324
#![deny(warnings)]
2425

branches/beta/src/compiletest/runtest.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::fs::{self, File};
2525
use std::io::BufReader;
2626
use std::io::prelude::*;
2727
use std::net::TcpStream;
28-
use std::path::{Path, PathBuf};
28+
use std::path::{Path, PathBuf, Component};
2929
use std::process::{Command, Output, ExitStatus};
3030

3131
pub fn run(config: Config, testfile: &Path) {
@@ -952,6 +952,9 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
952952
// filename:line1:col1: line2:col2: *warning:* msg
953953
// where line1:col1: is the starting point, line2:col2:
954954
// is the ending point, and * represents ANSI color codes.
955+
//
956+
// This pattern is ambiguous on windows, because filename may contain
957+
// a colon, so any path prefix must be detected and removed first.
955958
for line in proc_res.stderr.lines() {
956959
let mut was_expected = false;
957960
let mut prev = 0;
@@ -1006,7 +1009,16 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
10061009
}
10071010
}
10081011

1009-
fn is_compiler_error_or_warning(line: &str) -> bool {
1012+
fn is_compiler_error_or_warning(mut line: &str) -> bool {
1013+
// Remove initial prefix which may contain a colon
1014+
let mut components = Path::new(line).components();
1015+
if let Some(Component::Prefix(_)) = components.peek() {
1016+
components.next();
1017+
}
1018+
1019+
// Safe as path was originally constructed from a &str ^
1020+
line = components.as_path().to_str().unwrap();
1021+
10101022
let mut i = 0;
10111023
return
10121024
scan_until_char(line, ':', &mut i) &&

branches/beta/src/doc/reference.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ fn draw_twice<T: Shape>(surface: Surface, sh: T) {
14521452
}
14531453
```
14541454

1455-
Traits also define an [trait object](#trait-objects) with the same
1455+
Traits also define a [trait object](#trait-objects) with the same
14561456
name as the trait. Values of this type are created by coercing from a
14571457
pointer of some specific type to a pointer of trait type. For example,
14581458
`&T` could be coerced to `&Shape` if `T: Shape` holds (and similarly
@@ -1881,11 +1881,15 @@ type int8_t = i8;
18811881
- `no_start` - disable linking to the `native` crate, which specifies the
18821882
"start" language item.
18831883
- `no_std` - disable linking to the `std` crate.
1884-
- `plugin` load a list of named crates as compiler plugins, e.g.
1884+
- `plugin` - load a list of named crates as compiler plugins, e.g.
18851885
`#![plugin(foo, bar)]`. Optional arguments for each plugin,
18861886
i.e. `#![plugin(foo(... args ...))]`, are provided to the plugin's
18871887
registrar function. The `plugin` feature gate is required to use
18881888
this attribute.
1889+
- `recursion_limit` - Sets the maximum depth for potentially
1890+
infinitely-recursive compile-time operations like
1891+
auto-dereference or macro expansion. The default is
1892+
`#![recursion_limit="64"]`.
18891893

18901894
### Module-only attributes
18911895

branches/beta/src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Because these kinds of situations are relatively rare, use panics sparingly.
208208

209209
In certain circumstances, even though a function may fail, we may want to treat
210210
it as a panic instead. For example, `io::stdin().read_line(&mut buffer)` returns
211-
a `Result<usize>`, when there is an error reading the line. This allows us to
212-
handle and possibly recover from error.
211+
a `Result<usize>`, which can indicate an error if one occurs when reading the line.
212+
This allows us to handle and possibly recover from errors.
213213

214214
If we don't want to handle this error, and would rather just abort the program,
215215
we can use the `unwrap()` method:

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,66 @@ fn it_works() {
219219
This is a very common use of `assert_eq!`: call some function with
220220
some known arguments and compare it to the expected output.
221221

222+
# The `ignore` attribute
223+
224+
Sometimes a few specific tests can be very time-consuming to execute. These
225+
can be disabled by default by using the `ignore` attribute:
226+
227+
```rust
228+
#[test]
229+
fn it_works() {
230+
assert_eq!(4, add_two(2));
231+
}
232+
233+
#[test]
234+
#[ignore]
235+
fn expensive_test() {
236+
// code that takes an hour to run
237+
}
238+
```
239+
240+
Now we run our tests and see that `it_works` is run, but `expensive_test` is
241+
not:
242+
243+
```bash
244+
$ cargo test
245+
Compiling adder v0.0.1 (file:///home/you/projects/adder)
246+
Running target/adder-91b3e234d4ed382a
247+
248+
running 2 tests
249+
test expensive_test ... ignored
250+
test it_works ... ok
251+
252+
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured
253+
254+
Doc-tests adder
255+
256+
running 0 tests
257+
258+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
259+
```
260+
261+
The expensive tests can be run explicitly using `cargo test -- --ignored`:
262+
263+
```bash
264+
$ cargo test -- --ignored
265+
Running target/adder-91b3e234d4ed382a
266+
267+
running 1 test
268+
test expensive_test ... ok
269+
270+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
271+
272+
Doc-tests adder
273+
274+
running 0 tests
275+
276+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
277+
```
278+
279+
The `--ignored` argument is an argument to the test binary, and not to cargo,
280+
which is why the command is `cargo test -- --ignored`.
281+
222282
# The `tests` module
223283

224284
There is one way in which our existing example is not idiomatic: it's

branches/beta/src/libcollections/string.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,7 @@ impl<'a> Extend<&'a char> for String {
813813
#[stable(feature = "rust1", since = "1.0.0")]
814814
impl<'a> Extend<&'a str> for String {
815815
fn extend<I: IntoIterator<Item=&'a str>>(&mut self, iterable: I) {
816-
let iterator = iterable.into_iter();
817-
// A guess that at least one byte per iterator element will be needed.
818-
let (lower_bound, _) = iterator.size_hint();
819-
self.reserve(lower_bound);
820-
for s in iterator {
816+
for s in iterable {
821817
self.push_str(s)
822818
}
823819
}

branches/beta/src/liblibc/lib.rs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub use types::os::arch::extra::*;
102102
pub use consts::os::c95::*;
103103
pub use consts::os::posix88::*;
104104
pub use consts::os::posix01::*;
105+
pub use consts::os::posix08::*;
105106
pub use consts::os::bsd44::*;
106107
pub use consts::os::extra::*;
107108

@@ -466,18 +467,19 @@ pub mod types {
466467
pub type off_t = i32;
467468
pub type dev_t = u32;
468469
pub type ino_t = u32;
470+
469471
pub type pid_t = i32;
470472
pub type uid_t = u32;
471473
pub type gid_t = u32;
472474
pub type useconds_t = u32;
475+
473476
pub type mode_t = u16;
474477
pub type ssize_t = i32;
475478
}
476-
#[cfg(any(target_arch = "x86",
479+
#[cfg(any(all(any(target_arch = "arm", target_arch = "x86"),
480+
not(target_os = "android")),
477481
target_arch = "le32",
478-
target_arch = "powerpc",
479-
all(any(target_arch = "arm", target_arch = "x86"),
480-
not(target_os = "android"))))]
482+
target_arch = "powerpc"))]
481483
pub mod posix01 {
482484
use types::os::arch::c95::{c_short, c_long, time_t};
483485
use types::os::arch::posix88::{dev_t, gid_t, ino_t};
@@ -523,12 +525,13 @@ pub mod types {
523525
pub __size: [u32; 9]
524526
}
525527
}
528+
526529
#[cfg(all(any(target_arch = "arm", target_arch = "x86"),
527-
target_os = "android"))]
530+
target_os = "android"))]
528531
pub mod posix01 {
529-
use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
532+
use types::os::arch::c95::{c_uchar, c_uint, c_ulong, c_long, time_t};
530533
use types::os::arch::c99::{c_longlong, c_ulonglong};
531-
use types::os::arch::posix88::{uid_t, gid_t, ino_t};
534+
use types::os::arch::posix88::{uid_t, gid_t};
532535

533536
pub type nlink_t = u16;
534537
pub type blksize_t = u32;
@@ -538,15 +541,15 @@ pub mod types {
538541
#[derive(Copy, Clone)] pub struct stat {
539542
pub st_dev: c_ulonglong,
540543
pub __pad0: [c_uchar; 4],
541-
pub __st_ino: ino_t,
544+
pub __st_ino: c_long,
542545
pub st_mode: c_uint,
543546
pub st_nlink: c_uint,
544547
pub st_uid: uid_t,
545548
pub st_gid: gid_t,
546549
pub st_rdev: c_ulonglong,
547550
pub __pad3: [c_uchar; 4],
548551
pub st_size: c_longlong,
549-
pub st_blksize: blksize_t,
552+
pub st_blksize: c_ulong,
550553
pub st_blocks: c_ulonglong,
551554
pub st_atime: time_t,
552555
pub st_atime_nsec: c_ulong,
@@ -568,6 +571,7 @@ pub mod types {
568571
pub __size: [u32; 9]
569572
}
570573
}
574+
571575
#[cfg(any(target_arch = "mips",
572576
target_arch = "mipsel"))]
573577
pub mod posix01 {
@@ -3608,6 +3612,8 @@ pub mod consts {
36083612
pub const RUSAGE_THREAD: c_int = 1;
36093613
}
36103614
pub mod posix08 {
3615+
use types::os::arch::c95::c_int;
3616+
pub const O_CLOEXEC: c_int = 0x80000;
36113617
}
36123618
#[cfg(any(target_arch = "arm",
36133619
target_arch = "aarch64",
@@ -4267,7 +4273,15 @@ pub mod consts {
42674273
pub const RUSAGE_CHILDREN: c_int = -1;
42684274
pub const RUSAGE_THREAD: c_int = 1;
42694275
}
4276+
#[cfg(target_os = "freebsd")]
42704277
pub mod posix08 {
4278+
use types::os::arch::c95::c_int;
4279+
pub const O_CLOEXEC: c_int = 0x100000;
4280+
}
4281+
#[cfg(target_os = "dragonfly")]
4282+
pub mod posix08 {
4283+
use types::os::arch::c95::c_int;
4284+
pub const O_CLOEXEC: c_int = 0x20000;
42714285
}
42724286
pub mod bsd44 {
42734287
use types::os::arch::c95::c_int;
@@ -4710,7 +4724,15 @@ pub mod consts {
47104724
pub const RUSAGE_CHILDREN: c_int = -1;
47114725
pub const RUSAGE_THREAD: c_int = 1;
47124726
}
4727+
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
47134728
pub mod posix08 {
4729+
use types::os::arch::c95::c_int;
4730+
pub const O_CLOEXEC: c_int = 0x10000;
4731+
}
4732+
#[cfg(target_os = "netbsd")]
4733+
pub mod posix08 {
4734+
use types::os::arch::c95::c_int;
4735+
pub const O_CLOEXEC: c_int = 0x400000;
47144736
}
47154737
pub mod bsd44 {
47164738
use types::os::arch::c95::c_int;
@@ -5148,6 +5170,8 @@ pub mod consts {
51485170
pub const RUSAGE_THREAD: c_int = 1;
51495171
}
51505172
pub mod posix08 {
5173+
use types::os::arch::c95::c_int;
5174+
pub const O_CLOEXEC: c_int = 0x1000000;
51515175
}
51525176
pub mod bsd44 {
51535177
use types::os::arch::c95::c_int;

branches/beta/src/librustc/diagnostics.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,14 @@ type X = u32; // ok!
731731
"##,
732732

733733
E0133: r##"
734-
Using unsafe functionality, such as dereferencing raw pointers and calling
735-
functions via FFI or marked as unsafe, is potentially dangerous and disallowed
736-
by safety checks. These safety checks can be relaxed for a section of the code
734+
Using unsafe functionality, is potentially dangerous and disallowed
735+
by safety checks. Examples:
736+
737+
- Dereferencing raw pointers
738+
- Calling functions via FFI
739+
- Calling functions marked unsafe
740+
741+
These safety checks can be relaxed for a section of the code
737742
by wrapping the unsafe instructions with an `unsafe` block. For instance:
738743
739744
```
@@ -831,9 +836,7 @@ is a size mismatch in one of the impls.
831836
It is also possible to manually transmute:
832837
833838
```
834-
let result: SomeType = mem::uninitialized();
835-
unsafe { copy_nonoverlapping(&v, &result) };
836-
result // `v` transmuted to type `SomeType`
839+
ptr::read(&v as *const _ as *const SomeType) // `v` transmuted to `SomeType`
837840
```
838841
"##,
839842

0 commit comments

Comments
 (0)