Skip to content

Commit 96009d3

Browse files
committed
---
yaml --- r: 159871 b: refs/heads/try c: 1fdb759 h: refs/heads/master i: 159869: f3bed4d 159867: 039929e 159863: c855f9f 159855: 7db24f0 159839: 32e73ac 159807: c71dcf2 159743: 7152e79 v: v3
1 parent 8d813a7 commit 96009d3

File tree

13 files changed

+45
-149
lines changed

13 files changed

+45
-149
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: e09d98603e608c9e47d4c89f7b4dca87a4b56da3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9c96a79a74f10bed18b031ce0ac4126c56d6cfb3
5-
refs/heads/try: 97a57ec909e61ecabadfce11fb9b36b2fe3783df
5+
refs/heads/try: 1fdb7595278df6568cc73028a734ca7d0615e622
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
166166
// additional reference of either kind.
167167
if self.inner().strong.load(atomic::SeqCst) != 1 ||
168168
self.inner().weak.load(atomic::SeqCst) != 1 {
169-
*self = Arc::new((**self).clone())
169+
*self = Arc::new(self.deref().clone())
170170
}
171171
// This unsafety is ok because we're guaranteed that the pointer
172172
// returned is the *only* pointer that will ever be returned to T. Our

branches/try/src/libcollections/enum_set.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ pub trait CLike {
5252
}
5353

5454
fn bit<E:CLike>(e: &E) -> uint {
55-
1 << e.to_uint()
55+
let value = e.to_uint();
56+
assert!(value < ::core::uint::BITS);
57+
1 << value
5658
}
5759

5860
impl<E:CLike> EnumSet<E> {
@@ -378,4 +380,31 @@ mod test {
378380
let elems = e_subtract.iter().collect();
379381
assert_eq!(vec![A], elems)
380382
}
383+
384+
#[test]
385+
#[should_fail]
386+
fn test_overflow() {
387+
#[allow(dead_code)]
388+
#[repr(uint)]
389+
enum Bar {
390+
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
391+
V10, V11, V12, V13, V14, V15, V16, V17, V18, V19,
392+
V20, V21, V22, V23, V24, V25, V26, V27, V28, V29,
393+
V30, V31, V32, V33, V34, V35, V36, V37, V38, V39,
394+
V40, V41, V42, V43, V44, V45, V46, V47, V48, V49,
395+
V50, V51, V52, V53, V54, V55, V56, V57, V58, V59,
396+
V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
397+
}
398+
impl CLike for Bar {
399+
fn to_uint(&self) -> uint {
400+
*self as uint
401+
}
402+
403+
fn from_uint(v: uint) -> Bar {
404+
unsafe { mem::transmute(v) }
405+
}
406+
}
407+
let mut set = EnumSet::empty();
408+
set.add(V64);
409+
}
381410
}

branches/try/src/libcore/ops.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ shr_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
638638
* ```
639639
*/
640640
#[lang="index"]
641-
pub trait Index<Index, Sized? Result> for Sized? {
641+
pub trait Index<Index, Sized? Result> {
642642
/// The method for the indexing (`Foo[Bar]`) operation
643643
fn index<'a>(&'a self, index: &Index) -> &'a Result;
644644
}
@@ -669,7 +669,7 @@ pub trait Index<Index, Sized? Result> for Sized? {
669669
* ```
670670
*/
671671
#[lang="index_mut"]
672-
pub trait IndexMut<Index, Result> for Sized? {
672+
pub trait IndexMut<Index, Result> {
673673
/// The method for the indexing (`Foo[Bar]`) operation
674674
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
675675
}
@@ -805,16 +805,6 @@ pub trait Deref<Sized? Result> {
805805
fn deref<'a>(&'a self) -> &'a Result;
806806
}
807807

808-
#[cfg(not(stage0))]
809-
impl<'a, Sized? T> Deref<T> for &'a T {
810-
fn deref(&self) -> &T { *self }
811-
}
812-
813-
#[cfg(not(stage0))]
814-
impl<'a, Sized? T> Deref<T> for &'a mut T {
815-
fn deref(&self) -> &T { *self }
816-
}
817-
818808
/**
819809
*
820810
* The `DerefMut` trait is used to specify the functionality of dereferencing
@@ -855,11 +845,6 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
855845
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
856846
}
857847

858-
#[cfg(not(stage0))]
859-
impl<'a, Sized? T> DerefMut<T> for &'a mut T {
860-
fn deref_mut(&mut self) -> &mut T { *self }
861-
}
862-
863848
/// A version of the call operator that takes an immutable receiver.
864849
#[lang="fn"]
865850
pub trait Fn<Args,Result> {

branches/try/src/libcore/slice.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ pub trait SlicePrelude<T> for Sized? {
256256
#[inline]
257257
#[experimental = "not triaged yet"]
258258
fn is_empty(&self) -> bool { self.len() == 0 }
259+
259260
/// Returns a mutable reference to the element at the given index,
260261
/// or `None` if the index is out of bounds
261262
#[unstable = "waiting on final error conventions"]
@@ -697,22 +698,6 @@ impl<T> SlicePrelude<T> for [T] {
697698
}
698699
}
699700

700-
impl<T> ops::Index<uint, T> for [T] {
701-
fn index(&self, &index: &uint) -> &T {
702-
assert!(index < self.len());
703-
704-
unsafe { mem::transmute(self.repr().data.offset(index as int)) }
705-
}
706-
}
707-
708-
impl<T> ops::IndexMut<uint, T> for [T] {
709-
fn index_mut(&mut self, &index: &uint) -> &mut T {
710-
assert!(index < self.len());
711-
712-
unsafe { mem::transmute(self.repr().data.offset(index as int)) }
713-
}
714-
}
715-
716701
impl<T> ops::Slice<uint, [T]> for [T] {
717702
#[inline]
718703
fn as_slice_<'a>(&'a self) -> &'a [T] {

branches/try/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
448448
}
449449

450450
ast::ExprStruct(_, ref fields, ref base) => {
451-
let field_cfg = self.straightline(expr, pred, fields.iter().map(|f| &*f.expr));
452-
self.opt_expr(base, field_cfg)
451+
let base_exit = self.opt_expr(base, pred);
452+
self.straightline(expr, base_exit, fields.iter().map(|f| &*f.expr))
453453
}
454454

455455
ast::ExprRepeat(ref elem, ref count) => {

branches/try/src/librustc/middle/expr_use_visitor.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,6 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
672672
}
673673
}
674674

675-
// walk the with expression so that complex expressions
676-
// are properly handled.
677-
self.walk_expr(with_expr);
678-
679675
fn contains_field_named(field: &ty::field,
680676
fields: &Vec<ast::Field>)
681677
-> bool

branches/try/src/librustc/middle/typeck/check/method.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,18 +1702,13 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> {
17021702
PreferMutLvalue);
17031703
}
17041704
ast::ExprUnary(ast::UnDeref, ref base_expr) => {
1705-
// if this is an overloaded deref, then re-evaluate with
1706-
// a preference for mut
1707-
let method_call = MethodCall::expr(expr.id);
1708-
if self.fcx.inh.method_map.borrow().contains_key(&method_call) {
1709-
check::try_overloaded_deref(
1710-
self.fcx,
1711-
expr.span,
1712-
Some(method_call),
1713-
Some(&**base_expr),
1714-
self.fcx.expr_ty(&**base_expr),
1715-
PreferMutLvalue);
1716-
}
1705+
check::try_overloaded_deref(
1706+
self.fcx,
1707+
expr.span,
1708+
Some(MethodCall::expr(expr.id)),
1709+
Some(&**base_expr),
1710+
self.fcx.expr_ty(&**base_expr),
1711+
PreferMutLvalue);
17171712
}
17181713
_ => {}
17191714
}

branches/try/src/libstd/collections/hash/table.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,18 @@ impl<K, V> RawBucket<K, V> {
166166
}
167167

168168
// For parameterizing over mutability.
169-
170-
#[cfg(stage0)]
171169
impl<'t, K, V> Deref<RawTable<K, V>> for &'t RawTable<K, V> {
172170
fn deref(&self) -> &RawTable<K, V> {
173171
&**self
174172
}
175173
}
176174

177-
#[cfg(stage0)]
178175
impl<'t, K, V> Deref<RawTable<K, V>> for &'t mut RawTable<K, V> {
179176
fn deref(&self) -> &RawTable<K,V> {
180177
&**self
181178
}
182179
}
183180

184-
#[cfg(stage0)]
185181
impl<'t, K, V> DerefMut<RawTable<K, V>> for &'t mut RawTable<K, V> {
186182
fn deref_mut(&mut self) -> &mut RawTable<K,V> {
187183
&mut **self

branches/try/src/libstd/num/strconv.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ pub fn from_str_radix_float<T: Float>(src: &str, radix: uint) -> Option<T> {
451451
};
452452

453453
// The significand to accumulate
454-
let mut sig = if is_positive { _0 } else { -_0 };
454+
let mut sig = if is_positive { _0 } else { -_1 };
455455
// Necessary to detect overflow
456456
let mut prev_sig = sig;
457457
let mut cs = src.chars().enumerate();
@@ -647,22 +647,6 @@ mod test {
647647
let fe : Option<f32> = from_str_radix_float("1e40", 10);
648648
assert_eq!(fe, Some(Float::infinity()))
649649
}
650-
651-
#[test]
652-
fn test_from_str_radix_float() {
653-
let x1 : Option<f64> = from_str_radix_float("-123.456", 10);
654-
assert_eq!(x1, Some(-123.456));
655-
let x2 : Option<f32> = from_str_radix_float("123.456", 10);
656-
assert_eq!(x2, Some(123.456));
657-
let x3 : Option<f32> = from_str_radix_float("-0.0", 10);
658-
assert_eq!(x3, Some(-0.0));
659-
let x4 : Option<f32> = from_str_radix_float("0.0", 10);
660-
assert_eq!(x4, Some(0.0));
661-
let x4 : Option<f32> = from_str_radix_float("1.0", 10);
662-
assert_eq!(x4, Some(1.0));
663-
let x5 : Option<f32> = from_str_radix_float("-1.0", 10);
664-
assert_eq!(x5, Some(-1.0));
665-
}
666650
}
667651

668652
#[cfg(test)]

branches/try/src/test/compile-fail/walk-struct-literal-with.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

branches/try/src/test/run-pass/deref-mut-on-ref.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

branches/try/src/test/run-pass/deref-on-ref.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)