auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw

Closes #14898
Closes #14918
This commit is contained in:
bors 2014-06-16 08:16:49 +00:00
commit 7ec78053ec
94 changed files with 321 additions and 841 deletions

View file

@ -32,23 +32,6 @@ pub struct CrateId {
}
impl fmt::Show for CrateId {
#[cfg(stage0)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{}", self.path));
let version = match self.version {
None => "0.0",
Some(ref version) => version.as_slice(),
};
if self.path == self.name ||
self.path
.as_slice()
.ends_with(format!("/{}", self.name).as_slice()) {
write!(f, "\\#{}", version)
} else {
write!(f, "\\#{}:{}", self.name, version)
}
}
#[cfg(not(stage0))]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{}", self.path));
let version = match self.version {

View file

@ -118,7 +118,7 @@ impl SpanHandler {
// others log errors for later reporting.
pub struct Handler {
err_count: Cell<uint>,
emit: RefCell<Box<Emitter:Send>>,
emit: RefCell<Box<Emitter + Send>>,
}
impl Handler {
@ -187,7 +187,7 @@ pub fn default_handler(color_config: ColorConfig) -> Handler {
mk_handler(box EmitterWriter::stderr(color_config))
}
pub fn mk_handler(e: Box<Emitter:Send>) -> Handler {
pub fn mk_handler(e: Box<Emitter + Send>) -> Handler {
Handler {
err_count: Cell::new(0),
emit: RefCell::new(e),
@ -281,8 +281,8 @@ pub struct EmitterWriter {
}
enum Destination {
Terminal(Box<term::Terminal<Box<Writer:Send>>:Send>),
Raw(Box<Writer:Send>),
Terminal(Box<term::Terminal<Box<Writer + Send>> + Send>),
Raw(Box<Writer + Send>),
}
impl EmitterWriter {
@ -306,7 +306,7 @@ impl EmitterWriter {
}
}
pub fn new(dst: Box<Writer:Send>) -> EmitterWriter {
pub fn new(dst: Box<Writer + Send>) -> EmitterWriter {
EmitterWriter { dst: Raw(dst) }
}
}

View file

@ -145,29 +145,6 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
inputs.push((constraint, input));
}
}
#[cfg(stage0)]
Clobbers => {
let mut clobs = Vec::new();
while p.token != token::EOF &&
p.token != token::COLON &&
p.token != token::MOD_SEP {
if clobs.len() != 0 {
p.eat(&token::COMMA);
}
let (s, _str_style) = p.parse_str();
let clob = format!("~\\{{}\\}", s);
clobs.push(clob);
if OPTIONS.iter().any(|opt| s.equiv(opt)) {
cx.span_warn(p.last_span, "expected a clobber, but found an option");
}
}
cons = clobs.connect(",");
}
#[cfg(not(stage0))]
Clobbers => {
let mut clobs = Vec::new();
while p.token != token::EOF &&

View file

@ -257,13 +257,13 @@ pub enum SyntaxExtension {
/// A normal, function-like syntax extension.
///
/// `bytes!` is a `NormalTT`.
NormalTT(Box<MacroExpander:'static>, Option<Span>),
NormalTT(Box<MacroExpander + 'static>, Option<Span>),
/// A function-like syntax extension that has an extra ident before
/// the block.
///
/// `macro_rules!` is an `IdentTT`.
IdentTT(Box<IdentMacroExpander:'static>, Option<Span>),
IdentTT(Box<IdentMacroExpander + 'static>, Option<Span>),
}
pub type NamedSyntaxExtension = (Name, SyntaxExtension);

View file

@ -90,13 +90,6 @@ impl<'a> ParserAttr for Parser<'a> {
let hi = self.span.hi;
(mk_sp(lo, hi), meta_item, style)
}
#[cfg(stage0)]
_ => {
let token_str = self.this_token_to_str();
self.fatal(format!("expected `\\#` but found `{}`",
token_str).as_slice());
}
#[cfg(not(stage0))]
_ => {
let token_str = self.this_token_to_str();
self.fatal(format!("expected `#` but found `{}`",

View file

@ -302,7 +302,7 @@ pub struct Parser<'a> {
pub tokens_consumed: uint,
pub restriction: restriction,
pub quote_depth: uint, // not (yet) related to the quasiquoter
pub reader: Box<Reader:>,
pub reader: Box<Reader>,
pub interner: Rc<token::IdentInterner>,
/// The set of seen errors about obsolete syntax. Used to suppress
/// extra detail when the same error is seen twice
@ -325,7 +325,8 @@ fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
}
impl<'a> Parser<'a> {
pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: Box<Reader:>) -> Parser<'a> {
pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig,
mut rdr: Box<Reader>) -> Parser<'a> {
let tok0 = rdr.next_token();
let span = tok0.sp;
let placeholder = TokenAndSpan {
@ -1232,13 +1233,6 @@ impl<'a> Parser<'a> {
})
}
#[cfg(stage0)]
_ => {
let token_str = p.this_token_to_str();
p.fatal((format!("expected `;` or `\\{` but found `{}`",
token_str)).as_slice())
}
#[cfg(not(stage0))]
_ => {
let token_str = p.this_token_to_str();
p.fatal((format!("expected `;` or `{{` but found `{}`",
@ -1645,12 +1639,9 @@ impl<'a> Parser<'a> {
}
// Next, parse a plus and bounded type parameters, if applicable.
//
// NOTE(stage0, pcwalton): Remove `token::COLON` after a snapshot.
let bounds = if mode == LifetimeAndTypesAndBounds {
let bounds = {
if self.eat(&token::BINOP(token::PLUS)) ||
self.eat(&token::COLON) {
if self.eat(&token::BINOP(token::PLUS)) {
let (_, bounds) = self.parse_ty_param_bounds(false);
Some(bounds)
} else {
@ -3208,21 +3199,6 @@ impl<'a> Parser<'a> {
// consuming more tokens).
let (bra, ket) = match token::close_delimiter_for(&self.token) {
Some(ket) => (self.token.clone(), ket),
#[cfg(stage0)]
None => {
// we only expect an ident if we didn't parse one
// above.
let ident_str = if id == token::special_idents::invalid {
"identifier, "
} else {
""
};
let tok_str = self.this_token_to_str();
self.fatal(format!("expected {}`(` or `\\{`, but found `{}`",
ident_str,
tok_str).as_slice())
}
#[cfg(not(stage0))]
None => {
// we only expect an ident if we didn't parse one
// above.
@ -4153,15 +4129,6 @@ impl<'a> Parser<'a> {
self.bump();
}
token::RBRACE => {}
#[cfg(stage0)]
_ => {
let span = self.span;
let token_str = self.this_token_to_str();
self.span_fatal(span,
format!("expected `,`, or `\\}` but found `{}`",
token_str).as_slice())
}
#[cfg(not(stage0))]
_ => {
let span = self.span;
let token_str = self.this_token_to_str();