Skip to content

Commit 0ba6d48

Browse files
committed
auto merge of rust-lang#12313 : bjz/rust/tuple, r=huonw
This renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters. It also removes the `CloneableTuple` and `ImmutableTuple` traits.
2 parents 6fe775e + f450b2b commit 0ba6d48

File tree

14 files changed

+193
-307
lines changed

14 files changed

+193
-307
lines changed

src/etc/vim/syntax/rust.vim

-4
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,9 @@ syn keyword rustTrait Buffer Writer Reader Seek
9595
syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
9696
syn keyword rustTrait IterBytes
9797
syn keyword rustTrait ToStr IntoStr
98-
syn keyword rustTrait CloneableTuple ImmutableTuple
9998
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
10099
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
101100
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
102-
syn keyword rustTrait ImmutableTuple1 ImmutableTuple2 ImmutableTuple3 ImmutableTuple4
103-
syn keyword rustTrait ImmutableTuple5 ImmutableTuple6 ImmutableTuple7 ImmutableTuple8
104-
syn keyword rustTrait ImmutableTuple9 ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
105101
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
106102
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector MutableVector
107103
syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector

src/libcollections/btree.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,15 @@ impl<K: Clone + TotalOrd, V: Clone> Branch<K, V> {
500500
let new_outcome = self.clone().rightmost_child.insert(k.clone(),
501501
v.clone(),
502502
ub.clone());
503-
new_branch = new_outcome.clone().n0();
504-
outcome = new_outcome.n1();
503+
new_branch = new_outcome.clone().val0();
504+
outcome = new_outcome.val1();
505505
}
506506
else {
507507
let new_outcome = self.clone().elts[index.unwrap()].left.insert(k.clone(),
508508
v.clone(),
509509
ub.clone());
510-
new_branch = new_outcome.clone().n0();
511-
outcome = new_outcome.n1();
510+
new_branch = new_outcome.clone().val0();
511+
outcome = new_outcome.val1();
512512
}
513513
//Check to see whether a branch or a leaf was returned from the
514514
//tree traversal.

src/libnative/io/process.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*c_void| -> T) -> T {
529529
let mut tmps = vec::with_capacity(env.len());
530530

531531
for pair in env.iter() {
532-
let kv = format!("{}={}", pair.first(), pair.second());
532+
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
533533
tmps.push(kv.to_c_str());
534534
}
535535

@@ -553,7 +553,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*mut c_void| -> T) -> T {
553553
let mut blk = ~[];
554554

555555
for pair in env.iter() {
556-
let kv = format!("{}={}", pair.first(), pair.second());
556+
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
557557
blk.push_all(kv.as_bytes());
558558
blk.push(0);
559559
}

src/librustc/middle/trans/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
599599
const_eval::const_uint(i) => i as uint,
600600
_ => cx.sess.span_bug(count.span, "count must be integral const expression.")
601601
};
602-
let vs = vec::from_elem(n, const_expr(cx, elem, is_local).first());
602+
let vs = vec::from_elem(n, const_expr(cx, elem, is_local).val0());
603603
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
604604
C_struct(vs, false)
605605
} else {

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4604,7 +4604,7 @@ pub fn determine_inherited_purity(parent: (ast::Purity, ast::NodeId),
46044604
// purity inferred for it, then check it under its parent's purity.
46054605
// Otherwise, use its own
46064606
match child_sigil {
4607-
ast::BorrowedSigil if child.first() == ast::ImpureFn => parent,
4607+
ast::BorrowedSigil if child.val0() == ast::ImpureFn => parent,
46084608
_ => child
46094609
}
46104610
}

src/librustdoc/html/render.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1379,11 +1379,11 @@ fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
13791379
match c.impls.find(&it.id) {
13801380
Some(v) => {
13811381
let mut non_trait = v.iter().filter(|p| {
1382-
p.n0_ref().trait_.is_none()
1382+
p.ref0().trait_.is_none()
13831383
});
13841384
let non_trait = non_trait.to_owned_vec();
13851385
let mut traits = v.iter().filter(|p| {
1386-
p.n0_ref().trait_.is_some()
1386+
p.ref0().trait_.is_some()
13871387
});
13881388
let traits = traits.to_owned_vec();
13891389

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
262262
let mut pm = plugins::PluginManager::new(Path::new(path));
263263
for pass in passes.iter() {
264264
let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {
265-
Some(i) => PASSES[i].n1(),
265+
Some(i) => PASSES[i].val1(),
266266
None => {
267267
error!("unknown pass {}, skipping", *pass);
268268
continue

src/libstd/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,7 @@ mod tests {
26112611
assert_eq!(vi.size_hint(), (10, Some(10)));
26122612

26132613
assert_eq!(c.take(5).size_hint(), (5, Some(5)));
2614-
assert_eq!(c.skip(5).size_hint().second(), None);
2614+
assert_eq!(c.skip(5).size_hint().val1(), None);
26152615
assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
26162616
assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
26172617
assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));

src/libstd/prelude.rs

-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ pub use io::{Buffer, Writer, Reader, Seek};
6767
pub use str::{Str, StrVector, StrSlice, OwnedStr, IntoMaybeOwned};
6868
pub use to_bytes::IterBytes;
6969
pub use to_str::{ToStr, IntoStr};
70-
pub use tuple::{CloneableTuple, ImmutableTuple};
71-
pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
72-
pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
73-
pub use tuple::{ImmutableTuple9, ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
7470
pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
7571
pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
7672
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};

src/libstd/str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ impl<'a> Iterator<&'a str> for StrSplits<'a> {
567567
// Helper functions used for Unicode normalization
568568
fn canonical_sort(comb: &mut [(char, u8)]) {
569569
use iter::range;
570-
use tuple::CloneableTuple;
570+
use tuple::Tuple2;
571571

572572
let len = comb.len();
573573
for i in range(0, len) {
574574
let mut swapped = false;
575575
for j in range(1, len-i) {
576-
let classA = comb[j-1].second();
577-
let classB = comb[j].second();
576+
let classA = *comb[j-1].ref1();
577+
let classB = *comb[j].ref1();
578578
if classA != 0 && classB != 0 && classA > classB {
579579
comb.swap(j-1, j);
580580
swapped = true;

src/libstd/to_str.rs

-48
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ impl ToStr for () {
4040
fn to_str(&self) -> ~str { ~"()" }
4141
}
4242

43-
impl<A:ToStr> ToStr for (A,) {
44-
#[inline]
45-
fn to_str(&self) -> ~str {
46-
match *self {
47-
(ref a,) => {
48-
format!("({},)", (*a).to_str())
49-
}
50-
}
51-
}
52-
}
53-
5443
impl<A:ToStr+Hash+Eq, B:ToStr> ToStr for HashMap<A, B> {
5544
#[inline]
5645
fn to_str(&self) -> ~str {
@@ -91,36 +80,6 @@ impl<A:ToStr+Hash+Eq> ToStr for HashSet<A> {
9180
}
9281
}
9382
94-
impl<A:ToStr,B:ToStr> ToStr for (A, B) {
95-
#[inline]
96-
fn to_str(&self) -> ~str {
97-
// FIXME(#4653): this causes an llvm assertion
98-
//let &(ref a, ref b) = self;
99-
match *self {
100-
(ref a, ref b) => {
101-
format!("({}, {})", (*a).to_str(), (*b).to_str())
102-
}
103-
}
104-
}
105-
}
106-
107-
impl<A:ToStr,B:ToStr,C:ToStr> ToStr for (A, B, C) {
108-
#[inline]
109-
fn to_str(&self) -> ~str {
110-
// FIXME(#4653): this causes an llvm assertion
111-
//let &(ref a, ref b, ref c) = self;
112-
match *self {
113-
(ref a, ref b, ref c) => {
114-
format!("({}, {}, {})",
115-
(*a).to_str(),
116-
(*b).to_str(),
117-
(*c).to_str()
118-
)
119-
}
120-
}
121-
}
122-
}
123-
12483
impl<'a,A:ToStr> ToStr for &'a [A] {
12584
#[inline]
12685
fn to_str(&self) -> ~str {
@@ -178,13 +137,6 @@ mod tests {
178137
assert_eq!((~"hi").to_str(), ~"hi");
179138
}
180139
181-
#[test]
182-
fn test_tuple_types() {
183-
assert_eq!((1, 2).to_str(), ~"(1, 2)");
184-
assert_eq!((~"a", ~"b", false).to_str(), ~"(a, b, false)");
185-
assert_eq!(((), ((), 100)).to_str(), ~"((), ((), 100))");
186-
}
187-
188140
#[test]
189141
fn test_vectors() {
190142
let x: ~[int] = ~[];

0 commit comments

Comments
 (0)