Skip to content

Commit f6761c9

Browse files
committed
---
yaml --- r: 162417 b: refs/heads/try c: d13aff1 h: refs/heads/master i: 162415: 00f2d53 v: v3
1 parent 616dcb9 commit f6761c9

Some content is hidden

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

63 files changed

+1068
-654
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: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
5-
refs/heads/try: 7a372e23cbab0be6abd3fbd321d0548640568920
5+
refs/heads/try: d13aff12246ab3c72b0c5f186400a21f825c0a6c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub trait VectorVector<T> for Sized? {
121121
fn connect_vec(&self, sep: &T) -> Vec<T>;
122122
}
123123

124-
impl<T: Clone, V: AsSlice<T>> VectorVector<T> for [V] {
124+
impl<'a, T: Clone, V: AsSlice<T>> VectorVector<T> for [V] {
125125
fn concat_vec(&self) -> Vec<T> {
126126
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
127127
let mut result = Vec::with_capacity(size);

branches/try/src/libcollections/vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use core::cmp::max;
2020
use core::default::Default;
2121
use core::fmt;
2222
use core::kinds::marker::{ContravariantLifetime, InvariantType};
23+
use core::kinds::Sized;
2324
use core::mem;
2425
use core::num::{Int, UnsignedInt};
2526
use core::ops;
@@ -516,7 +517,7 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
516517
impl<T: Eq> Eq for Vec<T> {}
517518

518519
#[experimental]
519-
impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for Vec<T> {
520+
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for Vec<T> {
520521
#[inline]
521522
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
522523
}
@@ -1181,7 +1182,7 @@ impl<T> AsSlice<T> for Vec<T> {
11811182
}
11821183
}
11831184

1184-
impl<T: Clone, V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
1185+
impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
11851186
#[inline]
11861187
fn add(&self, rhs: &V) -> Vec<T> {
11871188
let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());

branches/try/src/libcore/cmp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub trait PartialOrd for Sized?: PartialEq {
241241
/// container types; e.g. it is often desirable to be able to use `&str`
242242
/// values to look up entries in a container with `String` keys.
243243
#[experimental = "Better solutions may be discovered."]
244-
pub trait Equiv<T> for Sized? {
244+
pub trait Equiv<Sized? T> for Sized? {
245245
/// Implement this function to decide equivalent values.
246246
fn equiv(&self, other: &T) -> bool;
247247
}

branches/try/src/libcore/ops.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub trait Drop {
112112
* ```
113113
*/
114114
#[lang="add"]
115-
pub trait Add<RHS,Result> {
115+
pub trait Add<Sized? RHS,Result> for Sized? {
116116
/// The method for the `+` operator
117117
fn add(&self, rhs: &RHS) -> Result;
118118
}
@@ -153,7 +153,7 @@ add_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
153153
* ```
154154
*/
155155
#[lang="sub"]
156-
pub trait Sub<RHS,Result> {
156+
pub trait Sub<Sized? RHS, Result> for Sized? {
157157
/// The method for the `-` operator
158158
fn sub(&self, rhs: &RHS) -> Result;
159159
}
@@ -194,7 +194,7 @@ sub_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
194194
* ```
195195
*/
196196
#[lang="mul"]
197-
pub trait Mul<RHS,Result> {
197+
pub trait Mul<Sized? RHS, Result> for Sized? {
198198
/// The method for the `*` operator
199199
fn mul(&self, rhs: &RHS) -> Result;
200200
}
@@ -235,7 +235,7 @@ mul_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
235235
* ```
236236
*/
237237
#[lang="div"]
238-
pub trait Div<RHS,Result> {
238+
pub trait Div<Sized? RHS, Result> for Sized? {
239239
/// The method for the `/` operator
240240
fn div(&self, rhs: &RHS) -> Result;
241241
}
@@ -276,7 +276,7 @@ div_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
276276
* ```
277277
*/
278278
#[lang="rem"]
279-
pub trait Rem<RHS,Result> {
279+
pub trait Rem<Sized? RHS, Result> for Sized? {
280280
/// The method for the `%` operator
281281
fn rem(&self, rhs: &RHS) -> Result;
282282
}
@@ -331,7 +331,7 @@ rem_float_impl!(f64, fmod)
331331
* ```
332332
*/
333333
#[lang="neg"]
334-
pub trait Neg<Result> {
334+
pub trait Neg<Result> for Sized? {
335335
/// The method for the unary `-` operator
336336
fn neg(&self) -> Result;
337337
}
@@ -388,7 +388,7 @@ neg_uint_impl!(u64, i64)
388388
* ```
389389
*/
390390
#[lang="not"]
391-
pub trait Not<Result> {
391+
pub trait Not<Result> for Sized? {
392392
/// The method for the unary `!` operator
393393
fn not(&self) -> Result;
394394
}
@@ -430,7 +430,7 @@ not_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
430430
* ```
431431
*/
432432
#[lang="bitand"]
433-
pub trait BitAnd<RHS,Result> {
433+
pub trait BitAnd<Sized? RHS, Result> for Sized? {
434434
/// The method for the `&` operator
435435
fn bitand(&self, rhs: &RHS) -> Result;
436436
}
@@ -471,7 +471,7 @@ bitand_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
471471
* ```
472472
*/
473473
#[lang="bitor"]
474-
pub trait BitOr<RHS,Result> {
474+
pub trait BitOr<Sized? RHS, Result> for Sized? {
475475
/// The method for the `|` operator
476476
fn bitor(&self, rhs: &RHS) -> Result;
477477
}
@@ -512,7 +512,7 @@ bitor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
512512
* ```
513513
*/
514514
#[lang="bitxor"]
515-
pub trait BitXor<RHS,Result> {
515+
pub trait BitXor<Sized? RHS, Result> for Sized? {
516516
/// The method for the `^` operator
517517
fn bitxor(&self, rhs: &RHS) -> Result;
518518
}
@@ -553,7 +553,7 @@ bitxor_impl!(bool uint u8 u16 u32 u64 int i8 i16 i32 i64)
553553
* ```
554554
*/
555555
#[lang="shl"]
556-
pub trait Shl<RHS,Result> {
556+
pub trait Shl<Sized? RHS, Result> for Sized? {
557557
/// The method for the `<<` operator
558558
fn shl(&self, rhs: &RHS) -> Result;
559559
}
@@ -596,7 +596,7 @@ shl_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
596596
* ```
597597
*/
598598
#[lang="shr"]
599-
pub trait Shr<RHS,Result> {
599+
pub trait Shr<Sized? RHS, Result> for Sized? {
600600
/// The method for the `>>` operator
601601
fn shr(&self, rhs: &RHS) -> Result;
602602
}
@@ -669,7 +669,7 @@ pub trait Index<Sized? Index, Sized? Result> for Sized? {
669669
* ```
670670
*/
671671
#[lang="index_mut"]
672-
pub trait IndexMut<Sized? Index, Result> for Sized? {
672+
pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
673673
/// The method for the indexing (`Foo[Bar]`) operation
674674
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
675675
}
@@ -712,7 +712,7 @@ pub trait IndexMut<Sized? Index, Result> for Sized? {
712712
* ```
713713
*/
714714
#[lang="slice"]
715-
pub trait Slice<Idx, Sized? Result> for Sized? {
715+
pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
716716
/// The method for the slicing operation foo[]
717717
fn as_slice_<'a>(&'a self) -> &'a Result;
718718
/// The method for the slicing operation foo[from..]
@@ -761,7 +761,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
761761
* ```
762762
*/
763763
#[lang="slice_mut"]
764-
pub trait SliceMut<Idx, Sized? Result> for Sized? {
764+
pub trait SliceMut<Sized? Idx, Sized? Result> for Sized? {
765765
/// The method for the slicing operation foo[]
766766
fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Result;
767767
/// The method for the slicing operation foo[from..]
@@ -800,7 +800,7 @@ pub trait SliceMut<Idx, Sized? Result> for Sized? {
800800
* ```
801801
*/
802802
#[lang="deref"]
803-
pub trait Deref<Sized? Result> {
803+
pub trait Deref<Sized? Result> for Sized? {
804804
/// The method called to dereference a value
805805
fn deref<'a>(&'a self) -> &'a Result;
806806
}
@@ -859,21 +859,21 @@ impl<'a, Sized? T> DerefMut<T> for &'a mut T {
859859

860860
/// A version of the call operator that takes an immutable receiver.
861861
#[lang="fn"]
862-
pub trait Fn<Args,Result> {
862+
pub trait Fn<Args,Result> for Sized? {
863863
/// This is called when the call operator is used.
864864
extern "rust-call" fn call(&self, args: Args) -> Result;
865865
}
866866

867867
/// A version of the call operator that takes a mutable receiver.
868868
#[lang="fn_mut"]
869-
pub trait FnMut<Args,Result> {
869+
pub trait FnMut<Args,Result> for Sized? {
870870
/// This is called when the call operator is used.
871871
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
872872
}
873873

874874
/// A version of the call operator that takes a by-value receiver.
875875
#[lang="fn_once"]
876-
pub trait FnOnce<Args,Result> {
876+
pub trait FnOnce<Args,Result> for Sized? {
877877
/// This is called when the call operator is used.
878878
extern "rust-call" fn call_once(self, args: Args) -> Result;
879879
}

branches/try/src/libcore/slice.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,25 @@ impl<T: Clone> CloneSlicePrelude<T> for [T] {
10081008

10091009
/// Data that is viewable as a slice.
10101010
#[unstable = "may merge with other traits"]
1011-
pub trait AsSlice<T> {
1011+
pub trait AsSlice<T> for Sized? {
10121012
/// Work with `self` as a slice.
10131013
fn as_slice<'a>(&'a self) -> &'a [T];
10141014
}
10151015

10161016
#[unstable = "trait is unstable"]
1017-
impl<'a,T> AsSlice<T> for &'a [T] {
1017+
impl<T> AsSlice<T> for [T] {
10181018
#[inline(always)]
1019-
fn as_slice<'a>(&'a self) -> &'a [T] { *self }
1019+
fn as_slice<'a>(&'a self) -> &'a [T] { self }
1020+
}
1021+
1022+
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a U {
1023+
#[inline(always)]
1024+
fn as_slice<'a>(&'a self) -> &'a [T] { AsSlice::as_slice(*self) }
1025+
}
1026+
1027+
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a mut U {
1028+
#[inline(always)]
1029+
fn as_slice<'a>(&'a self) -> &'a [T] { AsSlice::as_slice(*self) }
10201030
}
10211031

10221032
#[unstable = "waiting for DST"]
@@ -1681,13 +1691,13 @@ impl<T: PartialEq> PartialEq for [T] {
16811691
impl<T: Eq> Eq for [T] {}
16821692

16831693
#[unstable = "waiting for DST"]
1684-
impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for [T] {
1694+
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for [T] {
16851695
#[inline]
16861696
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
16871697
}
16881698

16891699
#[unstable = "waiting for DST"]
1690-
impl<'a,T:PartialEq, V: AsSlice<T>> Equiv<V> for &'a mut [T] {
1700+
impl<'a,T:PartialEq, Sized? V: AsSlice<T>> Equiv<V> for &'a mut [T] {
16911701
#[inline]
16921702
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
16931703
}

branches/try/src/libgraphviz/maybe_owned_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> {
8989
}
9090
}
9191

92-
impl<'a, T: PartialEq, V: AsSlice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
92+
impl<'a, T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
9393
fn equiv(&self, other: &V) -> bool {
9494
self.as_slice() == other.as_slice()
9595
}

branches/try/src/librustc/metadata/tydecode.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
pub use self::DefIdSource::*;
2020

21+
use middle::region;
2122
use middle::subst;
2223
use middle::subst::VecPerParamSpace;
2324
use middle::ty::{mod, Ty};
@@ -315,17 +316,17 @@ fn parse_region(st: &mut PState, conv: conv_did) -> ty::Region {
315316
}
316317
'f' => {
317318
assert_eq!(next(st), '[');
318-
let id = parse_uint(st) as ast::NodeId;
319+
let scope = parse_scope(st);
319320
assert_eq!(next(st), '|');
320321
let br = parse_bound_region(st, |x,y| conv(x,y));
321322
assert_eq!(next(st), ']');
322-
ty::ReFree(ty::FreeRegion {scope_id: id,
323+
ty::ReFree(ty::FreeRegion { scope: scope,
323324
bound_region: br})
324325
}
325326
's' => {
326-
let id = parse_uint(st) as ast::NodeId;
327+
let scope = parse_scope(st);
327328
assert_eq!(next(st), '|');
328-
ty::ReScope(id)
329+
ty::ReScope(scope)
329330
}
330331
't' => {
331332
ty::ReStatic
@@ -337,6 +338,16 @@ fn parse_region(st: &mut PState, conv: conv_did) -> ty::Region {
337338
}
338339
}
339340

341+
fn parse_scope(st: &mut PState) -> region::CodeExtent {
342+
match next(st) {
343+
'M' => {
344+
let node_id = parse_uint(st) as ast::NodeId;
345+
region::CodeExtent::Misc(node_id)
346+
}
347+
_ => panic!("parse_scope: bad input")
348+
}
349+
}
350+
340351
fn parse_opt<'a, 'tcx, T>(st: &mut PState<'a, 'tcx>, f: |&mut PState<'a, 'tcx>| -> T)
341352
-> Option<T> {
342353
match next(st) {

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use std::cell::RefCell;
1717

18+
use middle::region;
1819
use middle::subst;
1920
use middle::subst::VecPerParamSpace;
2021
use middle::ty::ParamTy;
@@ -143,12 +144,16 @@ pub fn enc_region(w: &mut SeekableMemWriter, cx: &ctxt, r: ty::Region) {
143144
token::get_name(name));
144145
}
145146
ty::ReFree(ref fr) => {
146-
mywrite!(w, "f[{}|", fr.scope_id);
147+
mywrite!(w, "f[");
148+
enc_scope(w, cx, fr.scope);
149+
mywrite!(w, "|");
147150
enc_bound_region(w, cx, fr.bound_region);
148151
mywrite!(w, "]");
149152
}
150-
ty::ReScope(nid) => {
151-
mywrite!(w, "s{}|", nid);
153+
ty::ReScope(scope) => {
154+
mywrite!(w, "s");
155+
enc_scope(w, cx, scope);
156+
mywrite!(w, "|");
152157
}
153158
ty::ReStatic => {
154159
mywrite!(w, "t");
@@ -163,6 +168,12 @@ pub fn enc_region(w: &mut SeekableMemWriter, cx: &ctxt, r: ty::Region) {
163168
}
164169
}
165170

171+
fn enc_scope(w: &mut SeekableMemWriter, _cx: &ctxt, scope: region::CodeExtent) {
172+
match scope {
173+
region::CodeExtent::Misc(node_id) => mywrite!(w, "M{}", node_id)
174+
}
175+
}
176+
166177
fn enc_bound_region(w: &mut SeekableMemWriter, cx: &ctxt, br: ty::BoundRegion) {
167178
match br {
168179
ty::BrAnon(idx) => {

0 commit comments

Comments
 (0)