Skip to content

Commit 3d14d48

Browse files
committed
---
yaml --- r: 195571 b: refs/heads/master c: 4b6248a h: refs/heads/master i: 195569: e3a0107 195567: 739d953 v: v3
1 parent c6a7166 commit 3d14d48

File tree

88 files changed

+1849
-3017
lines changed

Some content is hidden

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

88 files changed

+1849
-3017
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: 2159bbf6506c04e06b73f0e45dcf4e92f1ffa1ac
2+
refs/heads/master: 4b6248a80658ec2e3b1552441f57ebc4b1f06448
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b3317d68910900f135f9f38e43a7a699bc736b4a
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf

trunk/src/liballoc/arc.rs

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -242,38 +242,6 @@ pub fn weak_count<T>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) -
242242
#[unstable(feature = "alloc")]
243243
pub fn strong_count<T>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
244244

245-
246-
/// Try accessing a mutable reference to the contents behind an unique `Arc<T>`.
247-
///
248-
/// The access is granted only if this is the only reference to the object.
249-
/// Otherwise, `None` is returned.
250-
///
251-
/// # Examples
252-
///
253-
/// ```
254-
/// # #![feature(alloc)]
255-
/// use std::alloc::arc;
256-
///
257-
/// let mut four = arc::Arc::new(4);
258-
///
259-
/// arc::unique(&mut four).map(|num| *num = 5);
260-
/// ```
261-
#[inline]
262-
#[unstable(feature = "alloc")]
263-
pub fn unique<T>(this: &mut Arc<T>) -> Option<&mut T> {
264-
if strong_count(this) == 1 && weak_count(this) == 0 {
265-
// This unsafety is ok because we're guaranteed that the pointer
266-
// returned is the *only* pointer that will ever be returned to T. Our
267-
// reference count is guaranteed to be 1 at this point, and we required
268-
// the Arc itself to be `mut`, so we're returning the only possible
269-
// reference to the inner data.
270-
let inner = unsafe { &mut **this._ptr };
271-
Some(&mut inner.data)
272-
}else {
273-
None
274-
}
275-
}
276-
277245
#[stable(feature = "rust1", since = "1.0.0")]
278246
impl<T> Clone for Arc<T> {
279247
/// Makes a clone of the `Arc<T>`.
@@ -344,8 +312,11 @@ impl<T: Send + Sync + Clone> Arc<T> {
344312
self.inner().weak.load(SeqCst) != 1 {
345313
*self = Arc::new((**self).clone())
346314
}
347-
// As with `unique()`, the unsafety is ok because our reference was
348-
// either unique to begin with, or became one upon cloning the contents.
315+
// This unsafety is ok because we're guaranteed that the pointer
316+
// returned is the *only* pointer that will ever be returned to T. Our
317+
// reference count is guaranteed to be 1 at this point, and we required
318+
// the Arc itself to be `mut`, so we're returning the only possible
319+
// reference to the inner data.
349320
let inner = unsafe { &mut **self._ptr };
350321
&mut inner.data
351322
}
@@ -688,7 +659,7 @@ mod tests {
688659
use std::sync::atomic::Ordering::{Acquire, SeqCst};
689660
use std::thread;
690661
use std::vec::Vec;
691-
use super::{Arc, Weak, weak_count, strong_count, unique};
662+
use super::{Arc, Weak, weak_count, strong_count};
692663
use std::sync::Mutex;
693664

694665
struct Canary(*mut atomic::AtomicUsize);
@@ -724,21 +695,6 @@ mod tests {
724695
assert_eq!((*arc_v)[4], 5);
725696
}
726697

727-
#[test]
728-
fn test_arc_unique() {
729-
let mut x = Arc::new(10);
730-
assert!(unique(&mut x).is_some());
731-
{
732-
let y = x.clone();
733-
assert!(unique(&mut x).is_none());
734-
}
735-
{
736-
let z = x.downgrade();
737-
assert!(unique(&mut x).is_none());
738-
}
739-
assert!(unique(&mut x).is_some());
740-
}
741-
742698
#[test]
743699
fn test_cowarc_clone_make_unique() {
744700
let mut cow0 = Arc::new(75);

trunk/src/liballoc/boxed.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ pub static HEAP: () = ();
8686
/// See the [module-level documentation](../../std/boxed/index.html) for more.
8787
#[lang = "owned_box"]
8888
#[stable(feature = "rust1", since = "1.0.0")]
89-
#[fundamental]
9089
pub struct Box<T>(Unique<T>);
9190

9291
impl<T> Box<T> {
@@ -278,6 +277,13 @@ impl<T: fmt::Debug + ?Sized> fmt::Debug for Box<T> {
278277
}
279278
}
280279

280+
#[stable(feature = "rust1", since = "1.0.0")]
281+
impl fmt::Debug for Box<Any> {
282+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
283+
f.pad("Box<Any>")
284+
}
285+
}
286+
281287
#[stable(feature = "rust1", since = "1.0.0")]
282288
impl<T: ?Sized> Deref for Box<T> {
283289
type Target = T;

trunk/src/liballoc/boxed_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ fn test_show() {
5555
let b = Box::new(Test) as Box<Any>;
5656
let a_str = format!("{:?}", a);
5757
let b_str = format!("{:?}", b);
58-
assert_eq!(a_str, "Any");
59-
assert_eq!(b_str, "Any");
58+
assert_eq!(a_str, "Box<Any>");
59+
assert_eq!(b_str, "Box<Any>");
6060

6161
static EIGHT: usize = 8;
6262
static TEST: Test = Test;
6363
let a = &EIGHT as &Any;
6464
let b = &TEST as &Any;
6565
let s = format!("{:?}", a);
66-
assert_eq!(s, "Any");
66+
assert_eq!(s, "&Any");
6767
let s = format!("{:?}", b);
68-
assert_eq!(s, "Any");
68+
assert_eq!(s, "&Any");
6969
}
7070

7171
#[test]

trunk/src/liballoc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@
7171
#![feature(no_std)]
7272
#![no_std]
7373
#![feature(allocator)]
74-
#![feature(custom_attribute)]
75-
#![feature(fundamental)]
7674
#![feature(lang_items, unsafe_destructor)]
7775
#![feature(box_syntax)]
7876
#![feature(optin_builtin_traits)]

trunk/src/libcore/any.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
7272
#![stable(feature = "rust1", since = "1.0.0")]
7373

74-
use fmt;
7574
use marker::Send;
7675
use mem::transmute;
7776
use option::Option::{self, Some, None};
@@ -106,13 +105,6 @@ impl<T> Any for T
106105
// Extension methods for Any trait objects.
107106
///////////////////////////////////////////////////////////////////////////////
108107

109-
#[stable(feature = "rust1", since = "1.0.0")]
110-
impl fmt::Debug for Any {
111-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
112-
f.pad("Any")
113-
}
114-
}
115-
116108
impl Any {
117109
/// Returns true if the boxed type is the same as `T`
118110
#[stable(feature = "rust1", since = "1.0.0")]

trunk/src/libcore/fmt/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

15+
use any;
1516
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
1617
use char::CharExt;
1718
use iter::Iterator;
@@ -996,6 +997,11 @@ macro_rules! tuple {
996997

997998
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
998999

1000+
#[stable(feature = "rust1", since = "1.0.0")]
1001+
impl<'a> Debug for &'a (any::Any+'a) {
1002+
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
1003+
}
1004+
9991005
#[stable(feature = "rust1", since = "1.0.0")]
10001006
impl<T: Debug> Debug for [T] {
10011007
fn fmt(&self, f: &mut Formatter) -> Result {

trunk/src/libcore/iter.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@
4545
//! let mut it = values.into_iter();
4646
//! loop {
4747
//! match it.next() {
48-
//! Some(x) => {
49-
//! println!("{}", x);
50-
//! }
51-
//! None => { break }
48+
//! Some(x) => println!("{}", x),
49+
//! None => break,
5250
//! }
5351
//! }
5452
//! ```

trunk/src/libcore/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@
7070
#![feature(unboxed_closures)]
7171
#![feature(rustc_attrs)]
7272
#![feature(optin_builtin_traits)]
73-
#![feature(fundamental)]
7473
#![feature(concat_idents)]
7574
#![feature(reflect)]
76-
#![feature(custom_attribute)]
7775

7876
#[macro_use]
7977
mod macros;

trunk/src/libcore/marker.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ impl !Send for Managed { }
4949
#[stable(feature = "rust1", since = "1.0.0")]
5050
#[lang="sized"]
5151
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
52-
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
5352
pub trait Sized : MarkerTrait {
5453
// Empty.
5554
}
@@ -347,16 +346,17 @@ impl<T:?Sized> MarkerTrait for T { }
347346
#[stable(feature = "rust1", since = "1.0.0")]
348347
pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
349348

350-
/// `PhantomData<T>` allows you to describe that a type acts as if it stores a value of type `T`,
351-
/// even though it does not. This allows you to inform the compiler about certain safety properties
352-
/// of your code.
353-
///
354-
/// Though they both have scary names, `PhantomData<T>` and "phantom types" are unrelated. 👻👻👻
349+
/// `PhantomData` is a way to tell the compiler about fake fields.
350+
/// Phantom data is required whenever type parameters are not used.
351+
/// The idea is that if the compiler encounters a `PhantomData<T>`
352+
/// instance, it will behave *as if* an instance of the type `T` were
353+
/// present for the purpose of various automatic analyses.
355354
///
356355
/// # Examples
357356
///
358357
/// When handling external resources over a foreign function interface, `PhantomData<T>` can
359-
/// prevent mismatches by enforcing types in the method implementations:
358+
/// prevent mismatches by enforcing types in the method implementations, although the struct
359+
/// doesn't actually contain values of the resource type.
360360
///
361361
/// ```
362362
/// # trait ResType { fn foo(&self); };
@@ -397,6 +397,11 @@ pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
397397
/// commonly necessary if the structure is using an unsafe pointer
398398
/// like `*mut T` whose referent may be dropped when the type is
399399
/// dropped, as a `*mut T` is otherwise not treated as owned.
400+
///
401+
/// FIXME. Better documentation and examples of common patterns needed
402+
/// here! For now, please see [RFC 738][738] for more information.
403+
///
404+
/// [738]: https://github.com/rust-lang/rfcs/blob/master/text/0738-variance.md
400405
#[lang="phantom_data"]
401406
#[stable(feature = "rust1", since = "1.0.0")]
402407
pub struct PhantomData<T:?Sized>;

trunk/src/libcore/ops.rs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,6 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
11171117
#[lang="fn"]
11181118
#[stable(feature = "rust1", since = "1.0.0")]
11191119
#[rustc_paren_sugar]
1120-
#[fundamental] // so that regex can rely that `&str: !FnMut`
11211120
pub trait Fn<Args> : FnMut<Args> {
11221121
/// This is called when the call operator is used.
11231122
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
@@ -1127,7 +1126,6 @@ pub trait Fn<Args> : FnMut<Args> {
11271126
#[lang="fn_mut"]
11281127
#[stable(feature = "rust1", since = "1.0.0")]
11291128
#[rustc_paren_sugar]
1130-
#[fundamental] // so that regex can rely that `&str: !FnMut`
11311129
pub trait FnMut<Args> : FnOnce<Args> {
11321130
/// This is called when the call operator is used.
11331131
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
@@ -1137,60 +1135,10 @@ pub trait FnMut<Args> : FnOnce<Args> {
11371135
#[lang="fn_once"]
11381136
#[stable(feature = "rust1", since = "1.0.0")]
11391137
#[rustc_paren_sugar]
1140-
#[fundamental] // so that regex can rely that `&str: !FnMut`
11411138
pub trait FnOnce<Args> {
11421139
/// The returned type after the call operator is used.
11431140
type Output;
11441141

11451142
/// This is called when the call operator is used.
11461143
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
11471144
}
1148-
1149-
#[cfg(not(stage0))]
1150-
mod impls {
1151-
use marker::Sized;
1152-
use super::{Fn, FnMut, FnOnce};
1153-
1154-
impl<'a,A,F:?Sized> Fn<A> for &'a F
1155-
where F : Fn<A>
1156-
{
1157-
extern "rust-call" fn call(&self, args: A) -> F::Output {
1158-
(**self).call(args)
1159-
}
1160-
}
1161-
1162-
impl<'a,A,F:?Sized> FnMut<A> for &'a F
1163-
where F : Fn<A>
1164-
{
1165-
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
1166-
(**self).call(args)
1167-
}
1168-
}
1169-
1170-
impl<'a,A,F:?Sized> FnOnce<A> for &'a F
1171-
where F : Fn<A>
1172-
{
1173-
type Output = F::Output;
1174-
1175-
extern "rust-call" fn call_once(self, args: A) -> F::Output {
1176-
(*self).call(args)
1177-
}
1178-
}
1179-
1180-
impl<'a,A,F:?Sized> FnMut<A> for &'a mut F
1181-
where F : FnMut<A>
1182-
{
1183-
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
1184-
(*self).call_mut(args)
1185-
}
1186-
}
1187-
1188-
impl<'a,A,F:?Sized> FnOnce<A> for &'a mut F
1189-
where F : FnMut<A>
1190-
{
1191-
type Output = F::Output;
1192-
extern "rust-call" fn call_once(mut self, args: A) -> F::Output {
1193-
(*self).call_mut(args)
1194-
}
1195-
}
1196-
}

trunk/src/librustc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ pub mod middle {
120120
pub mod traits;
121121
pub mod ty;
122122
pub mod ty_fold;
123-
pub mod ty_match;
124-
pub mod ty_relate;
125123
pub mod ty_walk;
126124
pub mod weak_lang_items;
127125
}

trunk/src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ use std::io::prelude::*;
3434
use std::io::{Cursor, SeekFrom};
3535
use syntax::abi;
3636
use syntax::ast::{self, DefId, NodeId};
37-
use syntax::ast_map::{self, LinkedPath, PathElem, PathElems};
37+
use syntax::ast_map::{PathElem, PathElems};
38+
use syntax::ast_map;
3839
use syntax::ast_util::*;
3940
use syntax::ast_util;
4041
use syntax::attr;
@@ -1512,7 +1513,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
15121513
&krate.module,
15131514
&[],
15141515
ast::CRATE_NODE_ID,
1515-
[].iter().cloned().chain(LinkedPath::empty()),
1516+
[].iter().cloned().chain(None),
15161517
syntax::parse::token::special_idents::invalid,
15171518
ast::Public);
15181519

@@ -1873,7 +1874,7 @@ fn encode_misc_info(ecx: &EncodeContext,
18731874
}
18741875

18751876
// Encode reexports for the root module.
1876-
encode_reexports(ecx, rbml_w, 0, [].iter().cloned().chain(LinkedPath::empty()));
1877+
encode_reexports(ecx, rbml_w, 0, [].iter().cloned().chain(None));
18771878

18781879
rbml_w.end_tag();
18791880
rbml_w.end_tag();

trunk/src/librustc/middle/dataflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
108108
pprust::NodeIdent(_) | pprust::NodeName(_) => 0,
109109
pprust::NodeExpr(expr) => expr.id,
110110
pprust::NodeBlock(blk) => blk.id,
111-
pprust::NodeItem(_) | pprust::NodeSubItem(_) => 0,
111+
pprust::NodeItem(_) => 0,
112112
pprust::NodePat(pat) => pat.id
113113
};
114114

0 commit comments

Comments
 (0)