Skip to content

Commit 0e0c761

Browse files
committed
---
yaml --- r: 233693 b: refs/heads/beta c: 28ef44a h: refs/heads/master i: 233691: 8ad6a66 v: v3
1 parent 363cea4 commit 0e0c761

File tree

216 files changed

+4486
-3110
lines changed

Some content is hidden

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

216 files changed

+4486
-3110
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: 19dc4d0a306852a132b8be3614c6cb49658f0c57
26+
refs/heads/beta: 28ef44a9e6110d7e59aca590ce7cf16d6d601d54
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,16 @@ 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"
608609
valopt musl-root "/usr/local" "MUSL root installation directory"
609610

611+
# Used on systems where "cc" and "ar" are unavailable
612+
valopt default-linker "cc" "the default linker"
613+
valopt default-ar "ar" "the default ar"
614+
610615
# Many of these are saved below during the "writing configuration" step
611616
# (others are conditionally saved).
612617
opt_nosave manage-submodules 1 "let the build manage the git submodules"
@@ -1689,6 +1694,7 @@ putvar CFG_LIBDIR_RELATIVE
16891694
putvar CFG_DISABLE_MANAGE_SUBMODULES
16901695
putvar CFG_AARCH64_LINUX_ANDROID_NDK
16911696
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
1697+
putvar CFG_I686_LINUX_ANDROID_NDK
16921698
putvar CFG_MANDIR
16931699

16941700
# 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/mk/target.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# this exists can be found on issue #2400
1414
export CFG_COMPILER_HOST_TRIPLE
1515

16+
# Used as defaults for the runtime ar and cc tools
17+
export CFG_DEFAULT_LINKER
18+
export CFG_DEFAULT_AR
19+
1620
# The standard libraries should be held up to a higher standard than any old
1721
# code, make sure that these common warnings are denied by default. These can
1822
# be overridden during development temporarily. For stage0, we allow warnings

branches/beta/src/doc/nomicon/coercions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Coercion is allowed between the following types:
2222
for all pointer types (including smart pointers like Box and Rc). Unsize is
2323
only implemented automatically, and enables the following transformations:
2424

25-
* `[T, ..n]` => `[T]`
25+
* `[T; n]` => `[T]`
2626
* `T` => `Trait` where `T: Trait`
2727
* `Foo<..., T, ...>` => `Foo<..., U, ...>` where:
2828
* `T: Unsize<U>`

branches/beta/src/doc/nomicon/safe-unsafe-meaning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ unsafe impl UnsafeOrd for MyType {
125125
But it's probably not the implementation you want.
126126

127127
Rust has traditionally avoided making traits unsafe because it makes Unsafe
128-
pervasive, which is not desirable. Send and Sync are unsafe is because thread
128+
pervasive, which is not desirable. The reason Send and Sync are unsafe is because thread
129129
safety is a *fundamental property* that unsafe code cannot possibly hope to defend
130130
against in the same way it would defend against a bad Ord implementation. The
131131
only way to possibly defend against thread-unsafety would be to *not use

branches/beta/src/doc/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,6 +2073,7 @@ The following configurations must be defined by the implementation:
20732073
* `target_pointer_width = "..."`. Target pointer width in bits. This is set
20742074
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
20752075
64-bit pointers.
2076+
* `test`. Enabled when compiling the test harness (using the `--test` flag).
20762077
* `unix`. See `target_family`.
20772078
* `windows`. See `target_family`.
20782079

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,14 @@ threads as a simple isolation mechanism:
343343
```rust
344344
use std::thread;
345345

346-
let result = thread::spawn(move || {
346+
let handle = thread::spawn(move || {
347347
panic!("oops!");
348-
}).join();
348+
});
349+
350+
let result = handle.join();
349351

350352
assert!(result.is_err());
351353
```
352354

353-
Our `Thread` gives us a `Result` back, which allows us to check if the thread
355+
`Thread.join()` gives us a `Result` back, which allows us to check if the thread
354356
has panicked or not.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ hello.rs:4 }
7373
```
7474

7575
This [unfortunate error](https://github.com/rust-lang/rust/issues/22547) is
76-
correct: documentation comments apply to the thing after them, and there's no
77-
thing after that last comment.
76+
correct: documentation comments apply to the thing after them, and there's
77+
nothing after that last comment.
7878

7979
[rc-new]: https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new
8080

@@ -196,10 +196,10 @@ This will highlight according to whatever language you're showing off.
196196
If you're just showing plain text, choose `text`.
197197

198198
It's important to choose the correct annotation here, because `rustdoc` uses it
199-
in an interesting way: It can be used to actually test your examples, so that
200-
they don't get out of date. If you have some C code but `rustdoc` thinks it's
201-
Rust because you left off the annotation, `rustdoc` will complain when trying to
202-
generate the documentation.
199+
in an interesting way: It can be used to actually test your examples in a
200+
library crate, so that they don't get out of date. If you have some C code but
201+
`rustdoc` thinks it's Rust because you left off the annotation, `rustdoc` will
202+
complain when trying to generate the documentation.
203203

204204
## Documentation as tests
205205

@@ -377,8 +377,8 @@ $ rustdoc --test path/to/my/crate/root.rs
377377
$ cargo test
378378
```
379379

380-
That's right, `cargo test` tests embedded documentation too. However,
381-
`cargo test` will not test binary crates, only library ones. This is
380+
That's right, `cargo test` tests embedded documentation too. **However,
381+
`cargo test` will not test binary crates, only library ones.** This is
382382
due to the way `rustdoc` works: it links against the library to be tested,
383383
but with a binary, there’s nothing to link to.
384384

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ let z = (8, 2, 6);
3838

3939
In the example above `x` and `y` have arity 2. `z` has arity 3.
4040

41+
### DST (Dynamically Sized Type)
42+
43+
A type without a statically known size or alignment. ([more info][link])
44+
45+
[link]: ../nomicon/exotic-sizes.html#dynamically-sized-types-(dsts)
46+
4147
### Expression
4248

4349
In computer programming, an expression is a combination of values, constants,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ Let's finally check out that third section: documentation tests.
355355
Nothing is better than documentation with examples. Nothing is worse than
356356
examples that don't actually work, because the code has changed since the
357357
documentation has been written. To this end, Rust supports automatically
358-
running examples in your documentation. Here's a fleshed-out `src/lib.rs`
359-
with examples:
358+
running examples in your documentation (**note:** this only works in library
359+
crates, not binary crates). Here's a fleshed-out `src/lib.rs` with examples:
360360

361361
```rust,ignore
362362
//! The `adder` crate provides functions that add numbers to other numbers.

branches/beta/src/liballoc/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
7272
use boxed::Box;
7373

74-
use core::atomic;
75-
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
74+
use core::sync::atomic;
75+
use core::sync::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
7676
use core::fmt;
7777
use core::cmp::Ordering;
7878
use core::mem::{align_of_val, size_of_val};

branches/beta/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
7070
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
7171
html_root_url = "https://doc.rust-lang.org/nightly/",
72+
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
7273
test(no_crate_inject))]
7374
#![no_std]
7475
#![cfg_attr(not(stage0), needs_allocator)]

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2727
html_root_url = "https://doc.rust-lang.org/nightly/",
2828
html_playground_url = "https://play.rust-lang.org/",
29+
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
2930
test(no_crate_inject))]
3031

3132
#![allow(trivial_casts)]

branches/beta/src/libcore/intrinsics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ extern "rust-intrinsic" {
247247
/// ```
248248
/// use std::mem;
249249
///
250-
/// let v: &[u8] = unsafe { mem::transmute("L") };
251-
/// assert!(v == [76]);
250+
/// let array: &[u8] = unsafe { mem::transmute("Rust") };
251+
/// assert_eq!(array, [82, 117, 115, 116]);
252252
/// ```
253253
#[stable(feature = "rust1", since = "1.0.0")]
254-
pub fn transmute<T,U>(e: T) -> U;
254+
pub fn transmute<T, U>(e: T) -> U;
255255

256256
/// Gives the address for the return value of the enclosing function.
257257
///

branches/beta/src/libcore/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
5959
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
6060
html_root_url = "https://doc.rust-lang.org/nightly/",
61-
html_playground_url = "https://play.rust-lang.org/")]
61+
html_playground_url = "https://play.rust-lang.org/",
62+
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
6263
#![doc(test(no_crate_inject))]
6364

6465
#![no_core]
@@ -143,7 +144,7 @@ pub mod convert;
143144

144145
pub mod any;
145146
pub mod array;
146-
pub mod atomic;
147+
pub mod sync;
147148
pub mod cell;
148149
pub mod char;
149150
pub mod panicking;

branches/beta/src/libcore/num/dec2flt/mod.rs

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@
9696
issue = "0")]
9797

9898
use prelude::v1::*;
99-
use num::ParseFloatError as PFE;
100-
use num::FloatErrorKind;
99+
use fmt;
100+
use str::FromStr;
101+
101102
use self::parse::{parse_decimal, Decimal, Sign};
102103
use self::parse::ParseResult::{self, Valid, ShortcutToInf, ShortcutToZero};
103104
use self::num::digits_to_big;
@@ -110,14 +111,87 @@ mod num;
110111
pub mod rawfp;
111112
pub mod parse;
112113

113-
/// Entry point for decimal-to-f32 conversion.
114-
pub fn to_f32(s: &str) -> Result<f32, PFE> {
115-
dec2flt(s)
114+
macro_rules! from_str_float_impl {
115+
($t:ty, $func:ident) => {
116+
#[stable(feature = "rust1", since = "1.0.0")]
117+
impl FromStr for $t {
118+
type Err = ParseFloatError;
119+
120+
/// Converts a string in base 10 to a float.
121+
/// Accepts an optional decimal exponent.
122+
///
123+
/// This function accepts strings such as
124+
///
125+
/// * '3.14'
126+
/// * '-3.14'
127+
/// * '2.5E10', or equivalently, '2.5e10'
128+
/// * '2.5E-10'
129+
/// * '.' (understood as 0)
130+
/// * '5.'
131+
/// * '.5', or, equivalently, '0.5'
132+
/// * 'inf', '-inf', 'NaN'
133+
///
134+
/// Leading and trailing whitespace represent an error.
135+
///
136+
/// # Arguments
137+
///
138+
/// * src - A string
139+
///
140+
/// # Return value
141+
///
142+
/// `Err(ParseFloatError)` if the string did not represent a valid
143+
/// number. Otherwise, `Ok(n)` where `n` is the floating-point
144+
/// number represented by `src`.
145+
#[inline]
146+
fn from_str(src: &str) -> Result<Self, ParseFloatError> {
147+
dec2flt(src)
148+
}
149+
}
150+
}
151+
}
152+
from_str_float_impl!(f32, to_f32);
153+
from_str_float_impl!(f64, to_f64);
154+
155+
/// An error which can be returned when parsing a float.
156+
#[derive(Debug, Clone, PartialEq)]
157+
#[stable(feature = "rust1", since = "1.0.0")]
158+
pub struct ParseFloatError {
159+
kind: FloatErrorKind
160+
}
161+
162+
#[derive(Debug, Clone, PartialEq)]
163+
enum FloatErrorKind {
164+
Empty,
165+
Invalid,
166+
}
167+
168+
impl ParseFloatError {
169+
#[unstable(feature = "int_error_internals",
170+
reason = "available through Error trait and this method should \
171+
not be exposed publicly",
172+
issue = "0")]
173+
#[doc(hidden)]
174+
pub fn __description(&self) -> &str {
175+
match self.kind {
176+
FloatErrorKind::Empty => "cannot parse float from empty string",
177+
FloatErrorKind::Invalid => "invalid float literal",
178+
}
179+
}
180+
}
181+
182+
#[stable(feature = "rust1", since = "1.0.0")]
183+
impl fmt::Display for ParseFloatError {
184+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
185+
self.__description().fmt(f)
186+
}
187+
}
188+
189+
pub fn pfe_empty() -> ParseFloatError {
190+
ParseFloatError { kind: FloatErrorKind::Empty }
116191
}
117192

118-
/// Entry point for decimal-to-f64 conversion.
119-
pub fn to_f64(s: &str) -> Result<f64, PFE> {
120-
dec2flt(s)
193+
pub fn pfe_invalid() -> ParseFloatError {
194+
ParseFloatError { kind: FloatErrorKind::Invalid }
121195
}
122196

123197
/// Split decimal string into sign and the rest, without inspecting or validating the rest.
@@ -131,9 +205,9 @@ fn extract_sign(s: &str) -> (Sign, &str) {
131205
}
132206

133207
/// Convert a decimal string into a floating point number.
134-
fn dec2flt<T: RawFloat>(s: &str) -> Result<T, PFE> {
208+
fn dec2flt<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> {
135209
if s.is_empty() {
136-
return Err(PFE { __kind: FloatErrorKind::Empty });
210+
return Err(pfe_empty())
137211
}
138212
let (sign, s) = extract_sign(s);
139213
let flt = match parse_decimal(s) {
@@ -143,7 +217,7 @@ fn dec2flt<T: RawFloat>(s: &str) -> Result<T, PFE> {
143217
ParseResult::Invalid => match s {
144218
"inf" => T::infinity(),
145219
"NaN" => T::nan(),
146-
_ => { return Err(PFE { __kind: FloatErrorKind::Invalid }); }
220+
_ => { return Err(pfe_invalid()); }
147221
}
148222
};
149223

@@ -155,7 +229,7 @@ fn dec2flt<T: RawFloat>(s: &str) -> Result<T, PFE> {
155229

156230
/// The main workhorse for the decimal-to-float conversion: Orchestrate all the preprocessing
157231
/// and figure out which algorithm should do the actual conversion.
158-
fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, PFE> {
232+
fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, ParseFloatError> {
159233
simplify(&mut decimal);
160234
if let Some(x) = trivial_cases(&decimal) {
161235
return Ok(x);
@@ -172,7 +246,7 @@ fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, PFE> {
172246
// If we exceed this, perhaps while calculating `f * 10^e` in Algorithm R or Algorithm M,
173247
// we'll crash. So we error out before getting too close, with a generous safety margin.
174248
if max_digits > 375 {
175-
return Err(PFE { __kind: FloatErrorKind::Invalid });
249+
return Err(pfe_invalid());
176250
}
177251
let f = digits_to_big(decimal.integral, decimal.fractional);
178252

0 commit comments

Comments
 (0)