Skip to content

Commit a0148f7

Browse files
committed
---
yaml --- r: 194533 b: refs/heads/snap-stage3 c: 199bdcf h: refs/heads/master i: 194531: 2318158 v: v3
1 parent 6b6683a commit a0148f7

File tree

30 files changed

+604
-136
lines changed

30 files changed

+604
-136
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 242ed0b7c0f6a21096f2cc3e1ad1bdb176d02545
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 92e72ee15e4ec57ea430703662a882cb6ebf9311
4+
refs/heads/snap-stage3: 199bdcfeff5cfafd1f8e8ff583d7209272469879
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/mk/tests.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ ifeq ($(CFG_OSTYPE),apple-darwin)
569569
CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
570570
endif
571571

572+
ifeq ($(findstring android, $(CFG_TARGET)), android)
573+
CTEST_DISABLE_debuginfo-gdb =
574+
CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
575+
endif
576+
572577
# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
573578
# test group to be disabled *unless* the target is able to build a
574579
# compiler (i.e. when the target triple is in the set of of host

branches/snap-stage3/src/libcollections/binary_heap.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ impl<T: Ord> BinaryHeap<T> {
563563
pub fn is_empty(&self) -> bool { self.len() == 0 }
564564

565565
/// Clears the binary heap, returning an iterator over the removed elements.
566+
///
567+
/// The elements are removed in arbitrary order.
566568
#[inline]
567569
#[unstable(feature = "collections",
568570
reason = "matches collection reform specification, waiting for dust to settle")]

branches/snap-stage3/src/libcollections/slice.rs

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,23 @@
1313
//! The `slice` module contains useful code to help work with slice values.
1414
//! Slices are a view into a block of memory represented as a pointer and a length.
1515
//!
16-
//! ```rust
17-
//! # #![feature(core)]
16+
//! ```
1817
//! // slicing a Vec
19-
//! let vec = vec!(1, 2, 3);
20-
//! let int_slice = vec.as_slice();
18+
//! let vec = vec![1, 2, 3];
19+
//! let int_slice = &vec[..];
2120
//! // coercing an array to a slice
2221
//! let str_slice: &[&str] = &["one", "two", "three"];
2322
//! ```
2423
//!
2524
//! Slices are either mutable or shared. The shared slice type is `&[T]`,
26-
//! while the mutable slice type is `&mut[T]`. For example, you can mutate the
27-
//! block of memory that a mutable slice points to:
25+
//! while the mutable slice type is `&mut [T]`, where `T` represents the element
26+
//! type. For example, you can mutate the block of memory that a mutable slice
27+
//! points to:
2828
//!
29-
//! ```rust
30-
//! let x: &mut[i32] = &mut [1, 2, 3];
29+
//! ```
30+
//! let x = &mut [1, 2, 3];
3131
//! x[1] = 7;
32-
//! assert_eq!(x[0], 1);
33-
//! assert_eq!(x[1], 7);
34-
//! assert_eq!(x[2], 3);
32+
//! assert_eq!(x, &[1, 7, 3]);
3533
//! ```
3634
//!
3735
//! Here are some of the things this module contains:
@@ -41,49 +39,43 @@
4139
//! There are several structs that are useful for slices, such as `Iter`, which
4240
//! represents iteration over a slice.
4341
//!
44-
//! ## Traits
45-
//!
46-
//! A number of traits add methods that allow you to accomplish tasks
47-
//! with slices, the most important being `SliceExt`. Other traits
48-
//! apply only to slices of elements satisfying certain bounds (like
49-
//! `Ord`).
50-
//!
51-
//! An example is the `slice` method which enables slicing syntax `[a..b]` that
52-
//! returns an immutable "view" into a `Vec` or another slice from the index
53-
//! interval `[a, b)`:
54-
//!
55-
//! ```rust
56-
//! fn main() {
57-
//! let numbers = [0, 1, 2];
58-
//! let last_numbers = &numbers[1..3];
59-
//! // last_numbers is now &[1, 2]
60-
//! }
61-
//! ```
62-
//!
63-
//! ## Implementations of other traits
42+
//! ## Trait Implementations
6443
//!
6544
//! There are several implementations of common traits for slices. Some examples
6645
//! include:
6746
//!
6847
//! * `Clone`
69-
//! * `Eq`, `Ord` - for immutable slices whose element type are `Eq` or `Ord`.
48+
//! * `Eq`, `Ord` - for slices whose element type are `Eq` or `Ord`.
7049
//! * `Hash` - for slices whose element type is `Hash`
7150
//!
7251
//! ## Iteration
7352
//!
74-
//! The method `iter()` returns an iteration value for a slice. The iterator
75-
//! yields references to the slice's elements, so if the element
76-
//! type of the slice is `isize`, the element type of the iterator is `&isize`.
53+
//! The slices implement `IntoIterator`. The iterators of yield references
54+
//! to the slice elements.
7755
//!
78-
//! ```rust
79-
//! let numbers = [0, 1, 2];
80-
//! for &x in numbers.iter() {
81-
//! println!("{} is a number!", x);
56+
//! ```
57+
//! let numbers = &[0, 1, 2];
58+
//! for n in numbers {
59+
//! println!("{} is a number!", n);
8260
//! }
8361
//! ```
8462
//!
85-
//! * `.iter_mut()` returns an iterator that allows modifying each value.
86-
//! * Further iterators exist that split, chunk or permute the slice.
63+
//! The mutable slice yields mutable references to the elements:
64+
//!
65+
//! ```
66+
//! let mut scores = [7, 8, 9];
67+
//! for score in &mut scores[..] {
68+
//! *score += 1;
69+
//! }
70+
//! ```
71+
//!
72+
//! This iterator yields mutable references to the slice's elements, so while the element
73+
//! type of the slice is `i32`, the element type of the iterator is `&mut i32`.
74+
//!
75+
//! * `.iter()` and `.iter_mut()` are the explicit methods to return the default
76+
//! iterators.
77+
//! * Further methods that return iterators are `.split()`, `.splitn()`,
78+
//! `.chunks()`, `.windows()` and more.
8779
8880
#![doc(primitive = "slice")]
8981
#![stable(feature = "rust1", since = "1.0.0")]

branches/snap-stage3/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! are owned elsewhere.
2020
//!
2121
//! Basic operations are implemented directly by the compiler, but more advanced
22-
//! operations are defined on the [`StrExt`](trait.StrExt.html) trait.
22+
//! operations are defined as methods on the `str` type.
2323
//!
2424
//! # Examples
2525
//!

branches/snap-stage3/src/libcore/ops.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,10 @@ impl fmt::Debug for RangeFull {
995995
#[stable(feature = "rust1", since = "1.0.0")]
996996
pub struct Range<Idx> {
997997
/// The lower bound of the range (inclusive).
998+
#[stable(feature = "rust1", since = "1.0.0")]
998999
pub start: Idx,
9991000
/// The upper bound of the range (exclusive).
1001+
#[stable(feature = "rust1", since = "1.0.0")]
10001002
pub end: Idx,
10011003
}
10021004

@@ -1013,11 +1015,10 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
10131015
#[stable(feature = "rust1", since = "1.0.0")]
10141016
pub struct RangeFrom<Idx> {
10151017
/// The lower bound of the range (inclusive).
1018+
#[stable(feature = "rust1", since = "1.0.0")]
10161019
pub start: Idx,
10171020
}
10181021

1019-
1020-
10211022
#[stable(feature = "rust1", since = "1.0.0")]
10221023
impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
10231024
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
@@ -1031,6 +1032,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
10311032
#[stable(feature = "rust1", since = "1.0.0")]
10321033
pub struct RangeTo<Idx> {
10331034
/// The upper bound of the range (exclusive).
1035+
#[stable(feature = "rust1", since = "1.0.0")]
10341036
pub end: Idx,
10351037
}
10361038

@@ -1041,7 +1043,6 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
10411043
}
10421044
}
10431045

1044-
10451046
/// The `Deref` trait is used to specify the functionality of dereferencing
10461047
/// operations like `*v`.
10471048
///

branches/snap-stage3/src/libcore/str/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ impl FromStr for bool {
165165
/// assert!(<bool as FromStr>::from_str("not even a boolean").is_err());
166166
/// ```
167167
///
168-
/// Note, in many cases, the StrExt::parse() which is based on
169-
/// this FromStr::from_str() is more proper.
168+
/// Note, in many cases, the `.parse()` method on `str` is more proper.
170169
///
171170
/// ```
172171
/// assert_eq!("true".parse(), Ok(true));
@@ -531,7 +530,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
531530
/// External iterator for a string's bytes.
532531
/// Use with the `std::iter` module.
533532
///
534-
/// Created with `StrExt::bytes`
533+
/// Created with `str::bytes`
535534
#[stable(feature = "rust1", since = "1.0.0")]
536535
#[derive(Clone)]
537536
pub struct Bytes<'a>(Map<slice::Iter<'a, u8>, BytesDeref>);
@@ -1489,27 +1488,27 @@ impl<'a, S: ?Sized> Str for &'a S where S: Str {
14891488
fn as_slice(&self) -> &str { Str::as_slice(*self) }
14901489
}
14911490

1492-
/// Return type of `StrExt::split`
1491+
/// Return type of `str::split`
14931492
#[stable(feature = "rust1", since = "1.0.0")]
14941493
pub struct Split<'a, P: Pattern<'a>>(CharSplits<'a, P>);
14951494
delegate_iter!{pattern &'a str : Split<'a, P>}
14961495

1497-
/// Return type of `StrExt::split_terminator`
1496+
/// Return type of `str::split_terminator`
14981497
#[stable(feature = "rust1", since = "1.0.0")]
14991498
pub struct SplitTerminator<'a, P: Pattern<'a>>(CharSplits<'a, P>);
15001499
delegate_iter!{pattern &'a str : SplitTerminator<'a, P>}
15011500

1502-
/// Return type of `StrExt::splitn`
1501+
/// Return type of `str::splitn`
15031502
#[stable(feature = "rust1", since = "1.0.0")]
15041503
pub struct SplitN<'a, P: Pattern<'a>>(CharSplitsN<'a, P>);
15051504
delegate_iter!{pattern forward &'a str : SplitN<'a, P>}
15061505

1507-
/// Return type of `StrExt::rsplit`
1506+
/// Return type of `str::rsplit`
15081507
#[stable(feature = "rust1", since = "1.0.0")]
15091508
pub struct RSplit<'a, P: Pattern<'a>>(RCharSplits<'a, P>);
15101509
delegate_iter!{pattern reverse &'a str : RSplit<'a, P>}
15111510

1512-
/// Return type of `StrExt::rsplitn`
1511+
/// Return type of `str::rsplitn`
15131512
#[stable(feature = "rust1", since = "1.0.0")]
15141513
pub struct RSplitN<'a, P: Pattern<'a>>(RCharSplitsN<'a, P>);
15151514
delegate_iter!{pattern reverse &'a str : RSplitN<'a, P>}

branches/snap-stage3/src/librustc/middle/infer/error_reporting.rs

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -357,23 +357,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
357357
}
358358
};
359359

360-
let message_root_str = match trace.origin {
361-
infer::Misc(_) => "mismatched types",
362-
infer::MethodCompatCheck(_) => "method not compatible with trait",
363-
infer::ExprAssignable(_) => "mismatched types",
364-
infer::RelateTraitRefs(_) => "mismatched traits",
365-
infer::RelateSelfType(_) => "mismatched types",
366-
infer::RelateOutputImplTypes(_) => "mismatched types",
367-
infer::MatchExpressionArm(_, _) => "match arms have incompatible types",
368-
infer::IfExpression(_) => "if and else have incompatible types",
369-
infer::IfExpressionWithNoElse(_) => "if may be missing an else clause",
370-
infer::RangeExpression(_) => "start and end of range have incompatible types",
371-
infer::EquatePredicate(_) => "equality predicate not satisfied",
372-
};
373-
374360
span_err!(self.tcx.sess, trace.origin.span(), E0308,
375361
"{}: {} ({})",
376-
message_root_str,
362+
trace.origin,
377363
expected_found_str,
378364
ty::type_err_to_str(self.tcx, terr));
379365

@@ -1495,38 +1481,38 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
14951481
infer::Subtype(ref trace) => {
14961482
let desc = match trace.origin {
14971483
infer::Misc(_) => {
1498-
format!("types are compatible")
1484+
"types are compatible"
14991485
}
15001486
infer::MethodCompatCheck(_) => {
1501-
format!("method type is compatible with trait")
1487+
"method type is compatible with trait"
15021488
}
15031489
infer::ExprAssignable(_) => {
1504-
format!("expression is assignable")
1490+
"expression is assignable"
15051491
}
15061492
infer::RelateTraitRefs(_) => {
1507-
format!("traits are compatible")
1493+
"traits are compatible"
15081494
}
15091495
infer::RelateSelfType(_) => {
1510-
format!("self type matches impl self type")
1496+
"self type matches impl self type"
15111497
}
15121498
infer::RelateOutputImplTypes(_) => {
1513-
format!("trait type parameters matches those \
1514-
specified on the impl")
1499+
"trait type parameters matches those \
1500+
specified on the impl"
15151501
}
15161502
infer::MatchExpressionArm(_, _) => {
1517-
format!("match arms have compatible types")
1503+
"match arms have compatible types"
15181504
}
15191505
infer::IfExpression(_) => {
1520-
format!("if and else have compatible types")
1506+
"if and else have compatible types"
15211507
}
15221508
infer::IfExpressionWithNoElse(_) => {
1523-
format!("if may be missing an else clause")
1509+
"if may be missing an else clause"
15241510
}
15251511
infer::RangeExpression(_) => {
1526-
format!("start and end of range have compatible types")
1512+
"start and end of range have compatible types"
15271513
}
15281514
infer::EquatePredicate(_) => {
1529-
format!("equality where clause is satisfied")
1515+
"equality where clause is satisfied"
15301516
}
15311517
};
15321518

@@ -1666,8 +1652,8 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
16661652
infer::RelateRegionParamBound(span) => {
16671653
self.tcx.sess.span_note(
16681654
span,
1669-
&format!("...so that the declared lifetime parameter bounds \
1670-
are satisfied"));
1655+
"...so that the declared lifetime parameter bounds \
1656+
are satisfied");
16711657
}
16721658
infer::SafeDestructor(span) => {
16731659
self.tcx.sess.span_note(

branches/snap-stage3/src/librustc/middle/infer/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use middle::ty::replace_late_bound_regions;
2929
use middle::ty::{self, Ty};
3030
use middle::ty_fold::{TypeFolder, TypeFoldable};
3131
use std::cell::{RefCell};
32+
use std::fmt;
3233
use std::rc::Rc;
3334
use syntax::ast;
3435
use syntax::codemap;
@@ -128,6 +129,30 @@ pub enum TypeOrigin {
128129
EquatePredicate(Span),
129130
}
130131

132+
impl TypeOrigin {
133+
fn as_str(&self) -> &'static str {
134+
match self {
135+
&TypeOrigin::Misc(_) |
136+
&TypeOrigin::RelateSelfType(_) |
137+
&TypeOrigin::RelateOutputImplTypes(_) |
138+
&TypeOrigin::ExprAssignable(_) => "mismatched types",
139+
&TypeOrigin::RelateTraitRefs(_) => "mismatched traits",
140+
&TypeOrigin::MethodCompatCheck(_) => "method not compatible with trait",
141+
&TypeOrigin::MatchExpressionArm(_, _) => "match arms have incompatible types",
142+
&TypeOrigin::IfExpression(_) => "if and else have incompatible types",
143+
&TypeOrigin::IfExpressionWithNoElse(_) => "if may be missing an else clause",
144+
&TypeOrigin::RangeExpression(_) => "start and end of range have incompatible types",
145+
&TypeOrigin::EquatePredicate(_) => "equality predicate not satisfied",
146+
}
147+
}
148+
}
149+
150+
impl fmt::Display for TypeOrigin {
151+
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(),fmt::Error> {
152+
fmt::Display::fmt(self.as_str(), f)
153+
}
154+
}
155+
131156
/// See `error_reporting.rs` for more details
132157
#[derive(Clone, Debug)]
133158
pub enum ValuePairs<'tcx> {

branches/snap-stage3/src/librustc_trans/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,12 +1352,12 @@ impl<'tcx> euv::Delegate<'tcx> for ReassignmentChecker {
13521352
fn mutate(&mut self, _: ast::NodeId, _: Span, cmt: mc::cmt, _: euv::MutateMode) {
13531353
match cmt.cat {
13541354
mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: vid, .. }, .. }) |
1355-
mc::cat_local(vid) => self.reassigned = self.node == vid,
1355+
mc::cat_local(vid) => self.reassigned |= self.node == vid,
13561356
mc::cat_interior(ref base_cmt, mc::InteriorField(field)) => {
13571357
match base_cmt.cat {
13581358
mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: vid, .. }, .. }) |
13591359
mc::cat_local(vid) => {
1360-
self.reassigned = self.node == vid && Some(field) == self.field
1360+
self.reassigned |= self.node == vid && Some(field) == self.field
13611361
},
13621362
_ => {}
13631363
}

0 commit comments

Comments
 (0)