use syntax::ast::Ident;
use syntax::ast;
use syntax::ast_map::{PathElem, PathName};
-use syntax::codemap::Span;
+use syntax::codemap::{DUMMY_SP, Span};
use syntax::parse::token::InternedString;
use syntax::parse::token;
use util::common::memoized;
}
// Is the type's representation size known at compile time?
-pub fn type_is_sized<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
-ty::type_contents(cx, ty).is_sized(cx)
+pub fn type_is_sized<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
+ let param_env = ty::empty_parameter_environment(tcx);
+ ty::type_is_sized(¶m_env, DUMMY_SP, ty)
}
pub fn lltype_is_sized<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
let num = token::gensym(name).uint();
// use one colon which will get translated to a period by the mangler, and
// we're guaranteed that `num` is globally unique for this crate.
-PathName(token::gensym(format!("{}:{}", name, num).index(&FullRange)))
+PathName(token::gensym(&format!("{}:{}", name, num)[]))
}
#[derive(Copy)]
match self.tcx().def_map.borrow().get(&nid) {
Some(v) => v.clone(),
None => {
- self.tcx().sess.bug(format!(
- "no def associated with node id {}", nid).index(&FullRange));
+ self.tcx().sess.bug(&format!(
+ "no def associated with node id {}", nid)[]);
}
}
}
Err(e) => {
tcx.sess.span_bug(
span,
- format!("Encountered error `{}` selecting `{}` during trans",
+ &format!("Encountered error `{}` selecting `{}` during trans",
e.repr(tcx),
- trait_ref.repr(tcx)).index(&FullRange))
+ trait_ref.repr(tcx))[])
}
};
} else {
infcx.tcx.sess.span_bug(
span,
- format!("Encountered errors `{}` fulfilling during trans",
- errors.repr(infcx.tcx)).index(&FullRange));
+ &format!("Encountered errors `{}` fulfilling during trans",
+ errors.repr(infcx.tcx))[]);
}
}
}
};
if substs.types.any(|t| ty::type_needs_infer(*t)) {
- tcx.sess.bug(format!("type parameters for node {:?} include inference types: {:?}",
- node, substs.repr(tcx)).index(&FullRange));
+ tcx.sess.bug(&format!("type parameters for node {:?} include inference types: {:?}",
+ node, substs.repr(tcx))[]);
}
monomorphize::apply_param_substs(tcx,
Err(s) => {
let msg = format!("{} {}", msg, s);
match span {
- Some(span) => bcx.tcx().sess.span_fatal(span, msg.index(&FullRange)),
- None => bcx.tcx().sess.fatal(msg.index(&FullRange)),
+ Some(span) => bcx.tcx().sess.span_fatal(span, &msg[]),
+ None => bcx.tcx().sess.fatal(&msg[]),
}
}
}