Skip to content

Commit 34e67f6

Browse files
committed
---
yaml --- r: 66331 b: refs/heads/master c: d2e3e1e h: refs/heads/master i: 66329: 2d35613 66327: 9c22d78 v: v3
1 parent d3b36b8 commit 34e67f6

File tree

8 files changed

+34
-60
lines changed

8 files changed

+34
-60
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: d0512b1055eac15db86d83c994fb546cbfa62676
2+
refs/heads/master: d2e3e1e52ba008c58ecfa801cb5d127365d20ae5
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn parse_config(args: ~[~str]) -> config {
7575
];
7676

7777
assert!(!args.is_empty());
78-
let args_ = vec::tail(args);
78+
let args_ = args.tail();
7979
let matches =
8080
&match getopts::getopts(args_, opts) {
8181
Ok(m) => m,

trunk/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ type OptRes = Either<TestOpts, ~str>;
139139

140140
// Parses command line arguments into test options
141141
pub fn parse_opts(args: &[~str]) -> OptRes {
142-
let args_ = vec::tail(args);
142+
let args_ = args.tail();
143143
let opts = ~[getopts::optflag("ignored"),
144144
getopts::optflag("test"),
145145
getopts::optflag("bench"),

trunk/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
312312
tys.push(Type::i64());
313313
}
314314
SSEFv => {
315-
let vec_len = llvec_len(vec::tailn(cls, i + 1u)) * 2u;
315+
let vec_len = llvec_len(cls.tailn(i + 1u)) * 2u;
316316
let vec_ty = Type::vector(&Type::f32(), vec_len as u64);
317317
tys.push(vec_ty);
318318
i += vec_len;

trunk/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use util::ppaux::Repr;
4747

4848
use middle::trans::type_::Type;
4949

50-
use core::vec;
5150
use syntax::ast;
5251
use syntax::ast_map;
5352
use syntax::visit;
@@ -503,7 +502,7 @@ pub fn trans_call_inner(in_cx: block,
503502
do base::with_scope(in_cx, call_info, "call") |cx| {
504503
let ret_in_loop = match args {
505504
ArgExprs(args) => {
506-
args.len() > 0u && match vec::last(args).node {
505+
args.len() > 0u && match args.last().node {
507506
ast::expr_loop_body(@ast::expr {
508507
node: ast::expr_fn_block(_, ref body),
509508
_

trunk/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,7 @@ pub fn combine_impl_and_methods_tps(bcx: block,
492492
debug!("rcvr_substs=%?", rcvr_substs.map(|t| bcx.ty_to_str(*t)));
493493
let ty_substs
494494
= vec::append(rcvr_substs.to_owned(),
495-
vec::tailn(node_substs,
496-
node_substs.len() - n_m_tps));
495+
node_substs.tailn(node_substs.len() - n_m_tps));
497496
debug!("n_m_tps=%?", n_m_tps);
498497
debug!("node_substs=%?", node_substs.map(|t| bcx.ty_to_str(*t)));
499498
debug!("ty_substs=%?", ty_substs.map(|t| bcx.ty_to_str(*t)));
@@ -540,7 +539,7 @@ pub fn combine_impl_and_methods_origins(bcx: block,
540539
};
541540

542541
// Extract those that belong to method:
543-
let m_origins = vec::tailn(*r_m_origins, r_m_origins.len() - m_vtables);
542+
let m_origins = r_m_origins.tailn(r_m_origins.len() - m_vtables);
544543

545544
// Combine rcvr + method to find the final result:
546545
@vec::append(/*bad*/copy *rcvr_origins, m_origins)

trunk/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,7 +3954,7 @@ pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
39543954
}
39553955

39563956
ast_map::node_variant(ref variant, _, path) => {
3957-
vec::append_one(vec::to_owned(vec::init(*path)),
3957+
vec::append_one(vec::to_owned(path.init()),
39583958
ast_map::path_name((*variant).node.name))
39593959
}
39603960

trunk/src/libstd/vec.rs

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -238,44 +238,6 @@ pub fn build_sized_opt<A>(size: Option<uint>,
238238

239239
// Accessors
240240

241-
/// Returns the first element of a vector
242-
pub fn head<'r,T>(v: &'r [T]) -> &'r T {
243-
if v.len() == 0 { fail!("head: empty vector") }
244-
&v[0]
245-
}
246-
247-
/// Returns `Some(x)` where `x` is the first element of the slice `v`,
248-
/// or `None` if the vector is empty.
249-
pub fn head_opt<'r,T>(v: &'r [T]) -> Option<&'r T> {
250-
if v.len() == 0 { None } else { Some(&v[0]) }
251-
}
252-
253-
/// Returns a vector containing all but the first element of a slice
254-
pub fn tail<'r,T>(v: &'r [T]) -> &'r [T] { v.slice(1, v.len()) }
255-
256-
/// Returns a vector containing all but the first `n` elements of a slice
257-
pub fn tailn<'r,T>(v: &'r [T], n: uint) -> &'r [T] { v.slice(n, v.len()) }
258-
259-
/// Returns a vector containing all but the last element of a slice
260-
pub fn init<'r,T>(v: &'r [T]) -> &'r [T] { v.slice(0, v.len() - 1) }
261-
262-
/// Returns a vector containing all but the last `n' elements of a slice
263-
pub fn initn<'r,T>(v: &'r [T], n: uint) -> &'r [T] {
264-
v.slice(0, v.len() - n)
265-
}
266-
267-
/// Returns the last element of the slice `v`, failing if the slice is empty.
268-
pub fn last<'r,T>(v: &'r [T]) -> &'r T {
269-
if v.len() == 0 { fail!("last: empty vector") }
270-
&v[v.len() - 1]
271-
}
272-
273-
/// Returns `Some(x)` where `x` is the last element of the slice `v`, or
274-
/// `None` if the vector is empty.
275-
pub fn last_opt<'r,T>(v: &'r [T]) -> Option<&'r T> {
276-
if v.len() == 0 { None } else { Some(&v[v.len() - 1]) }
277-
}
278-
279241
/// Copies
280242
281243
/// Split the vector `v` by applying each element against the predicate `f`.
@@ -1678,35 +1640,49 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
16781640

16791641
/// Returns the first element of a vector, failing if the vector is empty.
16801642
#[inline]
1681-
fn head(&self) -> &'self T { head(*self) }
1643+
fn head(&self) -> &'self T {
1644+
if self.len() == 0 { fail!("head: empty vector") }
1645+
&self[0]
1646+
}
16821647

1683-
/// Returns the first element of a vector
1648+
/// Returns the first element of a vector, or `None` if it is empty
16841649
#[inline]
1685-
fn head_opt(&self) -> Option<&'self T> { head_opt(*self) }
1650+
fn head_opt(&self) -> Option<&'self T> {
1651+
if self.len() == 0 { None } else { Some(&self[0]) }
1652+
}
16861653

16871654
/// Returns all but the first element of a vector
16881655
#[inline]
1689-
fn tail(&self) -> &'self [T] { tail(*self) }
1656+
fn tail(&self) -> &'self [T] { self.slice(1, self.len()) }
16901657

16911658
/// Returns all but the first `n' elements of a vector
16921659
#[inline]
1693-
fn tailn(&self, n: uint) -> &'self [T] { tailn(*self, n) }
1660+
fn tailn(&self, n: uint) -> &'self [T] { self.slice(n, self.len()) }
16941661

1695-
/// Returns all but the last elemnt of a vector
1662+
/// Returns all but the last element of a vector
16961663
#[inline]
1697-
fn init(&self) -> &'self [T] { init(*self) }
1664+
fn init(&self) -> &'self [T] {
1665+
self.slice(0, self.len() - 1)
1666+
}
16981667

16991668
/// Returns all but the last `n' elemnts of a vector
17001669
#[inline]
1701-
fn initn(&self, n: uint) -> &'self [T] { initn(*self, n) }
1670+
fn initn(&self, n: uint) -> &'self [T] {
1671+
self.slice(0, self.len() - n)
1672+
}
17021673

1703-
/// Returns the last element of a `v`, failing if the vector is empty.
1674+
/// Returns the last element of a vector, failing if the vector is empty.
17041675
#[inline]
1705-
fn last(&self) -> &'self T { last(*self) }
1676+
fn last(&self) -> &'self T {
1677+
if self.len() == 0 { fail!("last: empty vector") }
1678+
&self[self.len() - 1]
1679+
}
17061680

1707-
/// Returns the last element of a `v`, failing if the vector is empty.
1681+
/// Returns the last element of a vector, or `None` if it is empty.
17081682
#[inline]
1709-
fn last_opt(&self) -> Option<&'self T> { last_opt(*self) }
1683+
fn last_opt(&self) -> Option<&'self T> {
1684+
if self.len() == 0 { None } else { Some(&self[self.len() - 1]) }
1685+
}
17101686

17111687
/**
17121688
* Find the last index matching some predicate

0 commit comments

Comments
 (0)