Skip to content

Commit 6862196

Browse files
committed
---
yaml --- r: 124895 b: refs/heads/master c: 3e62ad3 h: refs/heads/master i: 124893: 2f6b0db 124891: 65567d8 124887: 528320d 124879: d4f7dcb 124863: 8af6036 v: v3
1 parent a1c9503 commit 6862196

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b13d6ea6c2f8e6ed6ced51648aadf7a1e7256220
2+
refs/heads/master: 3e62ad3fb95b96c224e64bd83c98bc94bad5ec65
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
55
refs/heads/try: ac70b438a8382389c9c9b59c66b14774bff46e10

trunk/src/doc/guide.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,15 @@ let x = (let y = 5i); // found `let` in ident position
624624
The compiler is telling us here that it was expecting to see the beginning of
625625
an expression, and a `let` can only begin a statement, not an expression.
626626

627-
Note that assigning to an already-bound variable (e.g. `y = 5i`) is still an
628-
expression, although its value is not particularly useful. Unlike C, where an
629-
assignment evaluates to the assigned value (e.g. `5i` in the previous example),
630-
in Rust the value of an assignment is the unit type `()` (which we'll cover later).
627+
However, assigning to a variable binding is an expression:
628+
629+
```{rust}
630+
let x;
631+
let y = x = 5i;
632+
```
633+
634+
In this case, we have an assignment expression (`x = 5`) whose value is
635+
being used as part of a `let` declaration statement (`let y = ...`).
631636

632637
The second kind of statement in Rust is the **expression statement**. Its
633638
purpose is to turn any expression into a statement. In practical terms, Rust's

trunk/src/libcore/iter.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ pub trait Iterator<A> {
9999
/// Advance the iterator and return the next value. Return `None` when the end is reached.
100100
fn next(&mut self) -> Option<A>;
101101

102-
/// Returns a lower and upper bound on the remaining length of the iterator.
102+
/// Return a lower bound and upper bound on the remaining length of the iterator.
103103
///
104-
/// An upper bound of `None` means either there is no known upper bound, or the upper bound
105-
/// does not fit within a `uint`.
104+
/// The common use case for the estimate is pre-allocating space to store the results.
106105
#[inline]
107106
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
108107

@@ -645,9 +644,6 @@ pub trait Iterator<A> {
645644
}
646645

647646
/// A range iterator able to yield elements from both ends
648-
///
649-
/// A `DoubleEndedIterator` can be thought of as a deque in that `next()` and `next_back()` exhaust
650-
/// elements from the *same* range, and do not work independently of each other.
651647
pub trait DoubleEndedIterator<A>: Iterator<A> {
652648
/// Yield an element from the end of the range, returning `None` if the range is empty.
653649
fn next_back(&mut self) -> Option<A>;
@@ -694,15 +690,12 @@ impl<'a, A, T: DoubleEndedIterator<&'a mut A>> MutableDoubleEndedIterator for T
694690
/// An object implementing random access indexing by `uint`
695691
///
696692
/// A `RandomAccessIterator` should be either infinite or a `DoubleEndedIterator`.
697-
/// Calling `next()` or `next_back()` on a `RandomAccessIterator`
698-
/// reduces the indexable range accordingly. That is, `it.idx(1)` will become `it.idx(0)`
699-
/// after `it.next()` is called.
700693
pub trait RandomAccessIterator<A>: Iterator<A> {
701694
/// Return the number of indexable elements. At most `std::uint::MAX`
702695
/// elements are indexable, even if the iterator represents a longer range.
703696
fn indexable(&self) -> uint;
704697

705-
/// Return an element at an index, or `None` if the index is out of bounds
698+
/// Return an element at an index
706699
fn idx(&mut self, index: uint) -> Option<A>;
707700
}
708701

trunk/src/libcore/num/mod.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub trait Zero: Add<Self, Self> {
7575
fn zero() -> Self;
7676

7777
/// Returns `true` if `self` is equal to the additive identity.
78-
#[inline]
7978
fn is_zero(&self) -> bool;
8079
}
8180

@@ -90,20 +89,32 @@ macro_rules! zero_impl(
9089
}
9190
)
9291

92+
macro_rules! zero_float_impl(
93+
($t:ty, $v:expr) => {
94+
impl Zero for $t {
95+
#[inline]
96+
fn zero() -> $t { $v }
97+
98+
#[inline]
99+
fn is_zero(&self) -> bool { *self == $v || *self == -$v }
100+
}
101+
}
102+
)
103+
93104
zero_impl!(uint, 0u)
94-
zero_impl!(u8, 0u8)
95-
zero_impl!(u16, 0u16)
96-
zero_impl!(u32, 0u32)
97-
zero_impl!(u64, 0u64)
105+
zero_impl!(u8, 0u8)
106+
zero_impl!(u16, 0u16)
107+
zero_impl!(u32, 0u32)
108+
zero_impl!(u64, 0u64)
98109

99110
zero_impl!(int, 0i)
100111
zero_impl!(i8, 0i8)
101112
zero_impl!(i16, 0i16)
102113
zero_impl!(i32, 0i32)
103114
zero_impl!(i64, 0i64)
104115

105-
zero_impl!(f32, 0.0f32)
106-
zero_impl!(f64, 0.0f64)
116+
zero_float_impl!(f32, 0.0f32)
117+
zero_float_impl!(f64, 0.0f64)
107118

108119
/// Returns the additive identity, `0`.
109120
#[inline(always)] pub fn zero<T: Zero>() -> T { Zero::zero() }

trunk/src/librustc/driver/config.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,6 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
441441
if sess.opts.test {
442442
append_configuration(&mut user_cfg, InternedString::new("test"))
443443
}
444-
// If the user requested GC, then add the GC cfg
445-
append_configuration(&mut user_cfg, if sess.opts.gc {
446-
InternedString::new("gc")
447-
} else {
448-
InternedString::new("nogc")
449-
});
450444
user_cfg.move_iter().collect::<Vec<_>>().append(default_cfg.as_slice())
451445
}
452446

0 commit comments

Comments
 (0)