Skip to content

Commit 3508ffd

Browse files
committed
---
yaml --- r: 233811 b: refs/heads/beta c: d503524 h: refs/heads/master i: 233809: 6b6d16c 233807: aaea03f v: v3
1 parent eab9141 commit 3508ffd

File tree

47 files changed

+693
-260
lines changed

Some content is hidden

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

47 files changed

+693
-260
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: f9b63d39730740e002cc31a38a7a8a3a18d3f46d
26+
refs/heads/beta: d50352419eedf95f40dc317c7d5a7fc586189e05
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,11 @@ strings are not terminated with `\0`. If you need a NUL-terminated string for
496496
interoperability with C, you should use the `CString` type in the `std::ffi`
497497
module.
498498

499-
The standard library includes type aliases and function definitions for the C
500-
standard library in the `libc` module, and Rust links against `libc` and `libm`
501-
by default.
499+
The [`libc` crate on crates.io][libc] includes type aliases and function
500+
definitions for the C standard library in the `libc` module, and Rust links
501+
against `libc` and `libm` by default.
502+
503+
[libc]: https://crates.io/crates/libc
502504

503505
# The "nullable pointer optimization"
504506

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,26 @@ And that's reflected in the summary line:
120120
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
121121
```
122122

123-
We also get a non-zero status code:
123+
We also get a non-zero status code. We can use `$?` on OS X and Linux:
124124

125125
```bash
126126
$ echo $?
127127
101
128128
```
129129

130+
On Windows, if you’re using `cmd`:
131+
132+
```bash
133+
> echo %ERRORLEVEL%
134+
```
135+
136+
And if you’re using PowerShell:
137+
138+
```bash
139+
> echo $LASTEXITCODE # the code itself
140+
> echo $? # a boolean, fail or succeed
141+
```
142+
130143
This is useful if you want to integrate `cargo test` into other tooling.
131144

132145
We can invert our test's failure with another attribute: `should_panic`:

branches/beta/src/libcollections/fmt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ pub use core::fmt::{LowerHex, UpperHex, Pointer};
481481
pub use core::fmt::{LowerExp, UpperExp};
482482
pub use core::fmt::Error;
483483
pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt};
484+
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
484485

485486
use string;
486487

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ mod std {
113113
}
114114

115115
/// An endpoint of a range of keys.
116-
#[unstable(feature = "collections_bound", issue = "27711")]
116+
#[unstable(feature = "collections_bound", issue = "27787")]
117117
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
118118
pub enum Bound<T> {
119119
/// An inclusive bound.

branches/beta/src/libcollections/string.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,8 @@ impl String {
734734
///
735735
/// Note that this will drop any excess capacity.
736736
#[unstable(feature = "box_str",
737-
reason = "recently added, matches RFC")]
737+
reason = "recently added, matches RFC",
738+
issue = "27785")]
738739
#[deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
739740
pub fn into_boxed_slice(self) -> Box<str> {
740741
self.into_boxed_str()
@@ -768,18 +769,27 @@ impl fmt::Display for FromUtf16Error {
768769

769770
#[stable(feature = "rust1", since = "1.0.0")]
770771
impl FromIterator<char> for String {
771-
fn from_iter<I: IntoIterator<Item=char>>(iter: I) -> String {
772+
fn from_iter<I: IntoIterator<Item=char>>(iterable: I) -> String {
772773
let mut buf = String::new();
773-
buf.extend(iter);
774+
buf.extend(iterable);
774775
buf
775776
}
776777
}
777778

778779
#[stable(feature = "rust1", since = "1.0.0")]
779780
impl<'a> FromIterator<&'a str> for String {
780-
fn from_iter<I: IntoIterator<Item=&'a str>>(iter: I) -> String {
781+
fn from_iter<I: IntoIterator<Item=&'a str>>(iterable: I) -> String {
782+
let mut buf = String::new();
783+
buf.extend(iterable);
784+
buf
785+
}
786+
}
787+
788+
#[stable(feature = "extend_string", since = "1.4.0")]
789+
impl FromIterator<String> for String {
790+
fn from_iter<I: IntoIterator<Item=String>>(iterable: I) -> String {
781791
let mut buf = String::new();
782-
buf.extend(iter);
792+
buf.extend(iterable);
783793
buf
784794
}
785795
}
@@ -798,8 +808,8 @@ impl Extend<char> for String {
798808

799809
#[stable(feature = "extend_ref", since = "1.2.0")]
800810
impl<'a> Extend<&'a char> for String {
801-
fn extend<I: IntoIterator<Item=&'a char>>(&mut self, iter: I) {
802-
self.extend(iter.into_iter().cloned());
811+
fn extend<I: IntoIterator<Item=&'a char>>(&mut self, iterable: I) {
812+
self.extend(iterable.into_iter().cloned());
803813
}
804814
}
805815

@@ -812,6 +822,15 @@ impl<'a> Extend<&'a str> for String {
812822
}
813823
}
814824

825+
#[stable(feature = "extend_string", since = "1.4.0")]
826+
impl Extend<String> for String {
827+
fn extend<I: IntoIterator<Item=String>>(&mut self, iterable: I) {
828+
for s in iterable {
829+
self.push_str(&s)
830+
}
831+
}
832+
}
833+
815834
/// A convenience impl that delegates to the impl for `&str`
816835
impl<'a, 'b> Pattern<'a> for &'b String {
817836
type Searcher = <&'b str as Pattern<'a>>::Searcher;

branches/beta/src/libcore/macros.rs

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ macro_rules! writeln {
239239
/// ```
240240
#[macro_export]
241241
#[unstable(feature = "core",
242-
reason = "relationship with panic is unclear")]
242+
reason = "relationship with panic is unclear",
243+
issue = "27701")]
243244
macro_rules! unreachable {
244245
() => ({
245246
panic!("internal error: entered unreachable code")
@@ -254,9 +255,55 @@ macro_rules! unreachable {
254255

255256
/// A standardised placeholder for marking unfinished code. It panics with the
256257
/// message `"not yet implemented"` when executed.
258+
///
259+
/// This can be useful if you are prototyping and are just looking to have your
260+
/// code typecheck, or if you're implementing a trait that requires multiple
261+
/// methods, and you're only planning on using one of them.
262+
///
263+
/// # Examples
264+
///
265+
/// Here's an example of some in-progress code. We have a trait `Foo`:
266+
///
267+
/// ```
268+
/// trait Foo {
269+
/// fn bar(&self);
270+
/// fn baz(&self);
271+
/// }
272+
/// ```
273+
///
274+
/// We want to implement `Foo` on one of our types, but we also want to work on
275+
/// just `bar()` first. In order for our code to compile, we need to implement
276+
/// `baz()`, so we can use `unimplemented!`:
277+
///
278+
/// ```
279+
/// # trait Foo {
280+
/// # fn foo(&self);
281+
/// # fn bar(&self);
282+
/// # }
283+
/// struct MyStruct;
284+
///
285+
/// impl Foo for MyStruct {
286+
/// fn foo(&self) {
287+
/// // implementation goes here
288+
/// }
289+
///
290+
/// fn bar(&self) {
291+
/// // let's not worry about implementing bar() for now
292+
/// unimplemented!();
293+
/// }
294+
/// }
295+
///
296+
/// fn main() {
297+
/// let s = MyStruct;
298+
/// s.foo();
299+
///
300+
/// // we aren't even using bar() yet, so this is fine.
301+
/// }
302+
/// ```
257303
#[macro_export]
258304
#[unstable(feature = "core",
259-
reason = "relationship with panic is unclear")]
305+
reason = "relationship with panic is unclear",
306+
issue = "27701")]
260307
macro_rules! unimplemented {
261308
() => (panic!("not yet implemented"))
262309
}

branches/beta/src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub trait Sized {
4545
}
4646

4747
/// Types that can be "unsized" to a dynamically sized type.
48-
#[unstable(feature = "unsize", issue = "27779")]
48+
#[unstable(feature = "unsize", issue = "27732")]
4949
#[lang="unsize"]
5050
pub trait Unsize<T: ?Sized> {
5151
// Empty.

branches/beta/src/libcore/ops.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ pub trait Rem<RHS=Self> {
423423
fn rem(self, rhs: RHS) -> Self::Output;
424424
}
425425

426-
macro_rules! rem_impl {
426+
macro_rules! rem_impl_integer {
427427
($($t:ty)*) => ($(
428428
/// This operation satisfies `n % d == n - (n / d) * d`. The
429429
/// result has the same sign as the left operand.
@@ -439,9 +439,28 @@ macro_rules! rem_impl {
439439
)*)
440440
}
441441

442-
rem_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
442+
rem_impl_integer! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
443+
444+
#[cfg(not(stage0))]
445+
macro_rules! rem_impl_float {
446+
($($t:ty)*) => ($(
447+
#[stable(feature = "rust1", since = "1.0.0")]
448+
impl Rem for $t {
449+
type Output = $t;
450+
451+
#[inline]
452+
fn rem(self, other: $t) -> $t { self % other }
453+
}
454+
455+
forward_ref_binop! { impl Rem, rem for $t, $t }
456+
)*)
457+
}
458+
459+
#[cfg(not(stage0))]
460+
rem_impl_float! { f32 f64 }
443461

444462
#[stable(feature = "rust1", since = "1.0.0")]
463+
#[cfg(stage0)]
445464
impl Rem for f32 {
446465
type Output = f32;
447466

@@ -463,6 +482,7 @@ impl Rem for f32 {
463482
}
464483

465484
#[stable(feature = "rust1", since = "1.0.0")]
485+
#[cfg(stage0)]
466486
impl Rem for f64 {
467487
type Output = f64;
468488

@@ -473,7 +493,9 @@ impl Rem for f64 {
473493
}
474494
}
475495

496+
#[cfg(stage0)]
476497
forward_ref_binop! { impl Rem, rem for f64, f64 }
498+
#[cfg(stage0)]
477499
forward_ref_binop! { impl Rem, rem for f32, f32 }
478500

479501
/// The `Neg` trait is used to specify the functionality of unary `-`.

branches/beta/src/libcore/option.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,26 @@ impl<T> IntoIterator for Option<T> {
779779
}
780780
}
781781

782+
#[stable(since = "1.4.0", feature = "option_iter")]
783+
impl<'a, T> IntoIterator for &'a Option<T> {
784+
type Item = &'a T;
785+
type IntoIter = Iter<'a, T>;
786+
787+
fn into_iter(self) -> Iter<'a, T> {
788+
self.iter()
789+
}
790+
}
791+
792+
#[stable(since = "1.4.0", feature = "option_iter")]
793+
impl<'a, T> IntoIterator for &'a mut Option<T> {
794+
type Item = &'a mut T;
795+
type IntoIter = IterMut<'a, T>;
796+
797+
fn into_iter(mut self) -> IterMut<'a, T> {
798+
self.iter_mut()
799+
}
800+
}
801+
782802
/////////////////////////////////////////////////////////////////////////////
783803
// The Option Iterators
784804
/////////////////////////////////////////////////////////////////////////////

branches/beta/src/libcore/result.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,26 @@ impl<T, E> IntoIterator for Result<T, E> {
815815
}
816816
}
817817

818+
#[stable(since = "1.4.0", feature = "result_iter")]
819+
impl<'a, T, E> IntoIterator for &'a Result<T, E> {
820+
type Item = &'a T;
821+
type IntoIter = Iter<'a, T>;
822+
823+
fn into_iter(self) -> Iter<'a, T> {
824+
self.iter()
825+
}
826+
}
827+
828+
#[stable(since = "1.4.0", feature = "result_iter")]
829+
impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
830+
type Item = &'a mut T;
831+
type IntoIter = IterMut<'a, T>;
832+
833+
fn into_iter(mut self) -> IterMut<'a, T> {
834+
self.iter_mut()
835+
}
836+
}
837+
818838
/////////////////////////////////////////////////////////////////////////////
819839
// The Result Iterators
820840
/////////////////////////////////////////////////////////////////////////////

branches/beta/src/libcore/str/mod.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
292292
}
293293
}
294294

295+
impl<'a> Chars<'a> {
296+
/// View the underlying data as a subslice of the original data.
297+
///
298+
/// This has the same lifetime as the original slice, and so the
299+
/// iterator can continue to be used while this exists.
300+
#[unstable(feature = "iter_to_slice", issue = "27775")]
301+
#[inline]
302+
pub fn as_str(&self) -> &'a str {
303+
unsafe { from_utf8_unchecked(self.iter.as_slice()) }
304+
}
305+
}
306+
295307
/// Iterator for a string's characters and their byte offsets.
296308
#[derive(Clone)]
297309
#[stable(feature = "rust1", since = "1.0.0")]
@@ -339,6 +351,18 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
339351
}
340352
}
341353

354+
impl<'a> CharIndices<'a> {
355+
/// View the underlying data as a subslice of the original data.
356+
///
357+
/// This has the same lifetime as the original slice, and so the
358+
/// iterator can continue to be used while this exists.
359+
#[unstable(feature = "iter_to_slice", issue = "27775")]
360+
#[inline]
361+
pub fn as_str(&self) -> &'a str {
362+
self.iter.as_str()
363+
}
364+
}
365+
342366
/// External iterator for a string's bytes.
343367
/// Use with the `std::iter` module.
344368
///

0 commit comments

Comments
 (0)