Skip to content

Commit aac9f6e

Browse files
committed
---
yaml --- r: 210197 b: refs/heads/try c: a23d7e1 h: refs/heads/master i: 210195: c83c809 v: v3
1 parent b6743d4 commit aac9f6e

Some content is hidden

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

64 files changed

+410
-585
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 613109db1b7ee95cc55d2e9710c1d54836504271
5+
refs/heads/try: a23d7e10c7187ba2b0f2069a9905994592fa1108
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/reference.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,8 @@ warnings are generated, or otherwise "you used a private item of another module
15571557
and weren't allowed to."
15581558

15591559
By default, everything in Rust is *private*, with one exception. Enum variants
1560-
in a `pub` enum are also public by default. When an item is declared as `pub`,
1560+
in a `pub` enum are also public by default. You are allowed to alter this
1561+
default visibility with the `priv` keyword. When an item is declared as `pub`,
15611562
it can be thought of as being accessible to the outside world. For example:
15621563

15631564
```
@@ -2425,18 +2426,11 @@ Tuples are written by enclosing zero or more comma-separated expressions in
24252426
parentheses. They are used to create [tuple-typed](#tuple-types) values.
24262427

24272428
```{.tuple}
2429+
(0,);
24282430
(0.0, 4.5);
24292431
("a", 4usize, true);
24302432
```
24312433

2432-
You can disambiguate a single-element tuple from a value in parentheses with a
2433-
comma:
2434-
2435-
```
2436-
(0,); // single-element tuple
2437-
(0); // zero in parentheses
2438-
```
2439-
24402434
### Unit expressions
24412435

24422436
The expression `()` denotes the _unit value_, the only value of the type with

branches/try/src/doc/trpl/attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ Rust attributes are used for a number of different things. There is a full list
6767
of attributes [in the reference][reference]. Currently, you are not allowed to
6868
create your own attributes, the Rust compiler defines them.
6969

70-
[reference]: ../reference.html#attributes
70+
[reference]: reference.html#attributes

branches/try/src/doc/trpl/const-and-static.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ this reason.
1919
# `static`
2020

2121
Rust provides a ‘global variable’ sort of facility in static items. They’re
22-
similar to constants, but static items aren’t inlined upon use. This means that
23-
there is only one instance for each value, and it’s at a fixed location in
24-
memory.
22+
similar to [constants][const], but static items aren’t inlined upon use. This
23+
means that there is only one instance for each value, and it’s at a fixed
24+
location in memory.
2525

2626
Here’s an example:
2727

2828
```rust
2929
static N: i32 = 5;
3030
```
3131

32+
[const]: const.html
33+
3234
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3335

3436
[let]: variable-bindings.html

branches/try/src/doc/trpl/iterators.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,26 @@ Ranges are one of two basic iterators that you'll see. The other is `iter()`.
235235
in turn:
236236

237237
```rust
238-
let nums = vec![1, 2, 3];
238+
let nums = [1, 2, 3];
239239

240240
for num in nums.iter() {
241241
println!("{}", num);
242242
}
243243
```
244244

245245
These two basic iterators should serve you well. There are some more
246-
advanced iterators, including ones that are infinite.
246+
advanced iterators, including ones that are infinite. Like using range syntax
247+
and `step_by`:
248+
249+
```rust
250+
# #![feature(step_by)]
251+
(1..).step_by(5);
252+
```
253+
254+
This iterator counts up from one, adding five each time. It will give
255+
you a new integer every time, forever (well, technically, until it reaches the
256+
maximum number representable by an `i32`). But since iterators are lazy,
257+
that's okay! You probably don't want to use `collect()` on it, though...
247258

248259
That's enough about iterators. Iterator adapters are the last concept
249260
we need to talk about with regards to iterators. Let's get to it!

branches/try/src/doc/trpl/nightly-rust.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ If not, there are a number of places where you can get help. The easiest is
9393
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9494
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9595
(a silly nickname we call ourselves), and we can help you out. Other great
96-
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
96+
resources include [the user’s forum][users], and [Stack Overflow][stack
97+
overflow].
9798

9899
[irc]: irc://irc.mozilla.org/#rust
99100
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust

branches/try/src/doc/trpl/primitive-types.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,6 @@ or “breaks up” the tuple, and assigns the bits to three bindings.
248248

249249
This pattern is very powerful, and we’ll see it repeated more later.
250250

251-
You can disambiguate a single-element tuple from a value in parentheses with a
252-
comma:
253-
254-
```
255-
(0,); // single-element tuple
256-
(0); // zero in parentheses
257-
```
258-
259251
## Tuple Indexing
260252

261253
You can also access fields of a tuple with indexing syntax:

branches/try/src/doc/trpl/raw-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to
8080
C’s `const T*` and `T*`, respectfully. For more about this use, consult the
8181
[FFI chapter][ffi].
8282

83-
[ffi]: ffi.html
83+
[ffi]: ffi.md
8484

8585
# References and raw pointers
8686

branches/try/src/doc/trpl/unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Rust has a feature called ‘`static mut`’ which allows for mutable global sta
101101
Doing so can cause a data race, and as such is inherently not safe. For more
102102
details, see the [static][static] section of the book.
103103

104-
[static]: const-and-static.html#static
104+
[static]: static.html
105105

106106
## Dereference a raw pointer
107107

branches/try/src/doc/trpl/unsized-types.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ impl Foo for &str {
3838
```
3939

4040
Meaning, this implementation would only work for [references][ref], and not
41-
other types of pointers. With the `impl for str`, all pointers, including (at
42-
some point, there are some bugs to fix first) user-defined custom smart
43-
pointers, can use this `impl`.
44-
45-
[ref]: references-and-borrowing.html
41+
other types of pointers. With this `impl`, all pointers, including (at some
42+
point, there are some bugs to fix first) user-defined custom smart pointers,
43+
can use this `impl`.
4644

4745
# ?Sized
4846

branches/try/src/libcollections/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
//! longer than this width, then it is truncated down to this many characters and only those are
399399
//! emitted.
400400
//!
401-
//! For integral types, this is ignored.
401+
//! For integral types, this has no meaning currently.
402402
//!
403403
//! For floating-point types, this indicates how many digits after the decimal point should be
404404
//! printed.

branches/try/src/libcore/intrinsics.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ extern "rust-intrinsic" {
267267
/// `Copy`, then may return `true` or `false`.
268268
pub fn needs_drop<T>() -> bool;
269269

270-
/// Returns `true` if a type is managed (will be allocated on the local heap)
271-
pub fn owns_managed<T>() -> bool;
272-
273270
/// Calculates the offset from a pointer.
274271
///
275272
/// This is implemented as an intrinsic to avoid converting to and from an

branches/try/src/libcore/iter.rs

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,10 +2402,14 @@ pub trait Step: PartialOrd {
24022402
/// Steps `self` if possible.
24032403
fn step(&self, by: &Self) -> Option<Self>;
24042404

2405-
/// Returns the number of steps between two step objects. The count is
2406-
/// inclusive of `start` and exclusive of `end`.
2405+
/// Returns the number of steps between two step objects.
24072406
///
2408-
/// Returns `None` if it is not possible to calculate `steps_between`
2407+
/// `start` should always be less than `end`, so the result should never
2408+
/// be negative.
2409+
///
2410+
/// `by` must be > 0.
2411+
///
2412+
/// Returns `None` if it is not possible to calculate steps_between
24092413
/// without overflow.
24102414
fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>;
24112415
}
@@ -2420,16 +2424,9 @@ macro_rules! step_impl_unsigned {
24202424
#[inline]
24212425
#[allow(trivial_numeric_casts)]
24222426
fn steps_between(start: &$t, end: &$t, by: &$t) -> Option<usize> {
2423-
if *by == 0 { return None; }
2424-
if *start < *end {
2427+
if *start <= *end {
24252428
// Note: We assume $t <= usize here
2426-
let diff = (*end - *start) as usize;
2427-
let by = *by as usize;
2428-
if diff % by > 0 {
2429-
Some(diff / by + 1)
2430-
} else {
2431-
Some(diff / by)
2432-
}
2429+
Some((*end - *start) as usize / (*by as usize))
24332430
} else {
24342431
Some(0)
24352432
}
@@ -2447,29 +2444,16 @@ macro_rules! step_impl_signed {
24472444
#[inline]
24482445
#[allow(trivial_numeric_casts)]
24492446
fn steps_between(start: &$t, end: &$t, by: &$t) -> Option<usize> {
2450-
if *by == 0 { return None; }
2451-
let mut diff: usize;
2452-
let mut by_u: usize;
2453-
if *by > 0 {
2454-
if *start >= *end {
2455-
return Some(0);
2456-
}
2447+
if *start <= *end {
24572448
// Note: We assume $t <= isize here
24582449
// Use .wrapping_sub and cast to usize to compute the
24592450
// difference that may not fit inside the range of isize.
2460-
diff = (*end as isize).wrapping_sub(*start as isize) as usize;
2461-
by_u = *by as usize;
2462-
} else {
2463-
if *start <= *end {
2464-
return Some(0);
2465-
}
2466-
diff = (*start as isize).wrapping_sub(*end as isize) as usize;
2467-
by_u = (*by as isize).wrapping_mul(-1) as usize;
2468-
}
2469-
if diff % by_u > 0 {
2470-
Some(diff / by_u + 1)
2451+
Some(
2452+
((*end as isize).wrapping_sub(*start as isize) as usize
2453+
/ (*by as usize))
2454+
)
24712455
} else {
2472-
Some(diff / by_u)
2456+
Some(0)
24732457
}
24742458
}
24752459
}
@@ -2691,16 +2675,6 @@ impl<A: Step + Zero + Clone> Iterator for StepBy<A, ops::Range<A>> {
26912675
None
26922676
}
26932677
}
2694-
2695-
#[inline]
2696-
fn size_hint(&self) -> (usize, Option<usize>) {
2697-
match Step::steps_between(&self.range.start,
2698-
&self.range.end,
2699-
&self.step_by) {
2700-
Some(hint) => (hint, Some(hint)),
2701-
None => (0, None)
2702-
}
2703-
}
27042678
}
27052679

27062680
macro_rules! range_exact_iter_impl {

branches/try/src/libcore/marker.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ unsafe impl Send for .. { }
4343

4444
impl<T> !Send for *const T { }
4545
impl<T> !Send for *mut T { }
46-
impl !Send for Managed { }
4746

4847
/// Types with a constant size known at compile-time.
4948
#[stable(feature = "rust1", since = "1.0.0")]
@@ -212,7 +211,6 @@ unsafe impl Sync for .. { }
212211

213212
impl<T> !Sync for *const T { }
214213
impl<T> !Sync for *mut T { }
215-
impl !Sync for Managed { }
216214

217215
/// A type which is considered "not POD", meaning that it is not
218216
/// implicitly copyable. This is typically embedded in other types to
@@ -223,14 +221,6 @@ impl !Sync for Managed { }
223221
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
224222
pub struct NoCopy;
225223

226-
/// A type which is considered managed by the GC. This is typically
227-
/// embedded in other types.
228-
#[unstable(feature = "core",
229-
reason = "likely to change with new variance strategy")]
230-
#[lang="managed_bound"]
231-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
232-
pub struct Managed;
233-
234224
macro_rules! impls{
235225
($t: ident) => (
236226
impl<T:?Sized> Hash for $t<T> {

branches/try/src/libcore/num/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,12 @@ macro_rules! int_impl {
113113
$mul_with_overflow:path) => {
114114
/// Returns the smallest value that can be represented by this integer type.
115115
#[stable(feature = "rust1", since = "1.0.0")]
116-
#[inline]
117116
pub fn min_value() -> $T {
118117
(-1 as $T) << ($BITS - 1)
119118
}
120119

121120
/// Returns the largest value that can be represented by this integer type.
122121
#[stable(feature = "rust1", since = "1.0.0")]
123-
#[inline]
124122
pub fn max_value() -> $T {
125123
let min = $T::min_value(); !min
126124
}

branches/try/src/libcoretest/iter.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use core::iter::*;
1212
use core::iter::order::*;
1313
use core::iter::MinMaxResult::*;
14-
use core::{i8, i16, isize};
14+
use core::isize;
1515
use core::usize;
1616
use core::cmp;
1717

@@ -786,18 +786,6 @@ fn test_range_step() {
786786
assert_eq!((200..255).step_by(50).collect::<Vec<u8>>(), [200, 250]);
787787
assert_eq!((200..-5).step_by(1).collect::<Vec<isize>>(), []);
788788
assert_eq!((200..200).step_by(1).collect::<Vec<isize>>(), []);
789-
790-
assert_eq!((0..20).step_by(1).size_hint(), (20, Some(20)));
791-
assert_eq!((0..20).step_by(21).size_hint(), (1, Some(1)));
792-
assert_eq!((0..20).step_by(5).size_hint(), (4, Some(4)));
793-
assert_eq!((20..0).step_by(-5).size_hint(), (4, Some(4)));
794-
assert_eq!((20..0).step_by(-6).size_hint(), (4, Some(4)));
795-
assert_eq!((20..-5).step_by(1).size_hint(), (0, Some(0)));
796-
assert_eq!((20..20).step_by(1).size_hint(), (0, Some(0)));
797-
assert_eq!((0..1).step_by(0).size_hint(), (0, None));
798-
assert_eq!((i8::MAX..i8::MIN).step_by(i8::MIN).size_hint(), (2, Some(2)));
799-
assert_eq!((i16::MIN..i16::MAX).step_by(i16::MAX).size_hint(), (3, Some(3)));
800-
assert_eq!((isize::MIN..isize::MAX).step_by(1).size_hint(), (usize::MAX, Some(usize::MAX)));
801789
}
802790

803791
#[test]

branches/try/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub fn get_impl_polarity<'tcx>(tcx: &ty::ctxt<'tcx>,
283283
// if there is one.
284284
pub fn get_impl_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
285285
def: ast::DefId)
286-
-> Option<ty::TraitRef<'tcx>> {
286+
-> Option<Rc<ty::TraitRef<'tcx>>> {
287287
let cstore = &tcx.sess.cstore;
288288
let cdata = cstore.get_crate_data(def.krate);
289289
decoder::get_impl_trait(&*cdata, def.node, tcx)

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ use middle::subst;
3030
use middle::ty::{ImplContainer, TraitContainer};
3131
use middle::ty::{self, Ty};
3232
use middle::astencode::vtable_decoder_helpers;
33-
use util::nodemap::FnvHashMap;
3433

35-
use std::cell::{Cell, RefCell};
3634
use std::collections::HashMap;
3735
use std::hash::{self, Hash, SipHasher};
3836
use std::io::prelude::*;
@@ -249,13 +247,13 @@ pub fn item_type<'tcx>(_item_id: ast::DefId, item: rbml::Doc,
249247
}
250248

251249
fn doc_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
252-
-> ty::TraitRef<'tcx> {
250+
-> Rc<ty::TraitRef<'tcx>> {
253251
parse_trait_ref_data(doc.data, cdata.cnum, doc.start, tcx,
254252
|_, did| translate_def_id(cdata, did))
255253
}
256254

257255
fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
258-
-> ty::TraitRef<'tcx> {
256+
-> Rc<ty::TraitRef<'tcx>> {
259257
let tp = reader::get_doc(doc, tag_item_trait_ref);
260258
doc_trait_ref(tp, tcx, cdata)
261259
}
@@ -422,9 +420,6 @@ pub fn get_trait_def<'tcx>(cdata: Cmd,
422420
generics: generics,
423421
trait_ref: item_trait_ref(item_doc, tcx, cdata),
424422
associated_type_names: associated_type_names,
425-
nonblanket_impls: RefCell::new(FnvHashMap()),
426-
blanket_impls: RefCell::new(vec![]),
427-
flags: Cell::new(ty::TraitFlags::NO_TRAIT_FLAGS)
428423
}
429424
}
430425

@@ -495,7 +490,7 @@ pub fn get_impl_polarity<'tcx>(cdata: Cmd,
495490
pub fn get_impl_trait<'tcx>(cdata: Cmd,
496491
id: ast::NodeId,
497492
tcx: &ty::ctxt<'tcx>)
498-
-> Option<ty::TraitRef<'tcx>>
493+
-> Option<Rc<ty::TraitRef<'tcx>>>
499494
{
500495
let item_doc = lookup_item(id, cdata.data());
501496
let fam = item_family(item_doc);

0 commit comments

Comments
 (0)