Skip to content

Commit 719a308

Browse files
committed
---
yaml --- r: 236393 b: refs/heads/master c: e1acf87 h: refs/heads/master i: 236391: b53ee7c v: v3
1 parent a3dc7ee commit 719a308

Some content is hidden

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

60 files changed

+133
-246
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: a305b0624b164fd0b0b5558b837288429247cdaf
2+
refs/heads/master: e1acf87fe0fe3b64be0750dc7d1244558a626a91
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
44
refs/heads/try: ea3892f76a2180dd4ce724f1dafd9186959702d9
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/doc/trpl/iterators.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ If you are trying to execute a closure on an iterator for its side effects,
281281
just use `for` instead.
282282

283283
There are tons of interesting iterator adapters. `take(n)` will return an
284-
iterator over the next `n` elements of the original iterator. Note that this
285-
has no side effect on the original iterator. Let's try it out with our infinite
284+
iterator over the next `n` elements of the original iterator. Let's try it out with our infinite
286285
iterator from before:
287286

288287
```rust

trunk/src/libcollections/enum_set.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ impl<E> Clone for EnumSet<E> {
4949
#[stable(feature = "rust1", since = "1.0.0")]
5050
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
5151
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
52-
fmt.debug_set().entries(self).finish()
52+
try!(write!(fmt, "{{"));
53+
let mut first = true;
54+
for e in self {
55+
if !first {
56+
try!(write!(fmt, ", "));
57+
}
58+
try!(write!(fmt, "{:?}", e));
59+
first = false;
60+
}
61+
write!(fmt, "}}")
5362
}
5463
}
5564

trunk/src/libcollections/str.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ impl str {
506506
///
507507
/// # Examples
508508
/// ```
509+
/// #![feature(str_split_at)]
510+
///
509511
/// let s = "Löwe 老虎 Léopard";
510512
/// let first_space = s.find(' ').unwrap_or(s.len());
511513
/// let (a, b) = s.split_at(first_space);

trunk/src/libcollections/vec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ impl<T> Vec<T> {
753753
/// # Examples
754754
///
755755
/// ```
756+
/// #![feature(split_off)]
757+
///
756758
/// let mut vec = vec![1,2,3];
757759
/// let vec2 = vec.split_off(1);
758760
/// assert_eq!(vec, [1]);

trunk/src/libcollections/vec_deque.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,8 @@ impl<T> VecDeque<T> {
13191319
/// # Examples
13201320
///
13211321
/// ```
1322+
/// #![feature(split_off)]
1323+
///
13221324
/// use std::collections::VecDeque;
13231325
///
13241326
/// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect();
@@ -1404,6 +1406,8 @@ impl<T> VecDeque<T> {
14041406
/// # Examples
14051407
///
14061408
/// ```
1409+
/// #![feature(vec_deque_retain)]
1410+
///
14071411
/// use std::collections::VecDeque;
14081412
///
14091413
/// let mut buf = VecDeque::new();
@@ -1783,7 +1787,14 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
17831787
#[stable(feature = "rust1", since = "1.0.0")]
17841788
impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
17851789
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1786-
f.debug_list().entries(self).finish()
1790+
try!(write!(f, "["));
1791+
1792+
for (i, e) in self.iter().enumerate() {
1793+
if i != 0 { try!(write!(f, ", ")); }
1794+
try!(write!(f, "{:?}", *e));
1795+
}
1796+
1797+
write!(f, "]")
17871798
}
17881799
}
17891800

trunk/src/libcollectionstest/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(ascii)]
12+
#![feature(append)]
1213
#![feature(binary_heap_extras)]
1314
#![feature(box_syntax)]
1415
#![feature(btree_range)]
@@ -28,14 +29,18 @@
2829
#![feature(set_recovery)]
2930
#![feature(slice_bytes)]
3031
#![feature(slice_splits)]
32+
#![feature(split_off)]
3133
#![feature(step_by)]
3234
#![feature(str_char)]
3335
#![feature(str_escape)]
3436
#![feature(str_match_indices)]
37+
#![feature(str_split_at)]
3538
#![feature(str_utf16)]
39+
#![feature(box_str)]
3640
#![feature(test)]
3741
#![feature(unboxed_closures)]
3842
#![feature(unicode)]
43+
#![feature(vec_deque_retain)]
3944
#![feature(vec_push_all)]
4045

4146
#[macro_use] extern crate log;

trunk/src/liblibc/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3901,8 +3901,6 @@ pub mod consts {
39013901
pub const MAP_POPULATE : c_int = 0x08000;
39023902
pub const MAP_NONBLOCK : c_int = 0x010000;
39033903
pub const MAP_STACK : c_int = 0x020000;
3904-
3905-
pub const PATH_MAX: c_int = 4096;
39063904
}
39073905
#[cfg(any(target_arch = "mips",
39083906
target_arch = "mipsel"))]
@@ -3930,8 +3928,6 @@ pub mod consts {
39303928
pub const MAP_POPULATE : c_int = 0x010000;
39313929
pub const MAP_NONBLOCK : c_int = 0x020000;
39323930
pub const MAP_STACK : c_int = 0x040000;
3933-
3934-
pub const PATH_MAX: c_int = 4096;
39353931
}
39363932
#[cfg(target_os = "linux")]
39373933
pub mod sysconf {

trunk/src/librustc/middle/infer/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use std::rc::Rc;
4343
use syntax::ast;
4444
use syntax::codemap;
4545
use syntax::codemap::{Span, DUMMY_SP};
46-
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
46+
use util::nodemap::{FnvHashMap, NodeMap};
4747

4848
use self::combine::CombineFields;
4949
use self::region_inference::{RegionVarBindings, RegionSnapshot};
@@ -92,10 +92,6 @@ pub struct InferCtxt<'a, 'tcx: 'a> {
9292

9393
pub fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>,
9494

95-
// the set of predicates on which errors have been reported, to
96-
// avoid reporting the same error twice.
97-
pub reported_trait_errors: RefCell<FnvHashSet<traits::TraitErrorKey<'tcx>>>,
98-
9995
// This is a temporary field used for toggling on normalization in the inference context,
10096
// as we move towards the approach described here:
10197
// https://internals.rust-lang.org/t/flattening-the-contexts-for-fun-and-profit/2293
@@ -378,7 +374,6 @@ pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
378374
region_vars: RegionVarBindings::new(tcx),
379375
parameter_environment: param_env.unwrap_or(tcx.empty_parameter_environment()),
380376
fulfillment_cx: RefCell::new(traits::FulfillmentContext::new(errors_will_be_reported)),
381-
reported_trait_errors: RefCell::new(FnvHashSet()),
382377
normalize: false,
383378
err_count_on_creation: tcx.sess.err_count()
384379
}

trunk/src/librustc/middle/reachable.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,13 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
348348
// this properly would result in the necessity of computing *type*
349349
// reachability, which might result in a compile time loss.
350350
fn mark_destructors_reachable(&mut self) {
351-
let drop_trait = match self.tcx.lang_items.drop_trait() {
352-
Some(id) => self.tcx.lookup_trait_def(id), None => { return }
353-
};
354-
drop_trait.for_each_impl(self.tcx, |drop_impl| {
355-
for destructor in &self.tcx.impl_items.borrow()[&drop_impl] {
356-
let destructor_did = destructor.def_id();
357-
if destructor_did.is_local() {
358-
self.reachable_symbols.insert(destructor_did.node);
351+
for adt in self.tcx.adt_defs() {
352+
if let Some(destructor_def_id) = adt.destructor() {
353+
if destructor_def_id.is_local() {
354+
self.reachable_symbols.insert(destructor_def_id.node);
359355
}
360356
}
361-
})
357+
}
362358
}
363359
}
364360

trunk/src/librustc/middle/traits/error_reporting.rs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,11 @@ use middle::def_id::DefId;
2828
use middle::infer::InferCtxt;
2929
use middle::ty::{self, ToPredicate, HasTypeFlags, ToPolyTraitRef, TraitRef, Ty};
3030
use middle::ty::fold::TypeFoldable;
31-
use util::nodemap::{FnvHashMap, FnvHashSet};
32-
31+
use std::collections::HashMap;
3332
use std::fmt;
3433
use syntax::codemap::Span;
3534
use syntax::attr::{AttributeMethods, AttrMetaMethods};
3635

37-
#[derive(Debug, PartialEq, Eq, Hash)]
38-
pub struct TraitErrorKey<'tcx> {
39-
is_warning: bool,
40-
span: Span,
41-
predicate: ty::Predicate<'tcx>
42-
}
43-
44-
impl<'tcx> TraitErrorKey<'tcx> {
45-
fn from_error<'a>(infcx: &InferCtxt<'a, 'tcx>,
46-
e: &FulfillmentError<'tcx>) -> Self {
47-
let predicate =
48-
infcx.resolve_type_vars_if_possible(&e.obligation.predicate);
49-
TraitErrorKey {
50-
is_warning: is_warning(&e.obligation),
51-
span: e.obligation.cause.span,
52-
predicate: infcx.tcx.erase_regions(&predicate)
53-
}
54-
}
55-
}
56-
5736
pub fn report_fulfillment_errors<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
5837
errors: &Vec<FulfillmentError<'tcx>>) {
5938
for error in errors {
@@ -63,13 +42,6 @@ pub fn report_fulfillment_errors<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
6342

6443
fn report_fulfillment_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
6544
error: &FulfillmentError<'tcx>) {
66-
let error_key = TraitErrorKey::from_error(infcx, error);
67-
debug!("report_fulfillment_errors({:?}) - key={:?}",
68-
error, error_key);
69-
if !infcx.reported_trait_errors.borrow_mut().insert(error_key) {
70-
debug!("report_fulfillment_errors: skipping duplicate");
71-
return;
72-
}
7345
match error.code {
7446
FulfillmentErrorCode::CodeSelectionError(ref e) => {
7547
report_selection_error(infcx, &error.obligation, e);
@@ -125,7 +97,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
12597
(gen.name.as_str().to_string(),
12698
trait_ref.substs.types.get(param, i)
12799
.to_string())
128-
}).collect::<FnvHashMap<String, String>>();
100+
}).collect::<HashMap<String, String>>();
129101
generic_map.insert("Self".to_string(),
130102
trait_ref.self_ty().to_string());
131103
let parser = Parser::new(&istring);
@@ -336,11 +308,7 @@ pub fn report_object_safety_error<'tcx>(tcx: &ty::ctxt<'tcx>,
336308
"the trait `{}` cannot be made into an object",
337309
tcx.item_path_str(trait_def_id));
338310

339-
let mut reported_violations = FnvHashSet();
340311
for violation in violations {
341-
if !reported_violations.insert(violation.clone()) {
342-
continue;
343-
}
344312
match violation {
345313
ObjectSafetyViolation::SizedSelf => {
346314
tcx.sess.fileline_note(

trunk/src/librustc/middle/traits/fulfill.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ pub struct FulfillmentContext<'tcx> {
4949
// than the `SelectionCache`: it avoids duplicate errors and
5050
// permits recursive obligations, which are often generated from
5151
// traits like `Send` et al.
52-
//
53-
// Note that because of type inference, a predicate can still
54-
// occur twice in the predicates list, for example when 2
55-
// initially-distinct type variables are unified after being
56-
// inserted. Deduplicating the predicate set on selection had a
57-
// significant performance cost the last time I checked.
5852
duplicate_set: FulfilledPredicates<'tcx>,
5953

6054
// A list of all obligations that have been registered with this

trunk/src/librustc/middle/traits/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ use middle::subst;
2121
use middle::ty::{self, HasTypeFlags, Ty};
2222
use middle::ty::fold::TypeFoldable;
2323
use middle::infer::{self, fixup_err_to_string, InferCtxt};
24-
2524
use std::rc::Rc;
2625
use syntax::ast;
2726
use syntax::codemap::{Span, DUMMY_SP};
2827

29-
pub use self::error_reporting::TraitErrorKey;
3028
pub use self::error_reporting::report_fulfillment_errors;
3129
pub use self::error_reporting::report_overflow_error;
3230
pub use self::error_reporting::report_selection_error;

trunk/src/librustc/middle/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use middle::ty::{self, ToPolyTraitRef, Ty};
2727
use std::rc::Rc;
2828
use syntax::ast;
2929

30-
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
30+
#[derive(Debug)]
3131
pub enum ObjectSafetyViolation<'tcx> {
3232
/// Self : Sized declared on the trait
3333
SizedSelf,

trunk/src/librustc/middle/ty/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ pub struct ctxt<'tcx> {
245245
/// True if the variance has been computed yet; false otherwise.
246246
pub variance_computed: Cell<bool>,
247247

248+
/// A method will be in this list if and only if it is a destructor.
249+
pub destructors: RefCell<DefIdSet>,
250+
248251
/// Maps a DefId of a type to a list of its inherent impls.
249252
/// Contains implementations of methods that are inherent to a type.
250253
/// Methods in these implementations don't need to be exported.
@@ -472,6 +475,7 @@ impl<'tcx> ctxt<'tcx> {
472475
normalized_cache: RefCell::new(FnvHashMap()),
473476
lang_items: lang_items,
474477
provided_method_sources: RefCell::new(DefIdMap()),
478+
destructors: RefCell::new(DefIdSet()),
475479
inherent_impls: RefCell::new(DefIdMap()),
476480
impl_items: RefCell::new(DefIdMap()),
477481
used_unsafe: RefCell::new(NodeSet()),

trunk/src/librustc/middle/ty/mod.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,6 @@ impl<'tcx> Method<'tcx> {
272272
}
273273
}
274274

275-
impl<'tcx> PartialEq for Method<'tcx> {
276-
#[inline]
277-
fn eq(&self, other: &Self) -> bool { self.def_id == other.def_id }
278-
}
279-
280-
impl<'tcx> Eq for Method<'tcx> {}
281-
282-
impl<'tcx> Hash for Method<'tcx> {
283-
#[inline]
284-
fn hash<H: Hasher>(&self, s: &mut H) {
285-
self.def_id.hash(s)
286-
}
287-
}
288-
289275
#[derive(Clone, Copy, Debug)]
290276
pub struct AssociatedConst<'tcx> {
291277
pub name: Name,
@@ -1695,6 +1681,7 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
16951681
}
16961682

16971683
pub fn set_destructor(&self, dtor: DefId) {
1684+
assert!(self.destructor.get().is_none());
16981685
self.destructor.set(Some(dtor));
16991686
}
17001687

@@ -2328,6 +2315,11 @@ impl<'tcx> ctxt<'tcx> {
23282315
self.lookup_adt_def_master(did)
23292316
}
23302317

2318+
/// Return the list of all interned ADT definitions
2319+
pub fn adt_defs(&self) -> Vec<AdtDef<'tcx>> {
2320+
self.adt_defs.borrow().values().cloned().collect()
2321+
}
2322+
23312323
/// Given the did of an item, returns its full set of predicates.
23322324
pub fn lookup_predicates(&self, did: DefId) -> GenericPredicates<'tcx> {
23332325
lookup_locally_or_in_crate_store(

trunk/src/librustc_back/target/apple_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn opts() -> TargetOptions {
2424
dll_suffix: ".dylib".to_string(),
2525
archive_format: "bsd".to_string(),
2626
pre_link_args: Vec::new(),
27-
exe_allocation_crate: super::maybe_jemalloc(),
27+
exe_allocation_crate: super::best_allocator(),
2828
.. Default::default()
2929
}
3030
}

trunk/src/librustc_back/target/bitrig_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn opts() -> TargetOptions {
2020
has_rpath: true,
2121
position_independent_executables: true,
2222
archive_format: "gnu".to_string(),
23-
exe_allocation_crate: "alloc_system".to_string(),
23+
exe_allocation_crate: super::best_allocator(),
2424

2525
.. Default::default()
2626
}

trunk/src/librustc_back/target/dragonfly_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn opts() -> TargetOptions {
2727
),
2828
position_independent_executables: true,
2929
archive_format: "gnu".to_string(),
30-
exe_allocation_crate: super::maybe_jemalloc(),
30+
exe_allocation_crate: super::best_allocator(),
3131
.. Default::default()
3232
}
3333
}

trunk/src/librustc_back/target/freebsd_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn opts() -> TargetOptions {
1818
executables: true,
1919
has_rpath: true,
2020
archive_format: "gnu".to_string(),
21-
exe_allocation_crate: super::maybe_jemalloc(),
21+
exe_allocation_crate: super::best_allocator(),
2222

2323
.. Default::default()
2424
}

trunk/src/librustc_back/target/linux_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn opts() -> TargetOptions {
2929
],
3030
position_independent_executables: true,
3131
archive_format: "gnu".to_string(),
32-
exe_allocation_crate: super::maybe_jemalloc(),
32+
exe_allocation_crate: super::best_allocator(),
3333
.. Default::default()
3434
}
3535
}

trunk/src/librustc_back/target/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl Target {
458458
}
459459
}
460460

461-
fn maybe_jemalloc() -> String {
461+
fn best_allocator() -> String {
462462
if cfg!(disable_jemalloc) {
463463
"alloc_system".to_string()
464464
} else {

0 commit comments

Comments
 (0)