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

@ -108,16 +108,6 @@ struct Context<'a> {
}
impl<'a> Context<'a> {
#[cfg(stage0)]
fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
if !self.has_feature(feature) {
self.sess.span_err(span, explain);
self.sess.span_note(span, format!("add \\#![feature({})] to the \
crate attributes to enable",
feature).as_slice());
}
}
#[cfg(not(stage0))]
fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
if !self.has_feature(feature) {
self.sess.span_err(span, explain);

View file

@ -63,14 +63,6 @@ struct StandardLibraryInjector<'a> {
pub fn with_version(krate: &str) -> Option<(InternedString, ast::StrStyle)> {
match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
Some("1") => None,
#[cfg(stage0)]
_ => {
Some((token::intern_and_get_ident(format!("{}\\#{}",
krate,
VERSION).as_slice()),
ast::CookedStr))
}
#[cfg(not(stage0))]
_ => {
Some((token::intern_and_get_ident(format!("{}#{}",
krate,

View file

@ -154,15 +154,6 @@ impl<'a> Context<'a> {
}
match self.root {
&None => {}
#[cfg(stage0)]
&Some(ref r) => {
for (i, path) in r.paths().iter().enumerate() {
self.sess.fileline_note(self.span,
format!("crate `{}` path \\#{}: {}",
r.ident, i+1, path.display()).as_slice());
}
}
#[cfg(not(stage0))]
&Some(ref r) => {
for (i, path) in r.paths().iter().enumerate() {
self.sess.fileline_note(self.span,
@ -393,7 +384,7 @@ impl<'a> Context<'a> {
flavor,
self.crate_id.name).as_slice());
self.sess.span_note(self.span,
format!(r"candidate \#1: {}",
format!(r"candidate #1: {}",
ret.get_ref()
.display()).as_slice());
error = 1;
@ -402,7 +393,7 @@ impl<'a> Context<'a> {
if error > 0 {
error += 1;
self.sess.span_note(self.span,
format!(r"candidate \#{}: {}", error,
format!(r"candidate #{}: {}", error,
lib.display()).as_slice());
continue
}

View file

@ -48,31 +48,6 @@ pub struct ty_abbrev {
pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
#[cfg(stage0)]
pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
match cx.abbrevs.borrow_mut().find(&t) {
Some(a) => { w.write(a.s.as_bytes()); return; }
None => {}
}
let pos = w.tell().unwrap();
enc_sty(w, cx, &ty::get(t).sty);
let end = w.tell().unwrap();
let len = end - pos;
fn estimate_sz(u: u64) -> u64 {
let mut n = u;
let mut len = 0;
while n != 0 { len += 1; n = n >> 4; }
return len;
}
let abbrev_len = 3 + estimate_sz(pos) + estimate_sz(len);
if abbrev_len < len {
// I.e. it's actually an abbreviation.
cx.abbrevs.borrow_mut().insert(t, ty_abbrev {
s: format!("\\#{:x}:{:x}\\#", pos, len)
});
}
}
#[cfg(not(stage0))]
pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
match cx.abbrevs.borrow_mut().find(&t) {
Some(a) => { w.write(a.s.as_bytes()); return; }

View file

@ -484,12 +484,6 @@ pub fn emit_lint(level: Level, src: LintSource, msg: &str, span: Span,
let mut note = None;
let msg = match src {
#[cfg(stage0)]
Default => {
format!("{}, \\#[{}({})] on by default", msg,
level_to_str(level), lint_str)
},
#[cfg(not(stage0))]
Default => {
format!("{}, #[{}({})] on by default", msg,
level_to_str(level), lint_str)

View file

@ -1253,15 +1253,6 @@ impl cmt_ {
}
impl Repr for cmt_ {
#[cfg(stage0)]
fn repr(&self, tcx: &ty::ctxt) -> String {
format!("\\{{} id:{} m:{:?} ty:{}\\}",
self.cat.repr(tcx),
self.id,
self.mutbl,
self.ty.repr(tcx))
}
#[cfg(not(stage0))]
fn repr(&self, tcx: &ty::ctxt) -> String {
format!("{{{} id:{} m:{:?} ty:{}}}",
self.cat.repr(tcx),
@ -1315,9 +1306,6 @@ impl Repr for InteriorKind {
InteriorField(NamedField(fld)) => {
token::get_name(fld).get().to_str()
}
#[cfg(stage0)]
InteriorField(PositionalField(i)) => format!("\\#{:?}", i),
#[cfg(not(stage0))]
InteriorField(PositionalField(i)) => format!("#{:?}", i),
InteriorElement(_) => "[]".to_string(),
}

View file

@ -642,10 +642,6 @@ impl<'a> PrivacyVisitor<'a> {
let msg = match name {
NamedField(name) => format!("field `{}` of {} is private",
token::get_ident(name), struct_desc),
#[cfg(stage0)]
UnnamedField(idx) => format!("field \\#{} of {} is private",
idx + 1, struct_desc),
#[cfg(not(stage0))]
UnnamedField(idx) => format!("field #{} of {} is private",
idx + 1, struct_desc),
};

View file

@ -4070,16 +4070,6 @@ impl<'a> Resolver<'a> {
for (&key, &binding_0) in map_0.iter() {
match map_i.find(&key) {
#[cfg(stage0)]
None => {
self.resolve_error(
p.span,
format!("variable `{}` from pattern \\#1 is \
not bound in pattern \\#{}",
token::get_name(key),
i + 1).as_slice());
}
#[cfg(not(stage0))]
None => {
self.resolve_error(
p.span,
@ -4088,18 +4078,6 @@ impl<'a> Resolver<'a> {
token::get_name(key),
i + 1).as_slice());
}
#[cfg(stage0)]
Some(binding_i) => {
if binding_0.binding_mode != binding_i.binding_mode {
self.resolve_error(
binding_i.span,
format!("variable `{}` is bound with different \
mode in pattern \\#{} than in pattern \\#1",
token::get_name(key),
i + 1).as_slice());
}
}
#[cfg(not(stage0))]
Some(binding_i) => {
if binding_0.binding_mode != binding_i.binding_mode {
self.resolve_error(
@ -5107,22 +5085,6 @@ impl<'a> Resolver<'a> {
// structs, which wouldn't result in this error.)
match self.with_no_errors(|this|
this.resolve_path(expr.id, path, TypeNS, false)) {
#[cfg(stage0)]
Some((DefTy(struct_id), _))
if self.structs.contains_key(&struct_id) => {
self.resolve_error(expr.span,
format!("`{}` is a structure name, but \
this expression \
uses it like a function name",
wrong_name).as_slice());
self.session.span_note(expr.span,
format!("Did you mean to write: \
`{} \\{ /* fields */ \\}`?",
wrong_name).as_slice());
}
#[cfg(not(stage0))]
Some((DefTy(struct_id), _))
if self.structs.contains_key(&struct_id) => {
self.resolve_error(expr.span,

View file

@ -73,16 +73,6 @@ pub struct VecTypes {
}
impl VecTypes {
#[cfg(stage0)]
pub fn to_str(&self, ccx: &CrateContext) -> String {
format!("VecTypes \\{unit_ty={}, llunit_ty={}, \
llunit_size={}, llunit_alloc_size={}\\}",
ty_to_str(ccx.tcx(), self.unit_ty),
ccx.tn.type_to_str(self.llunit_ty),
ccx.tn.val_to_str(self.llunit_size),
self.llunit_alloc_size)
}
#[cfg(not(stage0))]
pub fn to_str(&self, ccx: &CrateContext) -> String {
format!("VecTypes {{unit_ty={}, llunit_ty={}, \
llunit_size={}, llunit_alloc_size={}}}",

View file

@ -899,11 +899,6 @@ impl Vid for TyVid {
}
impl fmt::Show for TyVid {
#[cfg(stage0)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
write!(f, "<generic \\#{}>", self.to_uint())
}
#[cfg(not(stage0))]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
write!(f, "<generic #{}>", self.to_uint())
}
@ -914,11 +909,6 @@ impl Vid for IntVid {
}
impl fmt::Show for IntVid {
#[cfg(stage0)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<generic integer \\#{}>", self.to_uint())
}
#[cfg(not(stage0))]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<generic integer #{}>", self.to_uint())
}
@ -929,11 +919,6 @@ impl Vid for FloatVid {
}
impl fmt::Show for FloatVid {
#[cfg(stage0)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<generic float \\#{}>", self.to_uint())
}
#[cfg(not(stage0))]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<generic float #{}>", self.to_uint())
}

View file

@ -1412,40 +1412,6 @@ impl<'a> LookupContext<'a> {
}
}
#[cfg(stage0)]
fn report_static_candidate(&self, idx: uint, did: DefId) {
let span = if did.krate == ast::LOCAL_CRATE {
self.tcx().map.span(did.node)
} else {
self.span
};
self.tcx().sess.span_note(
span,
format!("candidate \\#{} is `{}`",
idx + 1u,
ty::item_path_str(self.tcx(), did)).as_slice());
}
#[cfg(stage0)]
fn report_param_candidate(&self, idx: uint, did: DefId) {
self.tcx().sess.span_note(
self.span,
format!("candidate \\#{} derives from the bound `{}`",
idx + 1u,
ty::item_path_str(self.tcx(), did)).as_slice());
}
#[cfg(stage0)]
fn report_trait_candidate(&self, idx: uint, did: DefId) {
self.tcx().sess.span_note(
self.span,
format!("candidate \\#{} derives from the type of the receiver, \
which is the trait `{}`",
idx + 1u,
ty::item_path_str(self.tcx(), did)).as_slice());
}
#[cfg(not(stage0))]
fn report_static_candidate(&self, idx: uint, did: DefId) {
let span = if did.krate == ast::LOCAL_CRATE {
self.tcx().map.span(did.node)
@ -1459,7 +1425,6 @@ impl<'a> LookupContext<'a> {
ty::item_path_str(self.tcx(), did)).as_slice());
}
#[cfg(not(stage0))]
fn report_param_candidate(&self, idx: uint, did: DefId) {
self.tcx().sess.span_note(
self.span,
@ -1468,7 +1433,6 @@ impl<'a> LookupContext<'a> {
ty::item_path_str(self.tcx(), did)).as_slice());
}
#[cfg(not(stage0))]
fn report_trait_candidate(&self, idx: uint, did: DefId) {
self.tcx().sess.span_note(
self.span,

View file

@ -61,11 +61,6 @@ impl<V:InferStr> InferStr for Bound<V> {
}
impl<T:InferStr> InferStr for Bounds<T> {
#[cfg(stage0)]
fn inf_str(&self, cx: &InferCtxt) -> String {
format!("\\{{} <: {}\\}", self.lb.inf_str(cx), self.ub.inf_str(cx))
}
#[cfg(not(stage0))]
fn inf_str(&self, cx: &InferCtxt) -> String {
format!("{{{} <: {}}}", self.lb.inf_str(cx), self.ub.inf_str(cx))
}

View file

@ -96,11 +96,6 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
ReFree(ref fr) => {
let prefix = match fr.bound_region {
#[cfg(stage0)]
BrAnon(idx) => {
format!("the anonymous lifetime \\#{} defined on", idx + 1)
}
#[cfg(not(stage0))]
BrAnon(idx) => {
format!("the anonymous lifetime #{} defined on", idx + 1)
}
@ -381,9 +376,6 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String {
Some(def) => token::get_ident(def.ident).get().to_string(),
// This can only happen when a type mismatch error happens and
// the actual type has more type parameters than the expected one.
#[cfg(stage0)]
None => format!("<generic \\#{}>", id),
#[cfg(not(stage0))]
None => format!("<generic #{}>", id),
};
if !cx.sess.verbose() {
@ -758,13 +750,6 @@ impl Repr for ast::DefId {
}
impl Repr for ty::ty_param_bounds_and_ty {
#[cfg(stage0)]
fn repr(&self, tcx: &ctxt) -> String {
format!("ty_param_bounds_and_ty \\{generics: {}, ty: {}\\}",
self.generics.repr(tcx),
self.ty.repr(tcx))
}
#[cfg(not(stage0))]
fn repr(&self, tcx: &ctxt) -> String {
format!("ty_param_bounds_and_ty {{generics: {}, ty: {}}}",
self.generics.repr(tcx),
@ -836,14 +821,6 @@ impl Repr for ast::Visibility {
}
impl Repr for ty::BareFnTy {
#[cfg(stage0)]
fn repr(&self, tcx: &ctxt) -> String {
format!("BareFnTy \\{fn_style: {:?}, abi: {}, sig: {}\\}",
self.fn_style,
self.abi.to_str(),
self.sig.repr(tcx))
}
#[cfg(not(stage0))]
fn repr(&self, tcx: &ctxt) -> String {
format!("BareFnTy {{fn_style: {:?}, abi: {}, sig: {}}}",
self.fn_style,
@ -859,14 +836,6 @@ impl Repr for ty::FnSig {
}
impl Repr for typeck::MethodCallee {
#[cfg(stage0)]
fn repr(&self, tcx: &ctxt) -> String {
format!("MethodCallee \\{origin: {}, ty: {}, {}\\}",
self.origin.repr(tcx),
self.ty.repr(tcx),
self.substs.repr(tcx))
}
#[cfg(not(stage0))]
fn repr(&self, tcx: &ctxt) -> String {
format!("MethodCallee {{origin: {}, ty: {}, {}}}",
self.origin.repr(tcx),