Skip to content

Commit 56a9e2f

Browse files
committed
Test fixes and rebase conflicts
1 parent 26cd8ea commit 56a9e2f

File tree

18 files changed

+67
-34
lines changed

18 files changed

+67
-34
lines changed

src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
html_root_url = "http://doc.rust-lang.org/nightly/",
2222
html_playground_url = "http://play.rust-lang.org/")]
2323

24+
#![allow(unknown_features)]
2425
#![feature(unsafe_destructor, slicing_syntax)]
2526
#![feature(old_impl_check)]
2627
#![no_std]

src/libcollections/str.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,12 @@ pub trait StrExt: Index<FullRange, Output = str> {
13391339
fn trim_left(&self) -> &str {
13401340
UnicodeStr::trim_left(self.index(&FullRange))
13411341
}
1342+
1343+
/// Returns a string with trailing whitespace removed.
1344+
#[stable]
1345+
fn trim_right(&self) -> &str {
1346+
UnicodeStr::trim_right(self.index(&FullRange))
1347+
}
13421348
}
13431349

13441350
#[stable]

src/libcore/intrinsics.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
#![experimental]
4343
#![allow(missing_docs)]
4444

45+
#[cfg(not(stage0))]
46+
use marker::Sized;
47+
4548
pub type GlueFn = extern "Rust" fn(*const i8);
4649

4750
#[lang="ty_desc"]
@@ -200,7 +203,10 @@ extern "rust-intrinsic" {
200203
/// Gets an identifier which is globally unique to the specified type. This
201204
/// function will return the same value for a type regardless of whichever
202205
/// crate it is invoked in.
206+
#[cfg(not(stage0))]
203207
pub fn type_id<T: ?Sized + 'static>() -> TypeId;
208+
#[cfg(stage0)]
209+
pub fn type_id<T: 'static>() -> TypeId;
204210

205211
/// Create a value initialized to zero.
206212
///
@@ -550,7 +556,16 @@ pub struct TypeId {
550556
}
551557

552558
impl TypeId {
553-
/// Returns the `TypeId` of the type this generic function has been instantiated with
559+
/// Returns the `TypeId` of the type this generic function has been
560+
/// instantiated with
561+
#[cfg(stage0)]
562+
pub fn of<T: 'static>() -> TypeId {
563+
unsafe { type_id::<T>() }
564+
}
565+
566+
/// Returns the `TypeId` of the type this generic function has been
567+
/// instantiated with
568+
#[cfg(not(stage0))]
554569
pub fn of<T: ?Sized + 'static>() -> TypeId {
555570
unsafe { type_id::<T>() }
556571
}

src/libcore/slice.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ macro_rules! iterator {
733733
}
734734

735735
macro_rules! make_slice {
736-
($t: ty -> $result: ty: $start: expr, $end: expr) => {{
736+
($t: ty => $result: ty: $start: expr, $end: expr) => {{
737737
let diff = $end as uint - $start as uint;
738738
let len = if mem::size_of::<T>() == 0 {
739739
diff
@@ -797,7 +797,7 @@ impl<'a, T> Iter<'a, T> {
797797
/// iterator can continue to be used while this exists.
798798
#[experimental]
799799
pub fn as_slice(&self) -> &'a [T] {
800-
make_slice!(T -> &'a [T]: self.ptr, self.end)
800+
make_slice!(T => &'a [T]: self.ptr, self.end)
801801
}
802802
}
803803

@@ -876,7 +876,7 @@ impl<'a, T> ops::Index<ops::FullRange> for IterMut<'a, T> {
876876
type Output = [T];
877877
#[inline]
878878
fn index(&self, _index: &ops::FullRange) -> &[T] {
879-
make_slice!(T -> &[T]: self.ptr, self.end)
879+
make_slice!(T => &[T]: self.ptr, self.end)
880880
}
881881
}
882882

@@ -909,7 +909,7 @@ impl<'a, T> ops::IndexMut<ops::FullRange> for IterMut<'a, T> {
909909
type Output = [T];
910910
#[inline]
911911
fn index_mut(&mut self, _index: &ops::FullRange) -> &mut [T] {
912-
make_slice!(T -> &mut [T]: self.ptr, self.end)
912+
make_slice!(T => &mut [T]: self.ptr, self.end)
913913
}
914914
}
915915

@@ -923,7 +923,7 @@ impl<'a, T> IterMut<'a, T> {
923923
/// restricted lifetimes that do not consume the iterator.
924924
#[experimental]
925925
pub fn into_slice(self) -> &'a mut [T] {
926-
make_slice!(T -> &'a mut [T]: self.ptr, self.end)
926+
make_slice!(T => &'a mut [T]: self.ptr, self.end)
927927
}
928928
}
929929

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2323
html_root_url = "http://doc.rust-lang.org/nightly/")]
2424

25+
#![allow(unknown_features)]
2526
#![feature(quote)]
2627
#![feature(slicing_syntax, unsafe_destructor)]
2728
#![feature(rustc_diagnostic_macros)]

src/librustc/middle/mem_categorization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,9 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
486486
let method_call = ty::MethodCall::expr(expr.id());
487487
match self.typer.node_method_ty(method_call) {
488488
Some(method_ty) => {
489-
// If this is an index implemented by a method call, then it will
490-
// include an implicit deref of the result.
491-
let ret_ty = ty::ty_fn_ret(method_ty).unwrap();
489+
// If this is an index implemented by a method call, then it
490+
// will include an implicit deref of the result.
491+
let ret_ty = self.overloaded_method_return_ty(method_ty);
492492
self.cat_deref(expr,
493493
self.cat_rvalue_node(expr.id(),
494494
expr.span(),

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2405,7 +2405,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
24052405

24062406
// First, try built-in indexing.
24072407
match (ty::index(adjusted_ty), &index_ty.sty) {
2408-
(Some(ty), &ty::ty_uint(ast::TyU)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
2408+
(Some(ty), &ty::ty_uint(ast::TyUs)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
24092409
debug!("try_index_step: success, using built-in indexing");
24102410
fcx.write_adjustment(base_expr.id, base_expr.span, ty::AdjustDerefRef(adjustment));
24112411
return Some((tcx.types.uint, ty));

src/librustc_typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a, 'tcx> AstConv<'tcx> for CollectCtxt<'a, 'tcx> {
171171
x => {
172172
self.tcx.sess.bug(format!("unexpected sort of node \
173173
in get_item_type_scheme(): {:?}",
174-
x)[]);
174+
x).as_slice());
175175
}
176176
}
177177
}

src/libserialize/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Core encoding and decoding interfaces.
2525
#![allow(unknown_features)]
2626
#![feature(slicing_syntax)]
2727
#![feature(old_impl_check)]
28+
#![cfg_attr(stage0, allow(unused_attributes))]
2829

2930
// test harness access
3031
#[cfg(test)] extern crate test;

src/libserialize/serialize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ macro_rules! peel {
499499
/// Evaluates to the number of identifiers passed to it, for example: `count_idents!(a, b, c) == 3
500500
macro_rules! count_idents {
501501
() => { 0u };
502-
($_i:ident, $($rest:ident),*) => { 1 + count_idents!($($rest),*) }
502+
($_i:ident, $($rest:ident,)*) => { 1 + count_idents!($($rest,)*) }
503503
}
504504

505505
macro_rules! tuple {
@@ -508,7 +508,7 @@ macro_rules! tuple {
508508
impl<$($name:Decodable),*> Decodable for ($($name,)*) {
509509
#[allow(non_snake_case)]
510510
fn decode<D: Decoder>(d: &mut D) -> Result<($($name,)*), D::Error> {
511-
let len: uint = count_idents!($($name),*);
511+
let len: uint = count_idents!($($name,)*);
512512
d.read_tuple(len, |d| {
513513
let mut i = 0;
514514
let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 },

src/libstd/io/mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! Readers and Writers for in-memory buffers
1414
1515
use cmp::min;
16-
use prelude::v1::Index;
16+
use ops::Index;
1717
use option::Option::None;
1818
use result::Result::{Err, Ok};
1919
use io;

src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
#![feature(phase, lang_items, unsafe_destructor)]
109109
#![feature(slicing_syntax, unboxed_closures)]
110110
#![feature(old_impl_check)]
111+
#![cfg_attr(stage0, allow(unused_attributes))]
111112

112113
// Don't link to std. We are std.
113114
#![no_std]

src/libstd/path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use fmt;
6868
use iter::IteratorExt;
6969
use option::Option;
7070
use option::Option::{None, Some};
71-
use prelude::v1::{FullRange, Index};
71+
use ops::{FullRange, Index};
7272
use str;
7373
use str::StrExt;
7474
use string::{String, CowString};

src/libstd/path/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use iter::{AdditiveIterator, Extend};
2525
use iter::{Iterator, IteratorExt, Map, repeat};
2626
use mem;
2727
use option::Option::{self, Some, None};
28-
use prelude::v1::{FullRange, Index};
28+
use ops::{FullRange, Index};
2929
use slice::{SliceExt, SliceConcatExt};
3030
use str::{SplitTerminator, FromStr, StrExt};
3131
use string::{String, ToString};

src/libstd/prelude/v1.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515
// Reexported core operators
1616
#[stable] #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync};
17-
#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce, FullRange};
17+
#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
18+
19+
// TEMPORARY
20+
#[unstable] #[doc(no_inline)] pub use ops::{Index, IndexMut, FullRange};
1821

1922
// Reexported functions
2023
#[stable] #[doc(no_inline)] pub use mem::drop;

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &NamedMatch, sp: Span) {
287287
// &MatchedNonterminal(NtTT(box TtDelimited(...))) = lhs`
288288
let matcher = match lhs {
289289
&MatchedNonterminal(NtTT(ref inner)) => match &**inner {
290-
&TtDelimited(_, ref tts) => tts.tts[],
290+
&TtDelimited(_, ref tts) => tts.tts.as_slice(),
291291
_ => cx.span_bug(sp, "wrong-structured lhs for follow check")
292292
},
293293
_ => cx.span_bug(sp, "wrong-structured lhs for follow check")
@@ -317,9 +317,12 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
317317
Some(&&TtToken(_, CloseDelim(_))) => follow.clone(),
318318
Some(&&TtToken(_, ref tok)) => tok.clone(),
319319
Some(&&TtSequence(sp, _)) => {
320-
cx.span_err(sp, format!("`${0}:{1}` is followed by a sequence \
321-
repetition, which is not allowed for `{1}` \
322-
fragments", name.as_str(), frag_spec.as_str())[]);
320+
cx.span_err(sp,
321+
format!("`${0}:{1}` is followed by a \
322+
sequence repetition, which is not \
323+
allowed for `{1}` fragments",
324+
name.as_str(), frag_spec.as_str())
325+
.as_slice());
323326
Eof
324327
},
325328
// die next iteration
@@ -337,7 +340,7 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
337340
cx.span_err(sp, format!("`${0}:{1}` is followed by `{2}`, which \
338341
is not allowed for `{1}` fragments",
339342
name.as_str(), frag_spec.as_str(),
340-
token_to_string(next))[]);
343+
token_to_string(next)).as_slice());
341344
continue
342345
},
343346
}
@@ -351,11 +354,12 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
351354
Some(ref u) => {
352355
let last = check_matcher(cx, seq.tts.iter(), u);
353356
match last {
354-
// Since the delimiter isn't required after the last repetition, make
355-
// sure that the *next* token is sane. This doesn't actually compute
356-
// the FIRST of the rest of the matcher yet, it only considers single
357-
// tokens and simple NTs. This is imprecise, but conservatively
358-
// correct.
357+
// Since the delimiter isn't required after the last
358+
// repetition, make sure that the *next* token is
359+
// sane. This doesn't actually compute the FIRST of
360+
// the rest of the matcher yet, it only considers
361+
// single tokens and simple NTs. This is imprecise,
362+
// but conservatively correct.
359363
Some((span, tok)) => {
360364
let fol = match tokens.peek() {
361365
Some(&&TtToken(_, ref tok)) => tok.clone(),
@@ -373,9 +377,9 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
373377
None => last,
374378
}
375379
},
376-
// If T has the form $(...)+ or $(...)*, run the algorithm on the contents with
377-
// F set to the token following the sequence. If it accepts, continue, else,
378-
// reject.
380+
// If T has the form $(...)+ or $(...)*, run the algorithm
381+
// on the contents with F set to the token following the
382+
// sequence. If it accepts, continue, else, reject.
379383
None => {
380384
let fol = match tokens.peek() {
381385
Some(&&TtToken(_, ref tok)) => tok.clone(),
@@ -449,6 +453,7 @@ fn is_in_follow(cx: &ExtCtxt, tok: &Token, frag: &str) -> bool {
449453
// harmless
450454
true
451455
},
452-
_ => cx.bug(format!("unrecognized builtin nonterminal {}", frag)[]),
456+
_ => cx.bug(format!("unrecognized builtin nonterminal {}",
457+
frag).as_slice()),
453458
}
454459
}

src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
298298
"the new orphan check rules will eventually be strictly enforced");
299299
}
300300

301-
if attr::contains_name(i.attrs[],
301+
if attr::contains_name(i.attrs.index(&FullRange),
302302
"old_impl_check") {
303303
self.gate_feature("old_impl_check",
304304
i.span,

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,7 +2613,7 @@ impl<'a> Parser<'a> {
26132613
|p| p.parse_token_tree()
26142614
);
26152615
let (sep, repeat) = self.parse_sep_and_kleene_op();
2616-
let name_num = macro_parser::count_names(seq[]);
2616+
let name_num = macro_parser::count_names(seq.as_slice());
26172617
return TtSequence(mk_sp(sp.lo, seq_span.hi),
26182618
Rc::new(SequenceRepetition {
26192619
tts: seq,
@@ -2656,7 +2656,7 @@ impl<'a> Parser<'a> {
26562656
match self.token {
26572657
token::SubstNt(name, _) =>
26582658
self.fatal(format!("unknown macro variable `{}`",
2659-
token::get_ident(name))[]),
2659+
token::get_ident(name)).index(&FullRange)),
26602660
_ => {}
26612661
}
26622662
}

0 commit comments

Comments
 (0)