Skip to content

Commit c9f959a

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163819 b: refs/heads/master c: 0c9b6ae h: refs/heads/master i: 163817: 55883a6 163815: 21e81cf v: v3
1 parent 11fb1db commit c9f959a

File tree

3 files changed

+112
-109
lines changed

3 files changed

+112
-109
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: f07526a9990ab07983905fb5f383e62ae72242bc
2+
refs/heads/master: 0c9b6ae6a809e98e34f8f4a0513123be19d750c6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8443b09e361b96d1f9b7f45a65ed0d31c0e86e70
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42

trunk/src/doc/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,8 +3145,8 @@ as
31453145
```
31463146

31473147
Operators at the same precedence level are evaluated left-to-right. [Unary
3148-
operators](#unary-operator-expressions) have the same precedence level and are
3149-
stronger than any of the binary operators.
3148+
operators](#unary-operator-expressions) have the same precedence level and it
3149+
is stronger than any of the binary operators'.
31503150

31513151
### Grouped expressions
31523152

trunk/src/libcore/tuple/mod.rs

Lines changed: 109 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,28 @@ use default::Default;
7272
use option::Option;
7373
use option::Option::Some;
7474

75+
// FIXME(#19630) Remove this work-around
76+
macro_rules! e {
77+
($e:expr) => { $e }
78+
}
79+
7580
// macro for implementing n-ary tuple functions and operations
7681
macro_rules! tuple_impls {
7782
($(
7883
$Tuple:ident {
79-
$(($valN:ident, $refN:ident, $mutN:ident) -> $T:ident {
80-
($($x:ident),+) => $ret:expr
81-
})+
84+
$(($valN:ident, $refN:ident, $mutN:ident, $idx:tt) -> $T:ident)+
8285
}
8386
)+) => {
8487
$(
8588
#[allow(missing_docs)]
86-
#[stable]
89+
#[deprecated]
8790
pub trait $Tuple<$($T),+> {
8891
$(
89-
#[unstable = "may rename pending accessor naming conventions"]
92+
#[deprecated = "use tuple indexing: `tuple.N`"]
9093
fn $valN(self) -> $T;
91-
#[unstable = "may rename pending accessor naming conventions"]
94+
#[deprecated = "use tuple indexing: `&tuple.N`"]
9295
fn $refN<'a>(&'a self) -> &'a $T;
93-
#[unstable = "may rename pending accessor naming conventions"]
96+
#[deprecated = "use tuple indexing: `&mut tuple.N`"]
9497
fn $mutN<'a>(&'a mut self) -> &'a mut $T;
9598
)+
9699
}
@@ -99,43 +102,43 @@ macro_rules! tuple_impls {
99102
$(
100103
#[inline]
101104
#[allow(unused_variables)]
102-
#[unstable = "may rename pending accessor naming conventions"]
105+
#[deprecated = "use tuple indexing: `tuple.N`"]
103106
fn $valN(self) -> $T {
104-
let ($($x,)+) = self; $ret
107+
e!(self.$idx)
105108
}
106109

107110
#[inline]
108111
#[allow(unused_variables)]
109-
#[unstable = "may rename pending accessor naming conventions"]
112+
#[deprecated = "use tuple indexing: `&tuple.N`"]
110113
fn $refN<'a>(&'a self) -> &'a $T {
111-
let ($(ref $x,)+) = *self; $ret
114+
e!(&self.$idx)
112115
}
113116

114117
#[inline]
115118
#[allow(unused_variables)]
116-
#[unstable = "may rename pending accessor naming conventions"]
119+
#[deprecated = "use tuple indexing: &mut tuple.N"]
117120
fn $mutN<'a>(&'a mut self) -> &'a mut $T {
118-
let ($(ref mut $x,)+) = *self; $ret
121+
e!(&mut self.$idx)
119122
}
120123
)+
121124
}
122125

123126
#[unstable = "waiting for Clone to stabilize"]
124127
impl<$($T:Clone),+> Clone for ($($T,)+) {
125128
fn clone(&self) -> ($($T,)+) {
126-
($(self.$refN().clone(),)+)
129+
($(e!(self.$idx.clone()),)+)
127130
}
128131
}
129132

130133
#[unstable = "waiting for PartialEq to stabilize"]
131134
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
132135
#[inline]
133136
fn eq(&self, other: &($($T,)+)) -> bool {
134-
$(*self.$refN() == *other.$refN())&&+
137+
e!($(self.$idx == other.$idx)&&+)
135138
}
136139
#[inline]
137140
fn ne(&self, other: &($($T,)+)) -> bool {
138-
$(*self.$refN() != *other.$refN())||+
141+
e!($(self.$idx != other.$idx)||+)
139142
}
140143
}
141144

@@ -146,31 +149,31 @@ macro_rules! tuple_impls {
146149
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
147150
#[inline]
148151
fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> {
149-
lexical_partial_cmp!($(self.$refN(), other.$refN()),+)
152+
lexical_partial_cmp!($(self.$idx, other.$idx),+)
150153
}
151154
#[inline]
152155
fn lt(&self, other: &($($T,)+)) -> bool {
153-
lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
156+
lexical_ord!(lt, $(self.$idx, other.$idx),+)
154157
}
155158
#[inline]
156159
fn le(&self, other: &($($T,)+)) -> bool {
157-
lexical_ord!(le, $(self.$refN(), other.$refN()),+)
160+
lexical_ord!(le, $(self.$idx, other.$idx),+)
158161
}
159162
#[inline]
160163
fn ge(&self, other: &($($T,)+)) -> bool {
161-
lexical_ord!(ge, $(self.$refN(), other.$refN()),+)
164+
lexical_ord!(ge, $(self.$idx, other.$idx),+)
162165
}
163166
#[inline]
164167
fn gt(&self, other: &($($T,)+)) -> bool {
165-
lexical_ord!(gt, $(self.$refN(), other.$refN()),+)
168+
lexical_ord!(gt, $(self.$idx, other.$idx),+)
166169
}
167170
}
168171

169172
#[unstable = "waiting for Ord to stabilize"]
170173
impl<$($T:Ord),+> Ord for ($($T,)+) {
171174
#[inline]
172175
fn cmp(&self, other: &($($T,)+)) -> Ordering {
173-
lexical_cmp!($(self.$refN(), other.$refN()),+)
176+
lexical_cmp!($(self.$idx, other.$idx),+)
174177
}
175178
}
176179

@@ -191,134 +194,134 @@ macro_rules! tuple_impls {
191194
// a3, b3)` (and similarly for `lexical_cmp`)
192195
macro_rules! lexical_ord {
193196
($rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
194-
if *$a != *$b { lexical_ord!($rel, $a, $b) }
197+
if $a != $b { lexical_ord!($rel, $a, $b) }
195198
else { lexical_ord!($rel, $($rest_a, $rest_b),+) }
196199
};
197-
($rel: ident, $a:expr, $b:expr) => { (*$a) . $rel ($b) };
200+
($rel: ident, $a:expr, $b:expr) => { ($a) . $rel (& $b) };
198201
}
199202

200203
macro_rules! lexical_partial_cmp {
201204
($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
202-
match ($a).partial_cmp($b) {
205+
match ($a).partial_cmp(&$b) {
203206
Some(Equal) => lexical_partial_cmp!($($rest_a, $rest_b),+),
204207
ordering => ordering
205208
}
206209
};
207-
($a:expr, $b:expr) => { ($a).partial_cmp($b) };
210+
($a:expr, $b:expr) => { ($a).partial_cmp(&$b) };
208211
}
209212

210213
macro_rules! lexical_cmp {
211214
($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
212-
match ($a).cmp($b) {
215+
match ($a).cmp(&$b) {
213216
Equal => lexical_cmp!($($rest_a, $rest_b),+),
214217
ordering => ordering
215218
}
216219
};
217-
($a:expr, $b:expr) => { ($a).cmp($b) };
220+
($a:expr, $b:expr) => { ($a).cmp(&$b) };
218221
}
219222

220223
tuple_impls! {
221224
Tuple1 {
222-
(val0, ref0, mut0) -> A { (a) => a }
225+
(val0, ref0, mut0, 0) -> A
223226
}
224227
Tuple2 {
225-
(val0, ref0, mut0) -> A { (a, b) => a }
226-
(val1, ref1, mut1) -> B { (a, b) => b }
228+
(val0, ref0, mut0, 0) -> A
229+
(val1, ref1, mut1, 1) -> B
227230
}
228231
Tuple3 {
229-
(val0, ref0, mut0) -> A { (a, b, c) => a }
230-
(val1, ref1, mut1) -> B { (a, b, c) => b }
231-
(val2, ref2, mut2) -> C { (a, b, c) => c }
232+
(val0, ref0, mut0, 0) -> A
233+
(val1, ref1, mut1, 1) -> B
234+
(val2, ref2, mut2, 2) -> C
232235
}
233236
Tuple4 {
234-
(val0, ref0, mut0) -> A { (a, b, c, d) => a }
235-
(val1, ref1, mut1) -> B { (a, b, c, d) => b }
236-
(val2, ref2, mut2) -> C { (a, b, c, d) => c }
237-
(val3, ref3, mut3) -> D { (a, b, c, d) => d }
237+
(val0, ref0, mut0, 0) -> A
238+
(val1, ref1, mut1, 1) -> B
239+
(val2, ref2, mut2, 2) -> C
240+
(val3, ref3, mut3, 3) -> D
238241
}
239242
Tuple5 {
240-
(val0, ref0, mut0) -> A { (a, b, c, d, e) => a }
241-
(val1, ref1, mut1) -> B { (a, b, c, d, e) => b }
242-
(val2, ref2, mut2) -> C { (a, b, c, d, e) => c }
243-
(val3, ref3, mut3) -> D { (a, b, c, d, e) => d }
244-
(val4, ref4, mut4) -> E { (a, b, c, d, e) => e }
243+
(val0, ref0, mut0, 0) -> A
244+
(val1, ref1, mut1, 1) -> B
245+
(val2, ref2, mut2, 2) -> C
246+
(val3, ref3, mut3, 3) -> D
247+
(val4, ref4, mut4, 4) -> E
245248
}
246249
Tuple6 {
247-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f) => a }
248-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f) => b }
249-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f) => c }
250-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f) => d }
251-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f) => e }
252-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f) => f }
250+
(val0, ref0, mut0, 0) -> A
251+
(val1, ref1, mut1, 1) -> B
252+
(val2, ref2, mut2, 2) -> C
253+
(val3, ref3, mut3, 3) -> D
254+
(val4, ref4, mut4, 4) -> E
255+
(val5, ref5, mut5, 5) -> F
253256
}
254257
Tuple7 {
255-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g) => a }
256-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g) => b }
257-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g) => c }
258-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g) => d }
259-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g) => e }
260-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g) => f }
261-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g) => g }
258+
(val0, ref0, mut0, 0) -> A
259+
(val1, ref1, mut1, 1) -> B
260+
(val2, ref2, mut2, 2) -> C
261+
(val3, ref3, mut3, 3) -> D
262+
(val4, ref4, mut4, 4) -> E
263+
(val5, ref5, mut5, 5) -> F
264+
(val6, ref6, mut6, 6) -> G
262265
}
263266
Tuple8 {
264-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h) => a }
265-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h) => b }
266-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h) => c }
267-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h) => d }
268-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h) => e }
269-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h) => f }
270-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h) => g }
271-
(val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h) => h }
267+
(val0, ref0, mut0, 0) -> A
268+
(val1, ref1, mut1, 1) -> B
269+
(val2, ref2, mut2, 2) -> C
270+
(val3, ref3, mut3, 3) -> D
271+
(val4, ref4, mut4, 4) -> E
272+
(val5, ref5, mut5, 5) -> F
273+
(val6, ref6, mut6, 6) -> G
274+
(val7, ref7, mut7, 7) -> H
272275
}
273276
Tuple9 {
274-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i) => a }
275-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i) => b }
276-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i) => c }
277-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i) => d }
278-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i) => e }
279-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i) => f }
280-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i) => g }
281-
(val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i) => h }
282-
(val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i) => i }
277+
(val0, ref0, mut0, 0) -> A
278+
(val1, ref1, mut1, 1) -> B
279+
(val2, ref2, mut2, 2) -> C
280+
(val3, ref3, mut3, 3) -> D
281+
(val4, ref4, mut4, 4) -> E
282+
(val5, ref5, mut5, 5) -> F
283+
(val6, ref6, mut6, 6) -> G
284+
(val7, ref7, mut7, 7) -> H
285+
(val8, ref8, mut8, 8) -> I
283286
}
284287
Tuple10 {
285-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j) => a }
286-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j) => b }
287-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j) => c }
288-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j) => d }
289-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j) => e }
290-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j) => f }
291-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j) => g }
292-
(val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j) => h }
293-
(val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j) => i }
294-
(val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j) => j }
288+
(val0, ref0, mut0, 0) -> A
289+
(val1, ref1, mut1, 1) -> B
290+
(val2, ref2, mut2, 2) -> C
291+
(val3, ref3, mut3, 3) -> D
292+
(val4, ref4, mut4, 4) -> E
293+
(val5, ref5, mut5, 5) -> F
294+
(val6, ref6, mut6, 6) -> G
295+
(val7, ref7, mut7, 7) -> H
296+
(val8, ref8, mut8, 8) -> I
297+
(val9, ref9, mut9, 9) -> J
295298
}
296299
Tuple11 {
297-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k) => a }
298-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k) => b }
299-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k) => c }
300-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k) => d }
301-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k) => e }
302-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k) => f }
303-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k) => g }
304-
(val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k) => h }
305-
(val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k) => i }
306-
(val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k) => j }
307-
(val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k) => k }
300+
(val0, ref0, mut0, 0) -> A
301+
(val1, ref1, mut1, 1) -> B
302+
(val2, ref2, mut2, 2) -> C
303+
(val3, ref3, mut3, 3) -> D
304+
(val4, ref4, mut4, 4) -> E
305+
(val5, ref5, mut5, 5) -> F
306+
(val6, ref6, mut6, 6) -> G
307+
(val7, ref7, mut7, 7) -> H
308+
(val8, ref8, mut8, 8) -> I
309+
(val9, ref9, mut9, 9) -> J
310+
(val10, ref10, mut10, 10) -> K
308311
}
309312
Tuple12 {
310-
(val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j, k, l) => a }
311-
(val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j, k, l) => b }
312-
(val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j, k, l) => c }
313-
(val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j, k, l) => d }
314-
(val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j, k, l) => e }
315-
(val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j, k, l) => f }
316-
(val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j, k, l) => g }
317-
(val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j, k, l) => h }
318-
(val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j, k, l) => i }
319-
(val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j, k, l) => j }
320-
(val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k, l) => k }
321-
(val11, ref11, mut11) -> L { (a, b, c, d, e, f, g, h, i, j, k, l) => l }
313+
(val0, ref0, mut0, 0) -> A
314+
(val1, ref1, mut1, 1) -> B
315+
(val2, ref2, mut2, 2) -> C
316+
(val3, ref3, mut3, 3) -> D
317+
(val4, ref4, mut4, 4) -> E
318+
(val5, ref5, mut5, 5) -> F
319+
(val6, ref6, mut6, 6) -> G
320+
(val7, ref7, mut7, 7) -> H
321+
(val8, ref8, mut8, 8) -> I
322+
(val9, ref9, mut9, 9) -> J
323+
(val10, ref10, mut10, 10) -> K
324+
(val11, ref11, mut11, 11) -> L
322325
}
323326
}
324327

0 commit comments

Comments
 (0)