Skip to content

Commit 2876b30

Browse files
committed
---
yaml --- r: 207094 b: refs/heads/auto c: e30909d h: refs/heads/master v: v3
1 parent 37b0409 commit 2876b30

File tree

81 files changed

+313
-1441
lines changed

Some content is hidden

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

81 files changed

+313
-1441
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: e8d29a9cfba395df58cf4695d4d68d0e42e1b1f3
13+
refs/heads/auto: e30909de1149d72ce4729481581baa08264c9d8b
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
######################################################################
1414

1515
# The version number
16-
CFG_RELEASE_NUM=1.2.0
16+
CFG_RELEASE_NUM=1.1.0
1717

1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release

branches/auto/src/doc/complement-design-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ feature.
7979
A nice replacement is the [lazy constructor macro][lcm] by [Marvin
8080
Löbel][kim].
8181

82-
[fqa]: http://yosefk.com/c++fqa/ctors.html#fqa-10.12
82+
[fqa]: https://mail.mozilla.org/pipermail/rust-dev/2013-April/003815.html
8383
[elp]: http://ericlippert.com/2013/02/06/static-constructors-part-one/
8484
[lcm]: https://gist.github.com/Kimundi/8782487
8585
[kim]: https://github.com/Kimundi

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ static N: i32 = 5;
3131

3232
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3333

34+
[let]: variable-bindings.html
35+
3436
Statics live for the entire lifetime of a program, and therefore any
35-
reference stored in a constant has a [`'static` lifetime][lifetimes]:
37+
reference stored in a constant has a [`static` lifetime][lifetimes]:
3638

3739
```rust
3840
static NAME: &'static str = "Steve";

branches/auto/src/doc/trpl/method-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn main() {
156156

157157
This ‘associated function’ builds a new `Circle` for us. Note that associated
158158
functions are called with the `Struct::function()` syntax, rather than the
159-
`ref.method()` syntax. Some other languages call associated functions ‘static
159+
`ref.method()` syntax. Some other langauges call associated functions ‘static
160160
methods’.
161161

162162
# Builder Pattern

branches/auto/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ end
217217

218218
Hello.process
219219

220-
puts "done!"
220+
puts "done!
221221
```
222222
223223
Before we can run this, we need to install the `ffi` gem:

branches/auto/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ let result = f.write("whatever".as_bytes());
208208

209209
This will compile without error.
210210

211-
This means that even if someone does something bad like add methods to `i32`,
211+
This means that even if someone does something bad like add methods to `int`,
212212
it won’t affect you, unless you `use` that trait.
213213

214214
There’s one more restriction on implementing traits. Either the trait or the

branches/auto/src/grammar/verify.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,11 @@ fn main() {
287287
let options = config::basic_options();
288288
let session = session::build_session(options, None,
289289
syntax::diagnostics::registry::Registry::new(&[]));
290-
let filemap = session.parse_sess.codemap().new_filemap(String::from_str("<n/a>"), code);
290+
let filemap = parse::string_to_filemap(&session.parse_sess,
291+
code,
292+
String::from_str("<n/a>"));
291293
let mut lexer = lexer::StringReader::new(session.diagnostic(), filemap);
292-
let cm = session.codemap();
294+
let ref cm = lexer.span_diagnostic.cm;
293295

294296
// ANTLR
295297
let mut token_file = File::open(&Path::new(&args.next().unwrap())).unwrap();

branches/auto/src/liballoc/arc.rs

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,11 @@ use core::atomic;
7777
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
7878
use core::fmt;
7979
use core::cmp::Ordering;
80-
use core::mem::{min_align_of_val, size_of_val};
81-
use core::intrinsics::drop_in_place;
80+
use core::mem::{min_align_of, size_of};
8281
use core::mem;
8382
use core::nonzero::NonZero;
84-
use core::ops::{Deref, CoerceUnsized};
85-
use core::marker::Unsize;
83+
use core::ops::Deref;
84+
use core::ptr;
8685
use core::hash::{Hash, Hasher};
8786
use heap::deallocate;
8887

@@ -119,16 +118,15 @@ use heap::deallocate;
119118
/// ```
120119
#[unsafe_no_drop_flag]
121120
#[stable(feature = "rust1", since = "1.0.0")]
122-
pub struct Arc<T: ?Sized> {
121+
pub struct Arc<T> {
123122
// FIXME #12808: strange name to try to avoid interfering with
124123
// field accesses of the contained type via Deref
125124
_ptr: NonZero<*mut ArcInner<T>>,
126125
}
127126

128-
unsafe impl<T: ?Sized + Sync + Send> Send for Arc<T> { }
129-
unsafe impl<T: ?Sized + Sync + Send> Sync for Arc<T> { }
127+
unsafe impl<T: Sync + Send> Send for Arc<T> { }
128+
unsafe impl<T: Sync + Send> Sync for Arc<T> { }
130129

131-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
132130

133131
/// A weak pointer to an `Arc`.
134132
///
@@ -137,30 +135,30 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
137135
#[unsafe_no_drop_flag]
138136
#[unstable(feature = "alloc",
139137
reason = "Weak pointers may not belong in this module.")]
140-
pub struct Weak<T: ?Sized> {
138+
pub struct Weak<T> {
141139
// FIXME #12808: strange name to try to avoid interfering with
142140
// field accesses of the contained type via Deref
143141
_ptr: NonZero<*mut ArcInner<T>>,
144142
}
145143

146-
unsafe impl<T: ?Sized + Sync + Send> Send for Weak<T> { }
147-
unsafe impl<T: ?Sized + Sync + Send> Sync for Weak<T> { }
144+
unsafe impl<T: Sync + Send> Send for Weak<T> { }
145+
unsafe impl<T: Sync + Send> Sync for Weak<T> { }
148146

149147
#[stable(feature = "rust1", since = "1.0.0")]
150-
impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
148+
impl<T: fmt::Debug> fmt::Debug for Weak<T> {
151149
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
152150
write!(f, "(Weak)")
153151
}
154152
}
155153

156-
struct ArcInner<T: ?Sized> {
154+
struct ArcInner<T> {
157155
strong: atomic::AtomicUsize,
158156
weak: atomic::AtomicUsize,
159157
data: T,
160158
}
161159

162-
unsafe impl<T: ?Sized + Sync + Send> Send for ArcInner<T> {}
163-
unsafe impl<T: ?Sized + Sync + Send> Sync for ArcInner<T> {}
160+
unsafe impl<T: Sync + Send> Send for ArcInner<T> {}
161+
unsafe impl<T: Sync + Send> Sync for ArcInner<T> {}
164162

165163
impl<T> Arc<T> {
166164
/// Constructs a new `Arc<T>`.
@@ -184,9 +182,7 @@ impl<T> Arc<T> {
184182
};
185183
Arc { _ptr: unsafe { NonZero::new(mem::transmute(x)) } }
186184
}
187-
}
188185

189-
impl<T: ?Sized> Arc<T> {
190186
/// Downgrades the `Arc<T>` to a `Weak<T>` reference.
191187
///
192188
/// # Examples
@@ -208,7 +204,7 @@ impl<T: ?Sized> Arc<T> {
208204
}
209205
}
210206

211-
impl<T: ?Sized> Arc<T> {
207+
impl<T> Arc<T> {
212208
#[inline]
213209
fn inner(&self) -> &ArcInner<T> {
214210
// This unsafety is ok because while this arc is alive we're guaranteed
@@ -226,24 +222,24 @@ impl<T: ?Sized> Arc<T> {
226222

227223
// Destroy the data at this time, even though we may not free the box
228224
// allocation itself (there may still be weak pointers lying around).
229-
drop_in_place(&mut (*ptr).data);
225+
drop(ptr::read(&self.inner().data));
230226

231227
if self.inner().weak.fetch_sub(1, Release) == 1 {
232228
atomic::fence(Acquire);
233-
deallocate(ptr as *mut u8, size_of_val(&*ptr), min_align_of_val(&*ptr))
229+
deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(), min_align_of::<ArcInner<T>>())
234230
}
235231
}
236232
}
237233

238234
/// Get the number of weak references to this value.
239235
#[inline]
240236
#[unstable(feature = "alloc")]
241-
pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 }
237+
pub fn weak_count<T>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 }
242238

243239
/// Get the number of strong references to this value.
244240
#[inline]
245241
#[unstable(feature = "alloc")]
246-
pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
242+
pub fn strong_count<T>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
247243

248244

249245
/// Returns a mutable reference to the contained value if the `Arc<T>` is unique.
@@ -268,7 +264,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
268264
/// ```
269265
#[inline]
270266
#[unstable(feature = "alloc")]
271-
pub fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
267+
pub fn get_mut<T>(this: &mut Arc<T>) -> Option<&mut T> {
272268
if strong_count(this) == 1 && weak_count(this) == 0 {
273269
// This unsafety is ok because we're guaranteed that the pointer
274270
// returned is the *only* pointer that will ever be returned to T. Our
@@ -283,7 +279,7 @@ pub fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
283279
}
284280

285281
#[stable(feature = "rust1", since = "1.0.0")]
286-
impl<T: ?Sized> Clone for Arc<T> {
282+
impl<T> Clone for Arc<T> {
287283
/// Makes a clone of the `Arc<T>`.
288284
///
289285
/// This increases the strong reference count.
@@ -317,7 +313,7 @@ impl<T: ?Sized> Clone for Arc<T> {
317313
}
318314

319315
#[stable(feature = "rust1", since = "1.0.0")]
320-
impl<T: ?Sized> Deref for Arc<T> {
316+
impl<T> Deref for Arc<T> {
321317
type Target = T;
322318

323319
#[inline]
@@ -360,7 +356,7 @@ impl<T: Clone> Arc<T> {
360356
}
361357

362358
#[stable(feature = "rust1", since = "1.0.0")]
363-
impl<T: ?Sized> Drop for Arc<T> {
359+
impl<T> Drop for Arc<T> {
364360
/// Drops the `Arc<T>`.
365361
///
366362
/// This will decrement the strong reference count. If the strong reference
@@ -394,7 +390,7 @@ impl<T: ?Sized> Drop for Arc<T> {
394390
// it's run more than once)
395391
let ptr = *self._ptr;
396392
// if ptr.is_null() { return }
397-
if ptr as usize == 0 || ptr as usize == mem::POST_DROP_USIZE { return }
393+
if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
398394

399395
// Because `fetch_sub` is already atomic, we do not need to synchronize
400396
// with other threads unless we are going to delete the object. This
@@ -428,7 +424,7 @@ impl<T: ?Sized> Drop for Arc<T> {
428424

429425
#[unstable(feature = "alloc",
430426
reason = "Weak pointers may not belong in this module.")]
431-
impl<T: ?Sized> Weak<T> {
427+
impl<T> Weak<T> {
432428
/// Upgrades a weak reference to a strong reference.
433429
///
434430
/// Upgrades the `Weak<T>` reference to an `Arc<T>`, if possible.
@@ -469,7 +465,7 @@ impl<T: ?Sized> Weak<T> {
469465

470466
#[unstable(feature = "alloc",
471467
reason = "Weak pointers may not belong in this module.")]
472-
impl<T: ?Sized> Clone for Weak<T> {
468+
impl<T> Clone for Weak<T> {
473469
/// Makes a clone of the `Weak<T>`.
474470
///
475471
/// This increases the weak reference count.
@@ -493,7 +489,7 @@ impl<T: ?Sized> Clone for Weak<T> {
493489
}
494490

495491
#[stable(feature = "rust1", since = "1.0.0")]
496-
impl<T: ?Sized> Drop for Weak<T> {
492+
impl<T> Drop for Weak<T> {
497493
/// Drops the `Weak<T>`.
498494
///
499495
/// This will decrement the weak reference count.
@@ -524,22 +520,21 @@ impl<T: ?Sized> Drop for Weak<T> {
524520
let ptr = *self._ptr;
525521

526522
// see comments above for why this check is here
527-
if ptr as usize == 0 || ptr as usize == mem::POST_DROP_USIZE { return }
523+
if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
528524

529525
// If we find out that we were the last weak pointer, then its time to
530526
// deallocate the data entirely. See the discussion in Arc::drop() about
531527
// the memory orderings
532528
if self.inner().weak.fetch_sub(1, Release) == 1 {
533529
atomic::fence(Acquire);
534-
unsafe { deallocate(ptr as *mut u8,
535-
size_of_val(&*ptr),
536-
min_align_of_val(&*ptr)) }
530+
unsafe { deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(),
531+
min_align_of::<ArcInner<T>>()) }
537532
}
538533
}
539534
}
540535

541536
#[stable(feature = "rust1", since = "1.0.0")]
542-
impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
537+
impl<T: PartialEq> PartialEq for Arc<T> {
543538
/// Equality for two `Arc<T>`s.
544539
///
545540
/// Two `Arc<T>`s are equal if their inner value are equal.
@@ -571,7 +566,7 @@ impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
571566
fn ne(&self, other: &Arc<T>) -> bool { *(*self) != *(*other) }
572567
}
573568
#[stable(feature = "rust1", since = "1.0.0")]
574-
impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {
569+
impl<T: PartialOrd> PartialOrd for Arc<T> {
575570
/// Partial comparison for two `Arc<T>`s.
576571
///
577572
/// The two are compared by calling `partial_cmp()` on their inner values.
@@ -650,21 +645,21 @@ impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {
650645
fn ge(&self, other: &Arc<T>) -> bool { *(*self) >= *(*other) }
651646
}
652647
#[stable(feature = "rust1", since = "1.0.0")]
653-
impl<T: ?Sized + Ord> Ord for Arc<T> {
648+
impl<T: Ord> Ord for Arc<T> {
654649
fn cmp(&self, other: &Arc<T>) -> Ordering { (**self).cmp(&**other) }
655650
}
656651
#[stable(feature = "rust1", since = "1.0.0")]
657-
impl<T: ?Sized + Eq> Eq for Arc<T> {}
652+
impl<T: Eq> Eq for Arc<T> {}
658653

659654
#[stable(feature = "rust1", since = "1.0.0")]
660-
impl<T: ?Sized + fmt::Display> fmt::Display for Arc<T> {
655+
impl<T: fmt::Display> fmt::Display for Arc<T> {
661656
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
662657
fmt::Display::fmt(&**self, f)
663658
}
664659
}
665660

666661
#[stable(feature = "rust1", since = "1.0.0")]
667-
impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
662+
impl<T: fmt::Debug> fmt::Debug for Arc<T> {
668663
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
669664
fmt::Debug::fmt(&**self, f)
670665
}
@@ -684,7 +679,7 @@ impl<T: Default> Default for Arc<T> {
684679
}
685680

686681
#[stable(feature = "rust1", since = "1.0.0")]
687-
impl<T: ?Sized + Hash> Hash for Arc<T> {
682+
impl<T: Hash> Hash for Arc<T> {
688683
fn hash<H: Hasher>(&self, state: &mut H) {
689684
(**self).hash(state)
690685
}
@@ -911,13 +906,4 @@ mod tests {
911906
// Make sure deriving works with Arc<T>
912907
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Default)]
913908
struct Foo { inner: Arc<i32> }
914-
915-
#[test]
916-
fn test_unsized() {
917-
let x: Arc<[i32]> = Arc::new([1, 2, 3]);
918-
assert_eq!(format!("{:?}", x), "[1, 2, 3]");
919-
let y = x.clone().downgrade();
920-
drop(x);
921-
assert!(y.upgrade().is_none());
922-
}
923909
}

0 commit comments

Comments
 (0)