Test fixes and rebase conflicts

This commit is contained in:
Alex Crichton 2015-01-06 15:57:50 -08:00
parent 26cd8eae48
commit 56a9e2fcd5
18 changed files with 67 additions and 34 deletions

View File

@ -21,6 +21,7 @@
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![allow(unknown_features)]
#![feature(unsafe_destructor, slicing_syntax)]
#![feature(old_impl_check)]
#![no_std]

View File

@ -1339,6 +1339,12 @@ pub trait StrExt: Index<FullRange, Output = str> {
fn trim_left(&self) -> &str {
UnicodeStr::trim_left(self.index(&FullRange))
}
/// Returns a string with trailing whitespace removed.
#[stable]
fn trim_right(&self) -> &str {
UnicodeStr::trim_right(self.index(&FullRange))
}
}
#[stable]

View File

@ -42,6 +42,9 @@
#![experimental]
#![allow(missing_docs)]
#[cfg(not(stage0))]
use marker::Sized;
pub type GlueFn = extern "Rust" fn(*const i8);
#[lang="ty_desc"]
@ -200,7 +203,10 @@ extern "rust-intrinsic" {
/// Gets an identifier which is globally unique to the specified type. This
/// function will return the same value for a type regardless of whichever
/// crate it is invoked in.
#[cfg(not(stage0))]
pub fn type_id<T: ?Sized + 'static>() -> TypeId;
#[cfg(stage0)]
pub fn type_id<T: 'static>() -> TypeId;
/// Create a value initialized to zero.
///
@ -550,7 +556,16 @@ pub struct TypeId {
}
impl TypeId {
/// Returns the `TypeId` of the type this generic function has been instantiated with
/// Returns the `TypeId` of the type this generic function has been
/// instantiated with
#[cfg(stage0)]
pub fn of<T: 'static>() -> TypeId {
unsafe { type_id::<T>() }
}
/// Returns the `TypeId` of the type this generic function has been
/// instantiated with
#[cfg(not(stage0))]
pub fn of<T: ?Sized + 'static>() -> TypeId {
unsafe { type_id::<T>() }
}

View File

@ -733,7 +733,7 @@ macro_rules! iterator {
}
macro_rules! make_slice {
($t: ty -> $result: ty: $start: expr, $end: expr) => {{
($t: ty => $result: ty: $start: expr, $end: expr) => {{
let diff = $end as uint - $start as uint;
let len = if mem::size_of::<T>() == 0 {
diff
@ -797,7 +797,7 @@ impl<'a, T> Iter<'a, T> {
/// iterator can continue to be used while this exists.
#[experimental]
pub fn as_slice(&self) -> &'a [T] {
make_slice!(T -> &'a [T]: self.ptr, self.end)
make_slice!(T => &'a [T]: self.ptr, self.end)
}
}
@ -876,7 +876,7 @@ impl<'a, T> ops::Index<ops::FullRange> for IterMut<'a, T> {
type Output = [T];
#[inline]
fn index(&self, _index: &ops::FullRange) -> &[T] {
make_slice!(T -> &[T]: self.ptr, self.end)
make_slice!(T => &[T]: self.ptr, self.end)
}
}
@ -909,7 +909,7 @@ impl<'a, T> ops::IndexMut<ops::FullRange> for IterMut<'a, T> {
type Output = [T];
#[inline]
fn index_mut(&mut self, _index: &ops::FullRange) -> &mut [T] {
make_slice!(T -> &mut [T]: self.ptr, self.end)
make_slice!(T => &mut [T]: self.ptr, self.end)
}
}
@ -923,7 +923,7 @@ impl<'a, T> IterMut<'a, T> {
/// restricted lifetimes that do not consume the iterator.
#[experimental]
pub fn into_slice(self) -> &'a mut [T] {
make_slice!(T -> &'a mut [T]: self.ptr, self.end)
make_slice!(T => &'a mut [T]: self.ptr, self.end)
}
}

View File

@ -22,6 +22,7 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![allow(unknown_features)]
#![feature(quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]

View File

@ -486,9 +486,9 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
let method_call = ty::MethodCall::expr(expr.id());
match self.typer.node_method_ty(method_call) {
Some(method_ty) => {
// If this is an index implemented by a method call, then it will
// include an implicit deref of the result.
let ret_ty = ty::ty_fn_ret(method_ty).unwrap();
// If this is an index implemented by a method call, then it
// will include an implicit deref of the result.
let ret_ty = self.overloaded_method_return_ty(method_ty);
self.cat_deref(expr,
self.cat_rvalue_node(expr.id(),
expr.span(),

View File

@ -2405,7 +2405,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
// First, try built-in indexing.
match (ty::index(adjusted_ty), &index_ty.sty) {
(Some(ty), &ty::ty_uint(ast::TyU)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
(Some(ty), &ty::ty_uint(ast::TyUs)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
debug!("try_index_step: success, using built-in indexing");
fcx.write_adjustment(base_expr.id, base_expr.span, ty::AdjustDerefRef(adjustment));
return Some((tcx.types.uint, ty));

View File

@ -171,7 +171,7 @@ impl<'a, 'tcx> AstConv<'tcx> for CollectCtxt<'a, 'tcx> {
x => {
self.tcx.sess.bug(format!("unexpected sort of node \
in get_item_type_scheme(): {:?}",
x)[]);
x).as_slice());
}
}
}

View File

@ -25,6 +25,7 @@ Core encoding and decoding interfaces.
#![allow(unknown_features)]
#![feature(slicing_syntax)]
#![feature(old_impl_check)]
#![cfg_attr(stage0, allow(unused_attributes))]
// test harness access
#[cfg(test)] extern crate test;

View File

@ -499,7 +499,7 @@ macro_rules! peel {
/// Evaluates to the number of identifiers passed to it, for example: `count_idents!(a, b, c) == 3
macro_rules! count_idents {
() => { 0u };
($_i:ident, $($rest:ident),*) => { 1 + count_idents!($($rest),*) }
($_i:ident, $($rest:ident,)*) => { 1 + count_idents!($($rest,)*) }
}
macro_rules! tuple {
@ -508,7 +508,7 @@ macro_rules! tuple {
impl<$($name:Decodable),*> Decodable for ($($name,)*) {
#[allow(non_snake_case)]
fn decode<D: Decoder>(d: &mut D) -> Result<($($name,)*), D::Error> {
let len: uint = count_idents!($($name),*);
let len: uint = count_idents!($($name,)*);
d.read_tuple(len, |d| {
let mut i = 0;
let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 },

View File

@ -13,7 +13,7 @@
//! Readers and Writers for in-memory buffers
use cmp::min;
use prelude::v1::Index;
use ops::Index;
use option::Option::None;
use result::Result::{Err, Ok};
use io;

View File

@ -108,6 +108,7 @@
#![feature(phase, lang_items, unsafe_destructor)]
#![feature(slicing_syntax, unboxed_closures)]
#![feature(old_impl_check)]
#![cfg_attr(stage0, allow(unused_attributes))]
// Don't link to std. We are std.
#![no_std]

View File

@ -68,7 +68,7 @@ use fmt;
use iter::IteratorExt;
use option::Option;
use option::Option::{None, Some};
use prelude::v1::{FullRange, Index};
use ops::{FullRange, Index};
use str;
use str::StrExt;
use string::{String, CowString};

View File

@ -25,7 +25,7 @@ use iter::{AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map, repeat};
use mem;
use option::Option::{self, Some, None};
use prelude::v1::{FullRange, Index};
use ops::{FullRange, Index};
use slice::{SliceExt, SliceConcatExt};
use str::{SplitTerminator, FromStr, StrExt};
use string::{String, ToString};

View File

@ -14,7 +14,10 @@
// Reexported core operators
#[stable] #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync};
#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce, FullRange};
#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
// TEMPORARY
#[unstable] #[doc(no_inline)] pub use ops::{Index, IndexMut, FullRange};
// Reexported functions
#[stable] #[doc(no_inline)] pub use mem::drop;

View File

@ -287,7 +287,7 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &NamedMatch, sp: Span) {
// &MatchedNonterminal(NtTT(box TtDelimited(...))) = lhs`
let matcher = match lhs {
&MatchedNonterminal(NtTT(ref inner)) => match &**inner {
&TtDelimited(_, ref tts) => tts.tts[],
&TtDelimited(_, ref tts) => tts.tts.as_slice(),
_ => cx.span_bug(sp, "wrong-structured lhs for follow check")
},
_ => 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)
Some(&&TtToken(_, CloseDelim(_))) => follow.clone(),
Some(&&TtToken(_, ref tok)) => tok.clone(),
Some(&&TtSequence(sp, _)) => {
cx.span_err(sp, format!("`${0}:{1}` is followed by a sequence \
repetition, which is not allowed for `{1}` \
fragments", name.as_str(), frag_spec.as_str())[]);
cx.span_err(sp,
format!("`${0}:{1}` is followed by a \
sequence repetition, which is not \
allowed for `{1}` fragments",
name.as_str(), frag_spec.as_str())
.as_slice());
Eof
},
// die next iteration
@ -337,7 +340,7 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
cx.span_err(sp, format!("`${0}:{1}` is followed by `{2}`, which \
is not allowed for `{1}` fragments",
name.as_str(), frag_spec.as_str(),
token_to_string(next))[]);
token_to_string(next)).as_slice());
continue
},
}
@ -351,11 +354,12 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
Some(ref u) => {
let last = check_matcher(cx, seq.tts.iter(), u);
match last {
// Since the delimiter isn't required after the last repetition, make
// sure that the *next* token is sane. This doesn't actually compute
// the FIRST of the rest of the matcher yet, it only considers single
// tokens and simple NTs. This is imprecise, but conservatively
// correct.
// Since the delimiter isn't required after the last
// repetition, make sure that the *next* token is
// sane. This doesn't actually compute the FIRST of
// the rest of the matcher yet, it only considers
// single tokens and simple NTs. This is imprecise,
// but conservatively correct.
Some((span, tok)) => {
let fol = match tokens.peek() {
Some(&&TtToken(_, ref tok)) => tok.clone(),
@ -373,9 +377,9 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token)
None => last,
}
},
// If T has the form $(...)+ or $(...)*, run the algorithm on the contents with
// F set to the token following the sequence. If it accepts, continue, else,
// reject.
// If T has the form $(...)+ or $(...)*, run the algorithm
// on the contents with F set to the token following the
// sequence. If it accepts, continue, else, reject.
None => {
let fol = match tokens.peek() {
Some(&&TtToken(_, ref tok)) => tok.clone(),
@ -449,6 +453,7 @@ fn is_in_follow(cx: &ExtCtxt, tok: &Token, frag: &str) -> bool {
// harmless
true
},
_ => cx.bug(format!("unrecognized builtin nonterminal {}", frag)[]),
_ => cx.bug(format!("unrecognized builtin nonterminal {}",
frag).as_slice()),
}
}

View File

@ -298,7 +298,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
"the new orphan check rules will eventually be strictly enforced");
}
if attr::contains_name(i.attrs[],
if attr::contains_name(i.attrs.index(&FullRange),
"old_impl_check") {
self.gate_feature("old_impl_check",
i.span,

View File

@ -2613,7 +2613,7 @@ impl<'a> Parser<'a> {
|p| p.parse_token_tree()
);
let (sep, repeat) = self.parse_sep_and_kleene_op();
let name_num = macro_parser::count_names(seq[]);
let name_num = macro_parser::count_names(seq.as_slice());
return TtSequence(mk_sp(sp.lo, seq_span.hi),
Rc::new(SequenceRepetition {
tts: seq,
@ -2656,7 +2656,7 @@ impl<'a> Parser<'a> {
match self.token {
token::SubstNt(name, _) =>
self.fatal(format!("unknown macro variable `{}`",
token::get_ident(name))[]),
token::get_ident(name)).index(&FullRange)),
_ => {}
}
}