}
None => {
let message = format!("--pretty=flowgraph needs \
- block, fn, or method; got {:?}",
+ block, fn, or method; got {}",
node);
// point to what was found, if there's an
blocks::BlockCode(block) => cfg::CFG::new(ty_cx, &*block),
blocks::FnLikeCode(fn_like) => cfg::CFG::new(ty_cx, &*fn_like.body()),
};
- debug!("cfg: {:?}", cfg);
match code {
_ if variants.len() == 0 => {
let class_doc = expect(tcx.sess.diagnostic(),
decoder::maybe_find_item(class_id.node, all_items),
|| {
- (format!("get_field_type: class ID {:?} not found",
+ (format!("get_field_type: class ID {} not found",
class_id)).to_string()
});
let the_field = expect(tcx.sess.diagnostic(),
decoder::maybe_find_item(def.node, class_doc),
|| {
- (format!("get_field_type: in class {:?}, field ID {:?} not found",
+ (format!("get_field_type: in class {}, field ID {} not found",
class_id,
def)).to_string()
});
rbml_w.start_tag(tag_items_data_item_symbol);
match ecx.item_symbols.borrow().find(&id) {
Some(x) => {
- debug!("encode_symbol(id={:?}, str={})", id, *x);
+ debug!("encode_symbol(id={}, str={})", id, *x);
rbml_w.writer.write(x.as_bytes());
}
None => {
id: NodeId,
variants: &[P<Variant>],
index: &mut Vec<entry<i64>>) {
- debug!("encode_enum_variant_info(id={:?})", id);
+ debug!("encode_enum_variant_info(id={})", id);
let mut disr_val = 0;
let mut i = 0;
ItemImpl(..) => {
let (ident, did) = (item.ident, item.id);
debug!("(encoding info for module) ... encoding impl {} \
- ({:?}/{:?})",
+ ({}/{})",
token::get_ident(ident),
did, ecx.tcx.map.node_to_string(did));
parent_id: NodeId,
ast_item_opt: Option<&ImplItem>) {
- debug!("encode_info_for_method: {:?} {}", m.def_id,
+ debug!("encode_info_for_method: {} {}", m.def_id,
token::get_ident(m.ident));
rbml_w.start_tag(tag_items_data_item);
let mut visited_dirs = HashSet::new();
let mut found = false;
- debug!("filesearch: searching additional lib search paths [{:?}]",
+ debug!("filesearch: searching additional lib search paths [{}]",
self.addl_lib_search_paths.borrow().len());
for path in self.addl_lib_search_paths.borrow().iter() {
match f(path) {
for path in rustpath.iter() {
let tlib_path = make_rustpkg_lib_path(
self.sysroot, path, self.triple);
- debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
+ debug!("is {} in visited_dirs? {}", tlib_path.display(),
visited_dirs.contains_equiv(&tlib_path.as_vec().to_vec()));
if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
// def-id will depend on where it originated from. Therefore, the conversion
// function is given an indicator of the source of the def-id. See
// astencode.rs for more information.
+#[deriving(Show)]
pub enum DefIdSource {
// Identifies a struct, trait, enum, etc.
NominalType,
}
'p' => {
let did = parse_def(st, TypeParameter, |x,y| conv(x,y));
- debug!("parsed ty_param: did={:?}", did);
+ debug!("parsed ty_param: did={}", did);
let index = parse_uint(st);
assert_eq!(next(st), '|');
let space = parse_param_space(st);
let crate_num = match uint::parse_bytes(crate_part, 10u) {
Some(cn) => cn as ast::CrateNum,
- None => fail!("internal error: parse_def_id: crate number expected, found {:?}",
+ None => fail!("internal error: parse_def_id: crate number expected, found {}",
crate_part)
};
let def_num = match uint::parse_bytes(def_part, 10u) {
Some(dn) => dn as ast::NodeId,
- None => fail!("internal error: parse_def_id: id expected, found {:?}",
+ None => fail!("internal error: parse_def_id: id expected, found {}",
def_part)
};
ast::DefId { krate: crate_num, node: def_num }
NominalType | TypeWithId | RegionParameter => dcx.tr_def_id(did),
TypeParameter => dcx.tr_intern_def_id(did)
};
- debug!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r);
+ debug!("convert_def_id(source={}, did={})={}", source, did, r);
return r;
}
}
}
c::tag_table_node_type => {
let ty = val_dsr.read_ty(dcx);
- debug!("inserting ty for node {:?}: {}",
+ debug!("inserting ty for node {}: {}",
id, ty_to_string(dcx.tcx, ty));
dcx.tcx.node_types.borrow_mut().insert(id as uint, ty);
}
loan_cause: euv::LoanCause)
{
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
- bk={}, loan_cause={:?})",
+ bk={}, loan_cause={})",
borrow_id, cmt.repr(self.tcx()), loan_region,
bk, loan_cause);
all_loans: &[Loan],
decl: &ast::FnDecl,
body: &ast::Block) {
- debug!("check_loans(body id={:?})", body.id);
+ debug!("check_loans(body id={})", body.id);
let mut clcx = CheckLoanCtxt {
bccx: bccx,
//! issued when we enter `scope_id` (for example, we do not
//! permit two `&mut` borrows of the same variable).
- debug!("check_for_conflicting_loans(scope_id={:?})", scope_id);
+ debug!("check_for_conflicting_loans(scope_id={})", scope_id);
let new_loan_indices = self.loans_generated_by(scope_id);
- debug!("new_loan_indices = {:?}", new_loan_indices);
+ debug!("new_loan_indices = {}", new_loan_indices);
self.each_issued_loan(scope_id, |issued_loan| {
for &new_loan_index in new_loan_indices.iter() {
use_path: &LoanPath,
borrow_kind: ty::BorrowKind)
-> UseError {
- debug!("analyze_restrictions_on_use(expr_id={:?}, use_path={})",
+ debug!("analyze_restrictions_on_use(expr_id={}, use_path={})",
self.tcx().map.node_to_string(expr_id),
use_path.repr(self.tcx()));
* is using a moved/uninitialized value
*/
- debug!("check_if_path_is_moved(id={:?}, use_kind={:?}, lp={})",
+ debug!("check_if_path_is_moved(id={}, use_kind={}, lp={})",
id, use_kind, lp.repr(self.bccx.tcx));
let base_lp = owned_ptr_base_path_rc(lp);
self.move_data.each_move_of(id, &base_lp, |the_move, moved_lp| {
loan_cause: euv::LoanCause)
{
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
- bk={}, loan_cause={:?})",
+ bk={}, loan_cause={})",
borrow_id, cmt.repr(self.tcx()), loan_region,
bk, loan_cause);
* dynamically that they are not freed.
*/
- debug!("guarantee_valid(borrow_id={:?}, cmt={}, \
- req_mutbl={:?}, loan_region={:?})",
+ debug!("guarantee_valid(borrow_id={}, cmt={}, \
+ req_mutbl={}, loan_region={})",
borrow_id,
cmt.repr(self.tcx()),
req_kind,
self.bccx, borrow_span, cause,
cmt.clone(), loan_region);
- debug!("guarantee_valid(): restrictions={:?}", restr);
+ debug!("guarantee_valid(): restrictions={}", restr);
// Create the loan record (if needed).
let loan = match restr {
ty::ReInfer(..) => {
self.tcx().sess.span_bug(
cmt.span,
- format!("invalid borrow lifetime: {:?}",
+ format!("invalid borrow lifetime: {}",
loan_region).as_slice());
}
};
- debug!("loan_scope = {:?}", loan_scope);
+ debug!("loan_scope = {}", loan_scope);
let gen_scope = self.compute_gen_scope(borrow_id, loan_scope);
- debug!("gen_scope = {:?}", gen_scope);
+ debug!("gen_scope = {}", gen_scope);
let kill_scope = self.compute_kill_scope(loan_scope, &*loan_path);
- debug!("kill_scope = {:?}", kill_scope);
+ debug!("kill_scope = {}", kill_scope);
if req_kind == ty::MutBorrow {
self.mark_loan_path_as_mutated(&*loan_path);
}
};
- debug!("guarantee_valid(borrow_id={:?}), loan={}",
+ debug!("guarantee_valid(borrow_id={}), loan={}",
borrow_id, loan.repr(self.tcx()));
// let loan_path = loan.loan_path;
use std::rc::Rc;
+#[deriving(Show)]
pub enum RestrictionResult {
Safe,
SafeIf(Rc<LoanPath>, Vec<Rc<LoanPath>>)
}
}
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(PartialEq, Eq, Hash, Show)]
pub enum LoanPath {
LpVar(ast::NodeId), // `x` in doc.rs
LpUpvar(ty::UpvarId), // `x` captured by-value into closure
LpExtend(Rc<LoanPath>, mc::MutabilityCategory, LoanPathElem)
}
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(PartialEq, Eq, Hash, Show)]
pub enum LoanPathElem {
LpDeref(mc::PointerKind), // `*LV` in doc.rs
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
BorrowViolation(euv::LoanCause)
}
+#[deriving(Show)]
pub enum MovedValueUseKind {
MovedInUse,
MovedInCapture,
(ty::expr_ty_adjusted(self.tcx, &*expr), expr.span)
}
r => {
- self.tcx.sess.bug(format!("MoveExpr({:?}) maps to \
- {:?}, not Expr",
+ self.tcx.sess.bug(format!("MoveExpr({}) maps to \
+ {}, not Expr",
the_move.id,
r).as_slice())
}
(ty::expr_ty_adjusted(self.tcx, &*expr), expr.span)
}
r => {
- self.tcx.sess.bug(format!("Captured({:?}) maps to \
- {:?}, not Expr",
+ self.tcx.sess.bug(format!("Captured({}) maps to \
+ {}, not Expr",
the_move.id,
r).as_slice())
}
impl Repr for Loan {
fn repr(&self, tcx: &ty::ctxt) -> String {
- format!("Loan_{:?}({}, {:?}, {:?}-{:?}, {})",
+ format!("Loan_{}({}, {}, {}-{}, {})",
self.index,
self.loan_path.repr(tcx),
self.kind,
}
/// Index into `MoveData.paths`, used like a pointer
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub struct MovePathIndex(uint);
impl MovePathIndex {
pub next_sibling: MovePathIndex,
}
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub enum MoveKind {
Declared, // When declared, variables start out "moved".
MoveExpr, // Expression or binding that moves a variable
}
};
- debug!("move_path(lp={}, index={:?})",
+ debug!("move_path(lp={}, index={})",
lp.repr(tcx),
index);
* location `id` with kind `kind`.
*/
- debug!("add_move(lp={}, id={:?}, kind={:?})",
+ debug!("add_move(lp={}, id={}, kind={})",
lp.repr(tcx),
id,
kind);
* location `id` with the given `span`.
*/
- debug!("add_assignment(lp={}, assign_id={:?}, assignee_id={:?}",
+ debug!("add_assignment(lp={}, assign_id={}, assignee_id={}",
lp.repr(tcx), assign_id, assignee_id);
let path_index = self.move_path(tcx, lp.clone());
};
if self.is_var_path(path_index) {
- debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
+ debug!("add_assignment[var](lp={}, assignment={}, path_index={})",
lp.repr(tcx), self.var_assignments.borrow().len(), path_index);
self.var_assignments.borrow_mut().push(assignment);
} else {
- debug!("add_assignment[path](lp={}, path_index={:?})",
+ debug!("add_assignment[path](lp={}, path_index={})",
lp.repr(tcx), path_index);
self.path_assignments.borrow_mut().push(assignment);
let inputs = inline_asm.inputs.iter();
let outputs = inline_asm.outputs.iter();
let post_inputs = self.exprs(inputs.map(|a| {
- debug!("cfg::construct InlineAsm id:{} input:{:?}", expr.id, a);
+ debug!("cfg::construct InlineAsm id:{} input:{}", expr.id, a);
let &(_, ref expr) = a;
&**expr
}), pred);
let post_outputs = self.exprs(outputs.map(|a| {
- debug!("cfg::construct InlineAsm id:{} output:{:?}", expr.id, a);
+ debug!("cfg::construct InlineAsm id:{} output:{}", expr.id, a);
let &(_, ref expr, _) = a;
&**expr
}), post_inputs);
}
self.tcx.sess.span_bug(
expr.span,
- format!("no loop scope for id {:?}",
+ format!("no loop scope for id {}",
loop_id).as_slice());
}
r => {
self.tcx.sess.span_bug(
expr.span,
- format!("bad entry `{:?}` in def_map for label",
+ format!("bad entry `{}` in def_map for label",
r).as_slice());
}
}
Some(&DefStruct(_)) => { }
Some(&def) => {
- debug!("(checking const) found bad def: {:?}", def);
+ debug!("(checking const) found bad def: {}", def);
span_err!(v.tcx.sess, e.span, E0014,
"paths in constants may only refer to constants \
or functions");
cx.tcx.sess.span_bug(
p.span,
format!("binding pattern {} is not an \
- identifier: {:?}",
+ identifier: {}",
p.id,
p.node).as_slice());
}
span: Span,
cmt: mc::cmt,
_: euv::ConsumeMode) {
- debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
+ debug!("consume; cmt: {}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
if !ty::type_is_sized(self.tcx, cmt.ty) {
span_err!(self.tcx.sess, span, E0161,
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
let words_per_id = (bits_per_id + uint::BITS - 1) / uint::BITS;
let num_nodes = cfg.graph.all_nodes().len();
- debug!("DataFlowContext::new(analysis_name: {:s}, id_range={:?}, \
- bits_per_id={:?}, words_per_id={:?}) \
+ debug!("DataFlowContext::new(analysis_name: {:s}, id_range={}, \
+ bits_per_id={}, words_per_id={}) \
num_nodes: {}",
analysis_name, id_range, bits_per_id, words_per_id,
num_nodes);
pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` generates `bit`
- debug!("{:s} add_gen(id={:?}, bit={:?})",
+ debug!("{:s} add_gen(id={}, bit={})",
self.analysis_name, id, bit);
assert!(self.nodeid_to_index.contains_key(&id));
assert!(self.bits_per_id > 0);
pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
//! Indicates that `id` kills `bit`
- debug!("{:s} add_kill(id={:?}, bit={:?})",
+ debug!("{:s} add_kill(id={}, bit={})",
self.analysis_name, id, bit);
assert!(self.nodeid_to_index.contains_key(&id));
assert!(self.bits_per_id > 0);
let cfgidx = to_cfgidx_or_die(id, &self.nodeid_to_index);
let (start, end) = self.compute_id_range(cfgidx);
let gens = self.gens.slice(start, end);
- debug!("{:s} each_gen_bit(id={:?}, gens={})",
+ debug!("{:s} each_gen_bit(id={}, gens={})",
self.analysis_name, id, bits_to_string(gens));
self.each_bit(gens, f)
}
}
None => {
debug!("{:s} add_kills_from_flow_exits flow_exit={} \
- no cfg_idx for exiting_scope={:?}",
+ no cfg_idx for exiting_scope={}",
self.analysis_name, flow_exit, node_id);
}
}
bitwise(on_entry, pred_bits, &self.dfcx.oper)
};
if changed {
- debug!("{:s} changed entry set for {:?} to {}",
+ debug!("{:s} changed entry set for {} to {}",
self.dfcx.analysis_name, cfgidx,
bits_to_string(self.dfcx.on_entry.slice(start, end)));
self.changed = true;
}
UnsafeBlock(block_id) => {
// OK, but record this.
- debug!("effect: recording unsafe block as used: {:?}", block_id);
+ debug!("effect: recording unsafe block as used: {}", block_id);
self.tcx.used_unsafe.borrow_mut().insert(block_id);
}
UnsafeFn => {}
mode: MutateMode);
}
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub enum LoanCause {
ClosureCapture(Span),
AddrOf,
MatchDiscriminant
}
-#[deriving(PartialEq,Show)]
+#[deriving(PartialEq, Show)]
pub enum ConsumeMode {
Copy, // reference to x where x has a type that copies
Move(MoveReason), // reference to x where x has a type that moves
* meaning either copied or moved depending on its type.
*/
- debug!("walk_block(blk.id={:?})", blk.id);
+ debug!("walk_block(blk.id={})", blk.id);
for stmt in blk.stmts.iter() {
self.walk_stmt(&**stmt);
#![allow(dead_code)] // still WIP
+use std::fmt::{Formatter, FormatError, Show};
use std::uint;
pub struct Graph<N,E> {
pub data: E,
}
+impl<E: Show> Show for Edge<E> {
+ fn fmt(&self, f: &mut Formatter) -> Result<(), FormatError> {
+ write!(f, "Edge {{ next_edge: [{}, {}], source: {}, target: {}, data: {} }}",
+ self.next_edge[0], self.next_edge[1], self.source,
+ self.target, self.data)
+ }
+}
+
#[deriving(Clone, PartialEq, Show)]
pub struct NodeIndex(pub uint);
#[allow(non_uppercase_statics)]
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub struct EdgeIndex(pub uint);
#[allow(non_uppercase_statics)]
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
#[cfg(test)]
mod test {
use middle::graph::*;
+ use std::fmt::Show;
type TestNode = Node<&'static str>;
type TestEdge = Edge<&'static str>;
});
}
- fn test_adjacent_edges<N:PartialEq,E:PartialEq>(graph: &Graph<N,E>,
+ fn test_adjacent_edges<N:PartialEq+Show,E:PartialEq+Show>(graph: &Graph<N,E>,
start_index: NodeIndex,
start_data: N,
expected_incoming: &[(E,N)],
graph.each_incoming_edge(start_index, |edge_index, edge| {
assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_incoming.len());
- debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
+ debug!("counter={} expected={} edge_index={} edge={}",
counter, expected_incoming[counter], edge_index, edge);
match expected_incoming[counter] {
(ref e, ref n) => {
graph.each_outgoing_edge(start_index, |edge_index, edge| {
assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_outgoing.len());
- debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
+ debug!("counter={} expected={} edge_index={} edge={}",
counter, expected_outgoing[counter], edge_index, edge);
match expected_outgoing[counter] {
(ref e, ref n) => {
}
}
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
enum LiveNodeKind {
FreeVarNode(Span),
ExprNode(Span),
var_nid: NodeId
}
+#[deriving(Show)]
struct LocalInfo {
id: NodeId,
ident: Ident
}
+#[deriving(Show)]
enum VarKind {
Arg(NodeId, Ident),
Local(LocalInfo),
ImplicitRet => {}
}
- debug!("{} is {:?}", v.to_string(), vk);
+ debug!("{} is {}", v.to_string(), vk);
v
}
fn visit_arm(ir: &mut IrMaps, arm: &Arm) {
for pat in arm.pats.iter() {
pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| {
- debug!("adding local variable {} from match with bm {:?}",
+ debug!("adding local variable {} from match with bm {}",
p_id, bm);
let name = path1.node;
ir.add_live_node_for_node(p_id, VarDefNode(sp));
// live nodes required for uses or definitions of variables:
ExprPath(_) => {
let def = ir.tcx.def_map.borrow().get_copy(&expr.id);
- debug!("expr {}: path that leads to {:?}", expr.id, def);
+ debug!("expr {}: path that leads to {}", expr.id, def);
match def {
DefLocal(..) => ir.add_live_node_for_node(expr.id, ExprNode(expr.span)),
_ => {}
}
ExprForLoop(ref pat, _, _, _) => {
pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| {
- debug!("adding local variable {} from for loop with bm {:?}",
+ debug!("adding local variable {} from for loop with bm {}",
p_id, bm);
let name = path1.node;
ir.add_live_node_for_node(p_id, VarDefNode(sp));
let mut wr = io::MemWriter::new();
{
let wr = &mut wr as &mut io::Writer;
- write!(wr, "[ln({}) of kind {:?} reads", ln.get(), self.ir.lnk(ln));
+ write!(wr, "[ln({}) of kind {} reads", ln.get(), self.ir.lnk(ln));
self.write_vars(wr, ln, |idx| self.users.get(idx).reader);
write!(wr, " writes");
self.write_vars(wr, ln, |idx| self.users.get(idx).writer);
use std::cell::RefCell;
use std::rc::Rc;
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub enum categorization {
cat_rvalue(ty::Region), // temporary val, argument is its scope
cat_static_item,
// (*1) downcast is only required if the enum has more than one variant
}
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub enum CopiedUpvarKind {
Boxed(ast::Onceness),
Unboxed(ty::UnboxedClosureKind)
}
}
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub struct CopiedUpvar {
pub upvar_id: ast::NodeId,
pub kind: CopiedUpvarKind,
}
// different kinds of pointers:
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum PointerKind {
OwnedPtr,
BorrowedPtr(ty::BorrowKind, ty::Region),
// We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum InteriorKind {
InteriorField(FieldName),
InteriorElement(ElementKind),
}
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum FieldName {
NamedField(ast::Name),
PositionalField(uint)
}
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum ElementKind {
VecElement,
OtherElement,
// dereference, but its type is the type *before* the dereference
// (`@T`). So use `cmt.ty` to find the type of the value in a consistent
// fashion. For more details, see the method `cat_pattern`
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub struct cmt_ {
pub id: ast::NodeId, // id of expr/pat producing this value
pub span: Span, // span of same expr/pat
expr_ty: ty::t,
def: def::Def)
-> McResult<cmt> {
- debug!("cat_def: id={} expr={} def={:?}",
+ debug!("cat_def: id={} expr={} def={}",
id, expr_ty.repr(self.tcx()), def);
match def {
};
let method_ty = self.typer.node_method_ty(method_call);
- debug!("cat_deref: method_call={:?} method_ty={}",
+ debug!("cat_deref: method_call={} method_ty={}",
method_call, method_ty.map(|ty| ty.repr(self.tcx())));
let base_cmt = match method_ty {
impl Repr for cmt_ {
fn repr(&self, tcx: &ty::ctxt) -> String {
- format!("{{{} id:{} m:{:?} ty:{}}}",
+ format!("{{{} id:{} m:{} ty:{}}}",
self.cat.repr(tcx),
self.id,
self.mutbl,
cat_copied_upvar(..) |
cat_local(..) |
cat_upvar(..) => {
- format!("{:?}", *self)
+ format!("{}", *self)
}
cat_deref(ref cmt, derefs, ptr) => {
format!("{}-{}{}->", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs)
InteriorField(NamedField(fld)) => {
token::get_name(fld).get().to_string()
}
- InteriorField(PositionalField(i)) => format!("#{:?}", i),
+ InteriorField(PositionalField(i)) => format!("#{}", i),
InteriorElement(_) => "[]".to_string(),
}
}
// This code is here instead of in visit_item so that the
// crate module gets processed as well.
if self.prev_exported {
- assert!(self.exp_map2.contains_key(&id), "wut {:?}", id);
+ assert!(self.exp_map2.contains_key(&id), "wut {}", id);
for export in self.exp_map2.get(&id).iter() {
if is_local(export.def_id) {
self.reexports.insert(export.def_id.node);
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
if !is_local(did) {
if self.external_exports.contains(&did) {
- debug!("privacy - {:?} was externally exported", did);
+ debug!("privacy - {} was externally exported", did);
return Allowable;
}
- debug!("privacy - is {:?} a public method", did);
+ debug!("privacy - is {} a public method", did);
return match self.tcx.impl_or_trait_items.borrow().find(&did) {
Some(&ty::MethodTraitItem(ref meth)) => {
- debug!("privacy - well at least it's a method: {:?}",
+ debug!("privacy - well at least it's a method: {}",
*meth);
match meth.container {
ty::TraitContainer(id) => {
- debug!("privacy - recursing on trait {:?}", id);
+ debug!("privacy - recursing on trait {}", id);
self.def_privacy(id)
}
ty::ImplContainer(id) => {
match ty::impl_trait_ref(self.tcx, id) {
Some(t) => {
- debug!("privacy - impl of trait {:?}", id);
+ debug!("privacy - impl of trait {}", id);
self.def_privacy(t.def_id)
}
None => {
- debug!("privacy - found a method {:?}",
+ debug!("privacy - found a method {}",
meth.vis);
if meth.vis == ast::Public {
Allowable
Some(&ty::TypeTraitItem(ref typedef)) => {
match typedef.container {
ty::TraitContainer(id) => {
- debug!("privacy - recursing on trait {:?}", id);
+ debug!("privacy - recursing on trait {}", id);
self.def_privacy(id)
}
ty::ImplContainer(id) => {
match ty::impl_trait_ref(self.tcx, id) {
Some(t) => {
- debug!("privacy - impl of trait {:?}", id);
+ debug!("privacy - impl of trait {}", id);
self.def_privacy(t.def_id)
}
None => {
- debug!("privacy - found a typedef {:?}",
+ debug!("privacy - found a typedef {}",
typedef.vis);
if typedef.vis == ast::Public {
Allowable
// members, so that's why we test the parent, and not the did itself.
let mut cur = self.curitem;
loop {
- debug!("privacy - questioning {}, {:?}", self.nodestr(cur), cur);
+ debug!("privacy - questioning {}, {}", self.nodestr(cur), cur);
match cur {
// If the relevant parent is in our history, then we're allowed
// to look inside any of our ancestor's immediate private items,
None => {}
}
- debug!("relate_free_regions(sub={:?}, sup={:?})", sub, sup);
+ debug!("relate_free_regions(sub={}, sup={})", sub, sup);
self.free_region_map.borrow_mut().insert(sub, vec!(sup));
}
//! Returns the lifetime of the variable `id`.
let scope = ty::ReScope(self.var_scope(id));
- debug!("var_region({}) = {:?}", id, scope);
+ debug!("var_region({}) = {}", id, scope);
scope
}
* duplicated with the code in infer.rs.
*/
- debug!("is_subregion_of(sub_region={:?}, super_region={:?})",
+ debug!("is_subregion_of(sub_region={}, super_region={})",
sub_region, super_region);
sub_region == super_region || {
sp: Span,
id: ast::NodeId) {
debug!("region::resolve_fn(id={}, \
- span={:?}, \
+ span={}, \
body.id={}, \
cx.parent={})",
id,
// FIXME: dox
pub type LastPrivateMap = NodeMap<LastPrivate>;
+#[deriving(Show)]
pub enum LastPrivate {
LastMod(PrivateDep),
// `use` directives (imports) can refer to two separate definitions in the
pub type_used: ImportUse},
}
+#[deriving(Show)]
pub enum PrivateDep {
AllPublic,
DependsOn(DefId),
}
// How an import is used.
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub enum ImportUse {
Unused, // The import is not used.
Used, // The import is used.
ArgumentIrrefutableMode,
}
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(PartialEq, Eq, Hash, Show)]
enum Namespace {
TypeNS,
ValueNS
}
// Records a possibly-private value definition.
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
struct ValueNsDef {
is_public: bool, // see note in ImportResolution about how to use this
def: Def,
ident: Ident,
new_parent: ReducedGraphParent) {
debug!("(building reduced graph for \
- external crate) building external def, priv {:?}",
+ external crate) building external def, priv {}",
vis);
let is_public = vis == ast::Public;
let is_exported = is_public && match new_parent {
}
DefMethod(..) => {
debug!("(building reduced graph for external crate) \
- ignoring {:?}", def);
+ ignoring {}", def);
// Ignored; handled elsewhere.
}
DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
DefUse(..) | DefUpvar(..) | DefRegion(..) |
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {
- fail!("didn't expect `{:?}`", def);
+ fail!("didn't expect `{}`", def);
}
}
}
lp: LastPrivate)
-> ResolveResult<()> {
debug!("(resolving single import) resolving `{}` = `{}::{}` from \
- `{}` id {}, last private {:?}",
+ `{}` id {}, last private {}",
token::get_ident(target),
self.module_to_string(&*containing_module),
token::get_ident(source),
shadowable: _
}) => {
debug!("(resolving single import) found \
- import in ns {:?}", namespace);
+ import in ns {}", namespace);
let id = import_resolution.id(namespace);
// track used imports and extern crates as well
this.used_imports.insert((id, namespace));
match value_result {
BoundResult(ref target_module, ref name_bindings) => {
- debug!("(resolving single import) found value target: {:?}",
+ debug!("(resolving single import) found value target: {}",
{ name_bindings.value_def.borrow().clone().unwrap().def });
self.check_for_conflicting_import(
&import_resolution.value_target,
}
match type_result {
BoundResult(ref target_module, ref name_bindings) => {
- debug!("(resolving single import) found type target: {:?}",
+ debug!("(resolving single import) found type target: {}",
{ name_bindings.type_def.borrow().clone().unwrap().type_def });
self.check_for_conflicting_import(
&import_resolution.type_target,
.borrow();
for (ident, target_import_resolution) in import_resolutions.iter() {
debug!("(resolving glob import) writing module resolution \
- {:?} into `{}`",
+ {} into `{}`",
target_import_resolution.type_target.is_none(),
self.module_to_string(module_));
namespace: Namespace)
-> ResolveResult<(Target, bool)> {
debug!("(resolving item in lexical scope) resolving `{}` in \
- namespace {:?} in `{}`",
+ namespace {} in `{}`",
token::get_ident(name),
namespace,
self.module_to_string(&*module_));
None => {
// Not found; continue.
debug!("(resolving item in lexical scope) found \
- import resolution, but not in namespace {:?}",
+ import resolution, but not in namespace {}",
namespace);
}
Some(target) => {
match import_resolution.target_for_namespace(namespace) {
None => {
debug!("(resolving name in module) name found, \
- but not in namespace {:?}",
+ but not in namespace {}",
namespace);
}
Some(target) => {
match namebindings.def_for_namespace(ns) {
Some(d) => {
let name = token::get_name(name);
- debug!("(computing exports) YES: export '{}' => {:?}",
+ debug!("(computing exports) YES: export '{}' => {}",
name, d.def_id());
exports2.push(Export2 {
name: name.get().to_string(),
});
}
d_opt => {
- debug!("(computing exports) NO: {:?}", d_opt);
+ debug!("(computing exports) NO: {}", d_opt);
}
}
}
Some(def) => {
match def {
(DefTrait(_), _) => {
- debug!("(resolving trait) found trait def: {:?}", def);
+ debug!("(resolving trait) found trait def: {}", def);
self.record_def(trait_reference.ref_id, def);
}
(def, _) => {
match self.resolve_path(ty.id, path, TypeNS, true) {
Some(def) => {
debug!("(resolving type) resolved `{}` to \
- type {:?}",
+ type {}",
token::get_ident(path.segments
.last().unwrap()
.identifier),
}
result => {
debug!("(resolving pattern) didn't find struct \
- def: {:?}", result);
+ def: {}", result);
let msg = format!("`{}` does not name a structure",
self.path_idents_to_string(path));
self.resolve_error(path.span, msg.as_slice());
ValueNS) {
Success((target, _)) => {
debug!("(resolve bare identifier pattern) succeeded in \
- finding {} at {:?}",
+ finding {} at {}",
token::get_ident(name),
target.bindings.value_def.borrow());
match *target.bindings.value_def.borrow() {
match search_result {
Some(DlDef(def)) => {
debug!("(resolving path in local ribs) resolved `{}` to \
- local: {:?}",
+ local: {}",
token::get_ident(ident),
def);
return Some(def);
Some(definition) => self.record_def(expr.id, definition),
result => {
debug!("(resolving expression) didn't find struct \
- def: {:?}", result);
+ def: {}", result);
let msg = format!("`{}` does not name a structure",
self.path_idents_to_string(path));
self.resolve_error(path.span, msg.as_slice());
}
fn record_def(&mut self, node_id: NodeId, (def, lp): (Def, LastPrivate)) {
- debug!("(recording def) recording {:?} for {:?}, last private {:?}",
+ debug!("(recording def) recording {} for {}, last private {}",
def, node_id, lp);
assert!(match lp {LastImport{..} => false, _ => true},
"Import should only be used for `use` directives");
// the same conclusion! - nmatsakis
Occupied(entry) => if def != *entry.get() {
self.session
- .bug(format!("node_id {:?} resolved first to {:?} and \
- then {:?}",
+ .bug(format!("node_id {} resolved first to {} and \
+ then {}",
node_id,
*entry.get(),
def).as_slice());
scope: Scope<'a>
}
+#[deriving(Show)]
enum ScopeChain<'a> {
/// EarlyScope(i, ['a, 'b, ...], s) extends s with early-bound
/// lifetimes, assigning indexes 'a => i, 'b => i+1, ... etc.
};
self.with(|_, f| f(EarlyScope(subst::TypeSpace, lifetimes, &ROOT_SCOPE)), |v| {
- debug!("entering scope {:?}", v.scope);
+ debug!("entering scope {}", v.scope);
v.check_lifetime_defs(lifetimes);
visit::walk_item(v, item);
- debug!("exiting scope {:?}", v.scope);
+ debug!("exiting scope {}", v.scope);
});
}
let referenced_idents = early_bound_lifetime_names(generics);
debug!("pushing fn scope id={} due to fn item/method\
- referenced_idents={:?}",
+ referenced_idents={}",
n,
referenced_idents.iter().map(lifetime_show).collect::<Vec<token::InternedString>>());
let lifetimes = &generics.lifetimes;
probably a bug in syntax::fold");
}
- debug!("lifetime_ref={} id={} resolved to {:?}",
+ debug!("lifetime_ref={} id={} resolved to {}",
lifetime_to_string(lifetime_ref),
lifetime_ref.id,
def);
def::DefUse(_) |
def::DefMethod(..) |
def::DefPrimTy(_) => {
- self.sess.span_bug(span, format!("lookup_def_kind for unexpected item: {:?}",
+ self.sess.span_bug(span, format!("lookup_def_kind for unexpected item: {}",
def).as_slice());
},
}
},
_ => {
self.sess.span_bug(method.span,
- format!("Container {} for method {} is not a node item {:?}",
+ format!("Container {} for method {} is not a node item {}",
impl_id.node,
method.id,
self.analysis.ty_cx.map.get(impl_id.node)
// FIXME(nrc) what is this doing here?
def::DefStatic(_, _) => {}
def::DefConst(..) => {}
- _ => error!("unexpected definition kind when processing collected paths: {:?}",
+ _ => error!("unexpected definition kind when processing collected paths: {}",
*def)
}
}
use syntax::fold::Folder;
use syntax::ptr::P;
+#[deriving(Show)]
struct ConstantExpr<'a>(&'a ast::Expr);
impl<'a> ConstantExpr<'a> {
}
// An option identifying a branch (either a literal, an enum variant or a range)
+#[deriving(Show)]
enum Opt<'a> {
ConstantValue(ConstantExpr<'a>),
ConstantRange(ConstantExpr<'a>, ConstantExpr<'a>),
variant_size: uint,
val: ValueRef)
-> Vec<Match<'a, 'p, 'blk, 'tcx>> {
- debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
+ debug!("enter_opt(bcx={}, m={}, opt={}, col={}, val={})",
bcx.to_str(),
m.repr(bcx.tcx()),
*opt,
_ => {}
}
- debug!("binding {:?} to {}",
+ debug!("binding {} to {}",
binding_info.id,
bcx.val_to_string(llval));
bcx.fcx.lllocals.borrow_mut().insert(binding_info.id, datum);
// Decide what kind of branch we need
let opts = get_branches(bcx, m, col);
- debug!("options={:?}", opts);
+ debug!("options={}", opts);
let mut kind = NoBranch;
let mut test_val = val;
debug!("test_val={}", bcx.val_to_string(test_val));
/// Representations.
-#[deriving(Eq, PartialEq)]
+#[deriving(Eq, PartialEq, Show)]
pub enum Repr {
/// C-like enums; basically an int.
CEnum(IntType, Disr, Disr), // discriminant range (signedness based on the IntType)
}
/// For structs, and struct-like parts of anything fancier.
-#[deriving(Eq, PartialEq)]
+#[deriving(Eq, PartialEq, Show)]
pub struct Struct {
// If the struct is DST, then the size and alignment do not take into
// account the unsized fields of the struct.
}
let repr = Rc::new(represent_type_uncached(cx, t));
- debug!("Represented as: {:?}", repr)
+ debug!("Represented as: {}", repr)
cx.adt_reprs().borrow_mut().insert(t, repr.clone());
repr
}
}
}
+#[deriving(Show)]
struct IntBounds {
slo: i64,
shi: i64,
}
fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntType {
- debug!("range_to_inttype: {:?} {:?}", hint, bounds);
+ debug!("range_to_inttype: {} {}", hint, bounds);
// Lists of sizes to try. u64 is always allowed as a fallback.
#[allow(non_uppercase_statics)]
static choose_shortest: &'static[IntType] = &[
}
fn bounds_usable(cx: &CrateContext, ity: IntType, bounds: &IntBounds) -> bool {
- debug!("bounds_usable: {:?} {:?}", ity, bounds);
+ debug!("bounds_usable: {} {}", ity, bounds);
match ity {
attr::SignedInt(_) => {
let lllo = C_integral(ll_inttype(cx, ity), bounds.slo as u64, true);
Type::array(&Type::i64(cx), align_units),
a if a.count_ones() == 1 => Type::array(&Type::vector(&Type::i32(cx), a / 4),
align_units),
- _ => fail!("unsupported enum alignment: {:?}", align)
+ _ => fail!("unsupported enum alignment: {}", align)
};
assert_eq!(machine::llalign_of_min(cx, pad_ty) as u64, align);
assert_eq!(align % discr_size, 0);
constraints.push_str(clobbers.as_slice());
}
- debug!("Asm Constraints: {:?}", constraints.as_slice());
+ debug!("Asm Constraints: {}", constraints.as_slice());
let num_outputs = outputs.len();
pub fn init_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, local: &ast::Local)
-> Block<'blk, 'tcx> {
- debug!("init_local(bcx={}, local.id={:?})", bcx.to_str(), local.id);
+ debug!("init_local(bcx={}, local.id={})", bcx.to_str(), local.id);
let _indenter = indenter();
let _icx = push_ctxt("init_local");
_match::store_local(bcx, local)
}
pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
- debug!("get_item_val(id=`{:?}`)", id);
+ debug!("get_item_val(id=`{}`)", id);
match ccx.item_vals().borrow().find_copy(&id) {
Some(v) => return v,
}
ref variant => {
- ccx.sess().bug(format!("get_item_val(): unexpected variant: {:?}",
+ ccx.sess().bug(format!("get_item_val(): unexpected variant: {}",
variant).as_slice())
}
};
else { llvm::False };
let argtys = inputs.iter().map(|v| {
- debug!("Asm Input Type: {:?}", self.ccx.tn().val_to_string(*v));
+ debug!("Asm Input Type: {}", self.ccx.tn().val_to_string(*v));
val_ty(*v)
}).collect::<Vec<_>>();
- debug!("Asm Output Type: {:?}", self.ccx.tn().type_to_string(output));
+ debug!("Asm Output Type: {}", self.ccx.tn().type_to_string(output));
let fty = Type::func(argtys.as_slice(), &output);
unsafe {
let v = llvm::LLVMInlineAsm(
def::DefSelfTy(..) => {
bcx.tcx().sess.span_bug(
ref_expr.span,
- format!("cannot translate def {:?} \
+ format!("cannot translate def {} \
to a callable thing!", def).as_slice());
}
}
let _icx = push_ctxt("trans_fn_ref");
let substs = node_id_substs(bcx, node);
- debug!("trans_fn_ref(def_id={}, node={:?}, substs={})",
+ debug!("trans_fn_ref(def_id={}, node={}, substs={})",
def_id.repr(bcx.tcx()),
node,
substs.repr(bcx.tcx()));
let ccx = bcx.ccx();
let tcx = bcx.tcx();
- debug!("trans_fn_ref_with_substs(bcx={}, def_id={}, node={:?}, \
+ debug!("trans_fn_ref_with_substs(bcx={}, def_id={}, node={}, \
substs={})",
bcx.to_str(),
def_id.repr(tcx),
use middle::trans::glue;
use middle::trans::type_::Type;
use middle::ty;
+use std::fmt;
use syntax::ast;
use util::ppaux::Repr;
cached_landing_pad: Option<BasicBlockRef>,
}
+#[deriving(Show)]
pub struct CustomScopeIndex {
index: uint
}
LoopScopeKind(ast::NodeId, [Block<'blk, 'tcx>, ..EXIT_MAX])
}
-#[deriving(PartialEq)]
+impl<'blk, 'tcx: 'blk> fmt::Show for CleanupScopeKind<'blk, 'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::FormatError> {
+ match *self {
+ CustomScopeKind => write!(f, "CustomScopeKind"),
+ AstScopeKind(nid) => write!(f, "AstScopeKind({})", nid),
+ LoopScopeKind(nid, ref blks) => {
+ try!(write!(f, "LoopScopeKind({}, [", nid));
+ for blk in blks.iter() {
+ try!(write!(f, "{:p}, ", blk));
+ }
+ write!(f, "])")
+ }
+ }
+ }
+}
+
+#[deriving(PartialEq, Show)]
pub enum EarlyExitLabel {
UnwindExit,
ReturnExit,
pub type CleanupObj = Box<Cleanup+'static>;
+#[deriving(Show)]
pub enum ScopeId {
AstScope(ast::NodeId),
CustomScope(CustomScopeIndex)
* cleanups for normal exit.
*/
- debug!("pop_and_trans_custom_cleanup_scope({:?})", custom_scope);
+ debug!("pop_and_trans_custom_cleanup_scope({})", custom_scope);
assert!(self.is_valid_to_pop_custom_scope(custom_scope));
let scope = self.pop_scope();
ptr: val,
};
- debug!("schedule_lifetime_end({:?}, val={})",
+ debug!("schedule_lifetime_end({}, val={})",
cleanup_scope,
self.ccx.tn().val_to_string(val));
zero: false
};
- debug!("schedule_drop_mem({:?}, val={}, ty={})",
+ debug!("schedule_drop_mem({}, val={}, ty={})",
cleanup_scope,
self.ccx.tn().val_to_string(val),
ty.repr(self.ccx.tcx()));
zero: true
};
- debug!("schedule_drop_and_zero_mem({:?}, val={}, ty={}, zero={})",
+ debug!("schedule_drop_and_zero_mem({}, val={}, ty={}, zero={})",
cleanup_scope,
self.ccx.tn().val_to_string(val),
ty.repr(self.ccx.tcx()),
zero: false
};
- debug!("schedule_drop_immediate({:?}, val={}, ty={})",
+ debug!("schedule_drop_immediate({}, val={}, ty={})",
cleanup_scope,
self.ccx.tn().val_to_string(val),
ty.repr(self.ccx.tcx()));
let drop = box FreeValue { ptr: val, heap: heap, content_ty: content_ty };
- debug!("schedule_free_value({:?}, val={}, heap={:?})",
+ debug!("schedule_free_value({}, val={}, heap={})",
cleanup_scope,
self.ccx.tn().val_to_string(val),
heap);
let drop = box FreeSlice { ptr: val, size: size, align: align, heap: heap };
- debug!("schedule_free_slice({:?}, val={}, heap={:?})",
+ debug!("schedule_free_slice({}, val={}, heap={})",
cleanup_scope,
self.ccx.tn().val_to_string(val),
heap);
* in the topmost scope, which must be a temporary scope.
*/
- debug!("schedule_clean_in_ast_scope(cleanup_scope={:?})",
+ debug!("schedule_clean_in_ast_scope(cleanup_scope={})",
cleanup_scope);
for scope in self.scopes.borrow_mut().iter_mut().rev() {
* perform all cleanups and finally branch to the `break_blk`.
*/
- debug!("trans_cleanups_to_exit_scope label={:?} scopes={}",
+ debug!("trans_cleanups_to_exit_scope label={} scopes={}",
label, self.scopes_len());
let orig_scopes_len = self.scopes_len();
LoopExit(id, _) => {
self.ccx.sess().bug(format!(
- "cannot exit from scope {:?}, \
+ "cannot exit from scope {}, \
not in scope", id).as_slice());
}
}
}
}
+#[deriving(Show)]
pub enum Heap {
HeapExchange
}
match tcx.region_maps.temporary_scope(id) {
Some(scope) => {
let r = AstScope(scope);
- debug!("temporary_scope({}) = {:?}", id, r);
+ debug!("temporary_scope({}) = {}", id, r);
r
}
None => {
id: ast::NodeId)
-> ScopeId {
let r = AstScope(tcx.region_maps.var_scope(id));
- debug!("var_scope({}) = {:?}", id, r);
+ debug!("var_scope({}) = {}", id, r);
r
}
_ => {
ccx.sess().bug(format!("get_wrapper_for_bare_fn: \
expected a statically resolved fn, got \
- {:?}",
+ {}",
def).as_slice());
}
};
Some(v) => v.clone(),
None => {
self.tcx().sess.bug(format!(
- "no def associated with node id {:?}", nid).as_slice());
+ "no def associated with node id {}", nid).as_slice());
}
}
}
unsafe {
let r = llvm::LLVMConstExtractValue(v, us.as_ptr(), us.len() as c_uint);
- debug!("const_get_elt(v={}, us={:?}, r={})",
+ debug!("const_get_elt(v={}, us={}, r={})",
cx.tn().val_to_string(v), us, cx.tn().val_to_string(r));
return r;
}
// Key used to lookup values supplied for type parameters in an expr.
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>`
ExprId(ast::NodeId),
if substs.types.any(|t| ty::type_needs_infer(*t)) {
bcx.sess().bug(
- format!("type parameters for node {:?} include inference types: \
+ format!("type parameters for node {} include inference types: \
{}",
node,
substs.repr(bcx.tcx())).as_slice());
ty::AdjustAddEnv(store) => {
cx.sess()
.span_bug(e.span,
- format!("unexpected static function: {:?}",
+ format!("unexpected static function: {}",
store).as_slice())
}
ty::AdjustDerefRef(ref adj) => {
cx.sess()
.span_bug(e.span,
format!("unimplemented const \
- autoref {:?}",
+ autoref {}",
autoref).as_slice())
}
}
els: Option<&ast::Expr>,
dest: expr::Dest)
-> Block<'blk, 'tcx> {
- debug!("trans_if(bcx={}, if_id={}, cond={}, thn={:?}, dest={})",
+ debug!("trans_if(bcx={}, if_id={}, cond={}, thn={}, dest={})",
bcx.to_str(), if_id, bcx.expr_to_string(cond), thn.id,
dest.to_string(bcx.ccx()));
let _icx = push_ctxt("trans_if");
match bcx.tcx().def_map.borrow().find(&expr_id) {
Some(&def::DefLabel(loop_id)) => loop_id,
ref r => {
- bcx.tcx().sess.bug(format!("{:?} in def-map for label",
+ bcx.tcx().sess.bug(format!("{} in def-map for label",
r).as_slice())
}
}
use middle::ty;
use util::ppaux::{ty_to_string};
+use std::fmt;
use syntax::ast;
/**
pub datum: Datum<K>,
}
+#[deriving(Show)]
pub enum Expr {
/// a fresh value that was produced and which has no cleanup yet
/// because it has not yet "landed" into its permanent home
LvalueExpr,
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct Lvalue;
+#[deriving(Show)]
pub struct Rvalue {
pub mode: RvalueMode
}
fn drop(&mut self) { }
}
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(PartialEq, Eq, Hash, Show)]
pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T)
ByRef,
/**
* Generic methods applicable to any sort of datum.
*/
-impl<K:KindOps> Datum<K> {
+impl<K: KindOps + fmt::Show> Datum<K> {
pub fn new(val: ValueRef, ty: ty::t, kind: K) -> Datum<K> {
Datum { val: val, ty: ty, kind: kind }
}
#[allow(dead_code)] // useful for debugging
pub fn to_string(&self, ccx: &CrateContext) -> String {
- format!("Datum({}, {}, {:?})",
+ format!("Datum({}, {}, {})",
ccx.tn().val_to_string(self.val),
ty_to_string(ccx.tcx(), self.ty),
self.kind)
}
}
-impl<'blk, 'tcx, K:KindOps> DatumBlock<'blk, 'tcx, K> {
+impl<'blk, 'tcx, K: KindOps + fmt::Show> DatumBlock<'blk, 'tcx, K> {
pub fn to_expr_datumblock(self) -> DatumBlock<'blk, 'tcx, Expr> {
DatumBlock::new(self.bcx, self.datum.to_expr_datum())
}
&mut unique_type_id);
},
_ => {
- cx.sess().bug(format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
+ cx.sess().bug(format!("get_unique_type_id_of_type() - unexpected type: {}, {}",
ppaux::ty_to_string(cx.tcx(), type_).as_slice(),
ty::get(type_).sty).as_slice())
}
format!("debuginfo::\
create_global_var_metadata() -
Captured var-id refers to \
- unexpected ast_item variant: {:?}",
+ unexpected ast_item variant: {}",
var_item).as_slice())
}
}
},
_ => cx.sess().bug(format!("debuginfo::create_global_var_metadata() \
- Captured var-id refers to unexpected \
- ast_map variant: {:?}",
+ ast_map variant: {}",
var_item).as_slice())
};
Some(datum) => datum,
None => {
bcx.sess().span_bug(span,
- format!("no entry in lllocals table for {:?}",
+ format!("no entry in lllocals table for {}",
node_id).as_slice());
}
};
format!(
"debuginfo::create_captured_var_metadata() - \
Captured var-id refers to unexpected \
- ast_map variant: {:?}",
+ ast_map variant: {}",
ast_item).as_slice());
}
}
.span_bug(span,
format!("debuginfo::create_captured_var_metadata() - \
Captured var-id refers to unexpected \
- ast_map variant: {:?}",
+ ast_map variant: {}",
ast_item).as_slice());
}
};
Some(v) => v,
None => {
bcx.sess().span_bug(span,
- format!("no entry in lllocals table for {:?}",
+ format!("no entry in lllocals table for {}",
node_id).as_slice());
}
};
_ => {
cx.sess()
.bug(format!("create_function_debug_context: \
- unexpected sort of node: {:?}",
+ unexpected sort of node: {}",
fnitem).as_slice())
}
}
return FunctionDebugContext { repr: FunctionWithoutDebugInfo };
}
_ => cx.sess().bug(format!("create_function_debug_context: \
- unexpected sort of node: {:?}",
+ unexpected sort of node: {}",
fnitem).as_slice())
};
}
};
- debug!("compile_unit_metadata: {:?}", compile_unit_name);
+ debug!("compile_unit_metadata: {}", compile_unit_name);
let producer = format!("rustc version {}",
(option_env!("CFG_VERSION")).expect("CFG_VERSION"));
let node = fcx.ccx.tcx().map.get(node_id);
fcx.ccx.sess().span_bug(error_reporting_span,
- format!("debuginfo: Could not find scope info for node {:?}",
+ format!("debuginfo: Could not find scope info for node {}",
node).as_slice());
}
}
fn basic_type_metadata(cx: &CrateContext, t: ty::t) -> DIType {
- debug!("basic_type_metadata: {:?}", ty::get(t));
+ debug!("basic_type_metadata: {}", ty::get(t));
let (name, encoding) = match ty::get(t).sty {
ty::ty_nil => ("()".to_string(), DW_ATE_unsigned),
}
};
- debug!("type_metadata: {:?}", ty::get(t));
+ debug!("type_metadata: {}", ty::get(t));
let sty = &ty::get(t).sty;
let MetadataCreationResult { metadata, already_stored_in_typemap } = match *sty {
usage_site_span).finalize(cx)
}
_ => {
- cx.sess().bug(format!("debuginfo: unexpected type in type_metadata: {:?}",
+ cx.sess().bug(format!("debuginfo: unexpected type in type_metadata: {}",
sty).as_slice())
}
};
Some(node) => node,
None => {
cx.sess().bug(format!("debuginfo::namespace_for_item(): \
- path too short for {:?}",
+ path too short for {}",
def_id).as_slice());
}
}
bcx.tcx().sess.span_bug(
expr.span,
format!("trans_rvalue_datum_unadjusted reached \
- fall-through case: {:?}",
+ fall-through case: {}",
expr.node).as_slice());
}
}
bcx.tcx().sess.span_bug(
expr.span,
format!("trans_rvalue_stmt_unadjusted reached \
- fall-through case: {:?}",
+ fall-through case: {}",
expr.node).as_slice());
}
}
bcx.tcx().sess.span_bug(
expr.span,
format!("trans_rvalue_dps_unadjusted reached fall-through \
- case: {:?}",
+ case: {}",
expr.node).as_slice());
}
}
}
_ => {
bcx.tcx().sess.span_bug(ref_expr.span, format!(
- "Non-DPS def {:?} referened by {}",
+ "Non-DPS def {} referened by {}",
def, bcx.node_id_to_string(ref_expr.id)).as_slice());
}
}
}
_ => {
bcx.tcx().sess.span_bug(ref_expr.span, format!(
- "trans_def_fn_unadjusted invoked on: {:?} for {}",
+ "trans_def_fn_unadjusted invoked on: {} for {}",
def,
ref_expr.repr(bcx.tcx())).as_slice());
}
Some(&val) => Datum::new(val, local_ty, Lvalue),
None => {
bcx.sess().bug(format!(
- "trans_local_var: no llval for upvar {:?} found",
+ "trans_local_var: no llval for upvar {} found",
nid).as_slice());
}
}
Some(&v) => v,
None => {
bcx.sess().bug(format!(
- "trans_local_var: no datum for local/arg {:?} found",
+ "trans_local_var: no datum for local/arg {} found",
nid).as_slice());
}
};
- debug!("take_local(nid={:?}, v={}, ty={})",
+ debug!("take_local(nid={}, v={}, ty={})",
nid, bcx.val_to_string(datum.val), bcx.ty_to_string(datum.ty));
datum
}
_ => {
bcx.sess().unimpl(format!(
- "unsupported def type in trans_local_var: {:?}",
+ "unsupported def type in trans_local_var: {}",
def).as_slice());
}
}
} else { llsrc };
}
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub enum cast_kind {
cast_pointer,
cast_integral,
cast_float => SIToFP(bcx, lldiscrim_a, ll_t_out),
_ => {
ccx.sess().bug(format!("translating unsupported cast: \
- {} ({:?}) -> {} ({:?})",
+ {} ({}) -> {} ({})",
t_in.repr(bcx.tcx()),
k_in,
t_out.repr(bcx.tcx()),
}
}
_ => ccx.sess().bug(format!("translating unsupported cast: \
- {} ({:?}) -> {} ({:?})",
+ {} ({}) -> {} ({})",
t_in.repr(bcx.tcx()),
k_in,
t_out.repr(bcx.tcx()),
let llforeign_align = machine::llalign_of_min(ccx, llforeign_ret_ty);
let llrust_align = machine::llalign_of_min(ccx, llrust_ret_ty);
let llalign = cmp::min(llforeign_align, llrust_align);
- debug!("llrust_size={:?}", llrust_size);
+ debug!("llrust_size={}", llrust_size);
base::call_memcpy(bcx, llretptr_i8, llscratch_i8,
C_uint(ccx, llrust_size as uint), llalign as u32);
}
};
let llfn = base::register_fn_llvmty(ccx, sp, sym, node_id, cconv, llfn_ty);
add_argument_attributes(&tys, llfn);
- debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
+ debug!("register_rust_fn_with_foreign_abi(node_id={}, llfn_ty={}, llfn={})",
node_id, ccx.tn().type_to_string(llfn_ty), ccx.tn().val_to_string(llfn));
llfn
}
let _icx = push_ctxt("meth::trans_impl");
let tcx = ccx.tcx();
- debug!("trans_impl(name={}, id={:?})", name.repr(tcx), id);
+ debug!("trans_impl(name={}, id={})", name.repr(tcx), id);
// Both here and below with generic methods, be sure to recurse and look for
// items that we need to translate.
let _icx = push_ctxt("meth::trans_static_method_callee");
let ccx = bcx.ccx();
- debug!("trans_static_method_callee(method_id={:?}, trait_id={}, \
- expr_id={:?})",
+ debug!("trans_static_method_callee(method_id={}, trait_id={}, \
+ expr_id={})",
method_id,
ty::item_path_str(bcx.tcx(), trait_id),
expr_id);
debug!("monomorphic_fn(\
fn_id={}, \
real_substs={}, \
- ref_id={:?})",
+ ref_id={})",
fn_id.repr(ccx.tcx()),
real_substs.repr(ccx.tcx()),
ref_id);
debug!("monomorphic_fn(\
fn_id={}, \
psubsts={}, \
- hash_id={:?})",
+ hash_id={})",
fn_id.repr(ccx.tcx()),
psubsts.repr(ccx.tcx()),
hash_id);
ccx.sess(),
ccx.tcx().map.find(fn_id.node),
|| {
- format!("while monomorphizing {:?}, couldn't find it in \
+ format!("while monomorphizing {}, couldn't find it in \
the item map (may have attempted to monomorphize \
an item defined in a different crate?)",
fn_id)
d
}
_ => {
- ccx.sess().bug(format!("can't monomorphize a {:?}",
+ ccx.sess().bug(format!("can't monomorphize a {}",
map_node).as_slice())
}
}
ast_map::NodeBlock(..) |
ast_map::NodePat(..) |
ast_map::NodeLocal(..) => {
- ccx.sess().bug(format!("can't monomorphize a {:?}",
+ ccx.sess().bug(format!("can't monomorphize a {}",
map_node).as_slice())
}
};
(lldecl, true)
}
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(PartialEq, Eq, Hash, Show)]
pub struct MonoId {
pub def: ast::DefId,
pub params: subst::VecPerParamSpace<ty::t>
// to store the array of the suitable size, so all we have to do is
// generate the content.
- debug!("trans_fixed_vstore(expr={}, dest={:?})",
+ debug!("trans_fixed_vstore(expr={}, dest={})",
bcx.expr_to_string(expr), dest.to_string(bcx.ccx()));
let vt = vec_types_from_expr(bcx, expr);
// Handle the &[...] case:
let vt = vec_types_from_expr(bcx, content_expr);
let count = elements_required(bcx, content_expr);
- debug!(" vt={}, count={:?}", vt.to_string(ccx), count);
+ debug!(" vt={}, count={}", vt.to_string(ccx), count);
let llcount = C_uint(ccx, count);
let fixed_ty = ty::mk_vec(bcx.tcx(),
let fcx = bcx.fcx;
let mut bcx = bcx;
- debug!("write_content(vt={}, dest={}, vstore_expr={:?})",
+ debug!("write_content(vt={}, dest={}, vstore_expr={})",
vt.to_string(bcx.ccx()),
dest.to_string(bcx.ccx()),
bcx.expr_to_string(vstore_expr));
let temp_scope = fcx.push_custom_cleanup_scope();
for (i, element) in elements.iter().enumerate() {
let lleltptr = GEPi(bcx, lldest, [i]);
- debug!("writing index {:?} with lleltptr={:?}",
+ debug!("writing index {} with lleltptr={}",
i, bcx.val_to_string(lleltptr));
bcx = expr::trans_into(bcx, &**element,
SaveIn(lleltptr));
None => ()
}
- debug!("type_of {} {:?}", t.repr(cx.tcx()), ty::get(t).sty);
+ debug!("type_of {} {}", t.repr(cx.tcx()), ty::get(t).sty);
// Replace any typedef'd types with their equivalent non-typedef
// type. This ensures that all LLVM nominal types that contain
if t != t_norm {
let llty = type_of(cx, t_norm);
- debug!("--> normalized {} {:?} to {} {:?} llty={}",
+ debug!("--> normalized {} {} to {} {} llty={}",
t.repr(cx.tcx()),
t,
t_norm.repr(cx.tcx()),
ty::ty_err(..) => cx.sess().bug("type_of with ty_err"),
};
- debug!("--> mapped t={} {:?} to llty={}",
+ debug!("--> mapped t={} {} to llty={}",
t.repr(cx.tcx()),
t,
cx.tn().type_to_string(llty));
pub mt: mt
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum ImplOrTraitItemContainer {
TraitContainer(ast::DefId),
ImplContainer(ast::DefId),
}
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct Method {
pub ident: ast::Ident,
pub generics: ty::Generics,
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum AutoAdjustment {
AdjustAddEnv(ty::TraitStore),
AdjustDerefRef(AutoDerefRef)
}
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub enum UnsizeKind {
// [T, ..n] -> [T], the uint field is n.
UnsizeLength(uint),
UnsizeVtable(TyTrait, /* the self type of the trait */ ty::t)
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct AutoDerefRef {
pub autoderefs: uint,
pub autoref: Option<AutoRef>
}
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, PartialEq, Show)]
pub enum AutoRef {
/// Convert from T to &T
/// The third field allows us to wrap other AutoRef adjustments.
* the original var id (that is, the root variable that is referenced
* by the upvar) and the id of the closure expression.
*/
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub struct UpvarId {
pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId,
* the closure, so sometimes it is necessary for them to be larger
* than the closure lifetime itself.
*/
-#[deriving(PartialEq, Clone, Encodable, Decodable)]
+#[deriving(PartialEq, Clone, Encodable, Decodable, Show)]
pub struct UpvarBorrow {
pub kind: BorrowKind,
pub region: ty::Region,
pub kind: UnboxedClosureKind,
}
-#[deriving(Clone, PartialEq, Eq)]
+#[deriving(Clone, PartialEq, Eq, Show)]
pub enum UnboxedClosureKind {
FnUnboxedClosureKind,
FnMutUnboxedClosureKind,
ty_bare_fn(ref f) => f.sig.variadic,
ty_closure(ref f) => f.sig.variadic,
ref s => {
- fail!("fn_is_variadic() called on non-fn type: {:?}", s)
+ fail!("fn_is_variadic() called on non-fn type: {}", s)
}
}
}
ty_bare_fn(ref f) => f.sig.clone(),
ty_closure(ref f) => f.sig.clone(),
ref s => {
- fail!("ty_fn_sig() called on non-fn type: {:?}", s)
+ fail!("ty_fn_sig() called on non-fn type: {}", s)
}
}
}
ty_bare_fn(ref f) => f.sig.inputs.clone(),
ty_closure(ref f) => f.sig.inputs.clone(),
ref s => {
- fail!("ty_fn_args() called on non-fn type: {:?}", s)
+ fail!("ty_fn_args() called on non-fn type: {}", s)
}
}
}
UniqTraitStore
}
ref s => {
- fail!("ty_closure_store() called on non-closure type: {:?}", s)
+ fail!("ty_closure_store() called on non-closure type: {}", s)
}
}
}
ty_bare_fn(ref f) => f.sig.output,
ty_closure(ref f) => f.sig.output,
ref s => {
- fail!("ty_fn_ret() called on non-fn type: {:?}", s)
+ fail!("ty_fn_ret() called on non-fn type: {}", s)
}
}
}
ref s => {
tcx.sess.span_bug(
span,
- format!("ty_region() invoked on an inappropriate ty: {:?}",
+ format!("ty_region() invoked on an inappropriate ty: {}",
s).as_slice());
}
}
e.span
}
Some(f) => {
- cx.sess.bug(format!("Node id {} is not an expr: {:?}",
+ cx.sess.bug(format!("Node id {} is not an expr: {}",
id,
f).as_slice());
}
}
_ => {
cx.sess.bug(
- format!("Variable id {} maps to {:?}, not local",
+ format!("Variable id {} maps to {}, not local",
id,
pat).as_slice());
}
}
}
r => {
- cx.sess.bug(format!("Variable id {} maps to {:?}, not local",
+ cx.sess.bug(format!("Variable id {} maps to {}, not local",
id,
r).as_slice());
}
ref b => {
cx.sess.bug(
format!("add_env adjustment on non-bare-fn: \
- {:?}",
+ {}",
b).as_slice());
}
}
Some(&def) => def,
None => {
tcx.sess.span_bug(expr.span, format!(
- "no def-map entry for expr {:?}", expr.id).as_slice());
+ "no def-map entry for expr {}", expr.id).as_slice());
}
}
}
def => {
tcx.sess.span_bug(
expr.span,
- format!("uncategorized def for expr {:?}: {:?}",
+ format!("uncategorized def for expr {}: {}",
expr.id,
def).as_slice());
}
let mut i = 0u;
for f in fields.iter() { if f.ident.name == name { return i; } i += 1u; }
tcx.sess.bug(format!(
- "no field named `{}` found in the list of fields `{:?}`",
+ "no field named `{}` found in the list of fields `{}`",
token::get_name(name),
fields.iter()
.map(|f| token::get_ident(f.ident).get().to_string())
}
if def_id.krate == ast::LOCAL_CRATE {
- fail!("No def'n found for {:?} in tcx.{}", def_id, descr);
+ fail!("No def'n found for {} in tcx.{}", def_id, descr);
}
let v = load_external();
map.insert(def_id, v.clone());
pub fn impl_trait_ref(cx: &ctxt, id: ast::DefId) -> Option<Rc<TraitRef>> {
memoized(&cx.impl_trait_cache, id, |id: ast::DefId| {
if id.krate == ast::LOCAL_CRATE {
- debug!("(impl_trait_ref) searching for trait impl {:?}", id);
+ debug!("(impl_trait_ref) searching for trait impl {}", id);
match cx.map.find(id.node) {
Some(ast_map::NodeItem(item)) => {
match item.node {
}
/// The category of explicit self.
-#[deriving(Clone, Eq, PartialEq)]
+#[deriving(Clone, Eq, PartialEq, Show)]
pub enum ExplicitSelfCategory {
StaticExplicitSelfCategory,
ByValueExplicitSelfCategory,
_ => {
tcx.sess.span_fatal(ast_ty.span,
format!("found value name used \
- as a type: {:?}",
+ as a type: {}",
a_def).as_slice());
}
}
fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(&**begin));
let e_ty =
fcx.infcx().resolve_type_vars_if_possible(fcx.expr_ty(&**end));
- debug!("pat_range beginning type: {:?}", b_ty);
- debug!("pat_range ending type: {:?}", e_ty);
+ debug!("pat_range beginning type: {}", b_ty);
+ debug!("pat_range ending type: {}", e_ty);
if !require_same_types(
tcx, Some(fcx.infcx()), false, pat.span, b_ty, e_ty,
|| "mismatched types in range".to_string())
rcvr_ty: ty::t,
restrict_to: Option<DefId>,
param_ty: ParamTy) {
- debug!("push_inherent_candidates_from_param(param_ty={:?})",
+ debug!("push_inherent_candidates_from_param(param_ty={})",
param_ty);
self.push_inherent_candidates_from_bounds(
rcvr_ty,
}
}
None => {
- debug!("trait doesn't contain method: {:?}",
+ debug!("trait doesn't contain method: {}",
bound_trait_ref.def_id);
// check next trait or bound
}
None => None,
Some(method) => {
debug!("(searching for autoderef'd method) writing \
- adjustment {:?} for {}", adjustment, self.ty_to_string(self_ty));
+ adjustment {} for {}", adjustment, self.ty_to_string(self_ty));
match adjustment {
Some((self_expr_id, adj)) => {
self.fcx.write_adjustment(self_expr_id, self.span, adj);
impl Repr for Candidate {
fn repr(&self, tcx: &ty::ctxt) -> String {
format!("Candidate(rcvr_ty={}, rcvr_substs={}, method_ty={}, \
- origin={:?})",
+ origin={})",
self.rcvr_match_condition.repr(tcx),
self.rcvr_substs.repr(tcx),
self.method_ty.repr(tcx),
None => {
self.tcx().sess.span_bug(
span,
- format!("no type for local variable {:?}",
+ format!("no type for local variable {}",
nid).as_slice());
}
}
node_id: ast::NodeId,
span: Span,
adj: ty::AutoAdjustment) {
- debug!("write_adjustment(node_id={:?}, adj={:?})", node_id, adj);
+ debug!("write_adjustment(node_id={}, adj={})", node_id, adj);
// Careful: adjustments can imply trait obligations if we are
// casting from a concrete type to an object type. I think
fn register_unsize_obligations(&self,
span: Span,
unsize: &ty::UnsizeKind) {
- debug!("register_unsize_obligations: unsize={:?}", unsize);
+ debug!("register_unsize_obligations: unsize={}", unsize);
match *unsize {
ty::UnsizeLength(..) => {}
err_args(supplied_arg_count)
};
- debug!("check_argument_types: formal_tys={:?}",
+ debug!("check_argument_types: formal_tys={}",
formal_tys.iter().map(|t| fcx.infcx().ty_to_string(*t)).collect::<Vec<String>>());
// Check the arguments.
}
}
_ => {
- tcx.sess.bug(format!("unexpected def in region_of_def: {:?}",
+ tcx.sess.bug(format!("unexpected def in region_of_def: {}",
def).as_slice())
}
}
}
fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
- debug!("regionck::visit_expr(e={}, repeating_scope={:?})",
+ debug!("regionck::visit_expr(e={}, repeating_scope={})",
expr.repr(rcx.fcx.tcx()), rcx.repeating_scope);
// No matter what, the type of each expression must outlive the
// Check any autoderefs or autorefs that appear.
for &adjustment in rcx.fcx.inh.adjustments.borrow().find(&expr.id).iter() {
- debug!("adjustment={:?}", adjustment);
+ debug!("adjustment={}", adjustment);
match *adjustment {
ty::AdjustDerefRef(ty::AutoDerefRef {autoderefs, autoref: ref opt_autoref}) => {
let expr_ty = rcx.resolve_node_type(expr.id);
debug!("constrain_free_variables({}, {})",
region_bound.repr(tcx), expr.repr(tcx));
for freevar in freevars.iter() {
- debug!("freevar def is {:?}", freevar.def);
+ debug!("freevar def is {}", freevar.def);
// Identify the variable being closed over and its node-id.
let def = freevar.def;
let tcx = rcx.fcx.tcx();
debug!("constrain_call(call_expr={}, \
receiver={}, \
- implicitly_ref_args={:?})",
+ implicitly_ref_args={})",
call_expr.repr(tcx),
receiver.repr(tcx),
implicitly_ref_args);
*/
let r_deref_expr = ty::ReScope(deref_expr.id);
for i in range(0u, derefs) {
- debug!("constrain_autoderefs(deref_expr=?, derefd_ty={}, derefs={:?}/{:?}",
+ debug!("constrain_autoderefs(deref_expr=?, derefd_ty={}, derefs={}/{}",
rcx.fcx.infcx().ty_to_string(derefd_ty),
i, derefs);
rcx.fcx.inh.adjustments.borrow().find(&id),
|method_call| rcx.resolve_method_type(method_call));
debug!("constrain_regions_in_type_of_node(\
- ty={}, ty0={}, id={}, minimum_lifetime={:?})",
+ ty={}, ty0={}, id={}, minimum_lifetime={})",
ty_to_string(tcx, ty), ty_to_string(tcx, ty0),
id, minimum_lifetime);
type_must_outlive(rcx, origin, ty, minimum_lifetime);
* to lifetimes in the value being autoref'd.
*/
- debug!("link_autoref(autoref={:?})", autoref);
+ debug!("link_autoref(autoref={})", autoref);
let mc = mc::MemCategorizationContext::new(rcx);
let expr_cmt = ignore_err!(mc.cat_expr_autoderefd(expr, autoderefs));
debug!("expr_cmt={}", expr_cmt.repr(rcx.tcx()));
* this function.
*/
- debug!("link_upvar_borrow_kind: inner_upvar_id={:?} outer_upvar_id={:?}",
+ debug!("link_upvar_borrow_kind: inner_upvar_id={} outer_upvar_id={}",
inner_upvar_id, outer_upvar_id);
let mut upvar_borrow_map = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
fn adjust_upvar_borrow_kind_for_loan(upvar_id: ty::UpvarId,
upvar_borrow: &mut ty::UpvarBorrow,
kind: ty::BorrowKind) {
- debug!("adjust_upvar_borrow_kind_for_loan: upvar_id={:?} kind={:?} -> {:?}",
+ debug!("adjust_upvar_borrow_kind_for_loan: upvar_id={} kind={} -> {}",
upvar_id, upvar_borrow.kind, kind);
adjust_upvar_borrow_kind(upvar_id, upvar_borrow, kind)
* is required by some particular use.
*/
- debug!("adjust_upvar_borrow_kind: id={:?} kind=({:?} -> {:?})",
+ debug!("adjust_upvar_borrow_kind: id={} kind=({} -> {})",
upvar_id, upvar_borrow.kind, kind);
match (upvar_borrow.kind, kind) {
})
}
};
- debug!("Adjustments for node {}: {:?}", id, resolved_adjustment);
+ debug!("Adjustments for node {}: {}", id, resolved_adjustment);
self.tcx().adjustments.borrow_mut().insert(
id, resolved_adjustment);
}
// Resolve any method map entry
match self.fcx.inh.method_map.borrow_mut().pop(&method_call) {
Some(method) => {
- debug!("writeback::resolve_method_map_entry(call={:?}, entry={})",
+ debug!("writeback::resolve_method_map_entry(call={}, entry={})",
method_call,
method.repr(self.tcx()));
let new_method = MethodCallee {
ty_str(..) | ty_vec(..) | ty_bare_fn(..) | ty_closure(..) | ty_tup(..) |
ty_infer(..) | ty_param(..) | ty_err | ty_open(..) | ty_uniq(_) |
ty_ptr(_) | ty_rptr(_, _) => {
- debug!("(getting base type) no base type; found {:?}",
+ debug!("(getting base type) no base type; found {}",
get(original_type).sty);
None
}
trait_ref: &ty::TraitRef,
all_impl_items: &mut Vec<ImplOrTraitItemId>) {
let tcx = self.crate_context.tcx;
- debug!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
+ debug!("instantiate_default_methods(impl_id={}, trait_ref={})",
impl_id, trait_ref.repr(tcx));
let impl_poly_type = ty::lookup_item_type(tcx, impl_id);
let new_id = tcx.sess.next_node_id();
let new_did = local_def(new_id);
- debug!("new_did={:?} trait_method={}", new_did, trait_method.repr(tcx));
+ debug!("new_did={} trait_method={}", new_did, trait_method.repr(tcx));
// Create substitutions for the various trait parameters.
let new_method_ty =
}
x => {
self.tcx.sess.bug(format!("unexpected sort of node \
- in get_item_ty(): {:?}",
+ in get_item_ty(): {}",
x).as_slice());
}
}
ref s => {
tcx.sess.span_bug(
it.span,
- format!("trait_def_of_item invoked on {:?}", s).as_slice());
+ format!("trait_def_of_item invoked on {}", s).as_slice());
}
};
self.get_ref().infcx.tcx.sess.span_bug(
self.get_ref().trace.origin.span(),
format!("failed to resolve even without \
- any force options: {:?}", e).as_slice());
+ any force options: {}", e).as_slice());
}
}
}
b: ty::t,
mutbl_b: ast::Mutability)
-> CoerceResult {
- debug!("coerce_borrowed_pointer(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_pointer(a={}, sty_a={}, b={})",
a.repr(self.get_ref().infcx.tcx), sty_a,
b.repr(self.get_ref().infcx.tcx));
b: ty::t,
mutbl_b: ast::Mutability)
-> CoerceResult {
- debug!("coerce_unsized_with_borrow(a={}, sty_a={:?}, b={})",
+ debug!("coerce_unsized_with_borrow(a={}, sty_a={}, b={})",
a.repr(self.get_ref().infcx.tcx), sty_a,
b.repr(self.get_ref().infcx.tcx));
sty_a: &ty::sty,
b: ty::t)
-> CoerceResult {
- debug!("coerce_unsized(a={}, sty_a={:?}, b={})",
+ debug!("coerce_unsized(a={}, sty_a={}, b={})",
a.repr(self.get_ref().infcx.tcx), sty_a,
b.repr(self.get_ref().infcx.tcx));
ty::mt{ty: ty, mutbl: mt_b.mutbl});
try!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \
- AutoPtr(AutoUnsize({:?})))", kind);
+ AutoPtr(AutoUnsize({})))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1,
autoref: Some(ty::AutoPtr(r_borrow, mt_b.mutbl,
ty::mt{ty: ty, mutbl: mt_b.mutbl});
try!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \
- AutoPtr(AutoUnsize({:?})))", kind);
+ AutoPtr(AutoUnsize({})))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1,
autoref: Some(ty::AutoUnsafe(mt_b.mutbl,
let ty = ty::mk_uniq(self.get_ref().infcx.tcx, ty);
try!(self.get_ref().infcx.try(|| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \
- AutoUnsizeUniq({:?}))", kind);
+ AutoUnsizeUniq({}))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1,
autoref: Some(ty::AutoUnsizeUniq(kind))
sty_a: &ty::sty,
ty_b: ty::t)
-> Option<(ty::t, ty::UnsizeKind)> {
- debug!("unsize_ty(sty_a={:?}, ty_b={})", sty_a, ty_b.repr(self.get_ref().infcx.tcx));
+ debug!("unsize_ty(sty_a={}, ty_b={})", sty_a, ty_b.repr(self.get_ref().infcx.tcx));
let tcx = self.get_ref().infcx.tcx;
{
let tcx = self.get_ref().infcx.tcx;
- debug!("coerce_borrowed_object(a={}, sty_a={:?}, b={}, b_mutbl={})",
+ debug!("coerce_borrowed_object(a={}, sty_a={}, b={}, b_mutbl={})",
a.repr(tcx), sty_a,
b.repr(tcx), b_mutbl);
{
let tcx = self.get_ref().infcx.tcx;
- debug!("coerce_unsafe_object(a={}, sty_a={:?}, b={}, b_mutbl={})",
+ debug!("coerce_unsafe_object(a={}, sty_a={}, b={}, b_mutbl={})",
a.repr(tcx), sty_a,
b.repr(tcx), b_mutbl);
sty_a: &ty::sty,
b: ty::t)
-> CoerceResult {
- debug!("coerce_borrowed_fn(a={}, sty_a={:?}, b={})",
+ debug!("coerce_borrowed_fn(a={}, sty_a={}, b={})",
a.repr(self.get_ref().infcx.tcx), sty_a,
b.repr(self.get_ref().infcx.tcx));
b: ty::t,
mutbl_b: ast::Mutability)
-> CoerceResult {
- debug!("coerce_unsafe_ptr(a={}, sty_a={:?}, b={})",
+ debug!("coerce_unsafe_ptr(a={}, sty_a={}, b={})",
a.repr(self.get_ref().infcx.tcx), sty_a,
b.repr(self.get_ref().infcx.tcx));
let tcx = this.infcx().tcx;
let a_sty = &ty::get(a).sty;
let b_sty = &ty::get(b).sty;
- debug!("super_tys: a_sty={:?} b_sty={:?}", a_sty, b_sty);
+ debug!("super_tys: a_sty={} b_sty={}", a_sty, b_sty);
return match (a_sty, b_sty) {
// The "subtype" ought to be handling cases involving bot or var:
(&ty::ty_bot, _) |
(&ty::ty_trait(ref a_),
&ty::ty_trait(ref b_))
if a_.def_id == b_.def_id => {
- debug!("Trying to match traits {:?} and {:?}", a, b);
+ debug!("Trying to match traits {} and {}", a, b);
let substs = try!(this.substs(a_.def_id, &a_.substs, &b_.substs));
let bounds = try!(this.existential_bounds(a_.bounds, b_.bounds));
Ok(ty::mk_trait(tcx,
}
}
let pe = ProcessedErrors(var_origins, trace_origins, same_regions);
- debug!("errors processed: {:?}", pe);
+ debug!("errors processed: {}", pe);
processed_errors.push(pe);
}
return processed_errors;
sub: Region,
sup: Region)
-> Option<FreeRegionsFromSameFn> {
- debug!("free_regions_from_same_fn(sub={:?}, sup={:?})", sub, sup);
+ debug!("free_regions_from_same_fn(sub={}, sup={})", sub, sup);
let (scope_id, fr1, fr2) = match (sub, sup) {
(ReFree(fr1), ReFree(fr2)) => {
if fr1.scope_id != fr2.scope_id {
}
fn regions(&self, a: ty::Region, b: ty::Region) -> cres<ty::Region> {
- debug!("{}.regions({:?}, {:?})",
+ debug!("{}.regions({}, {})",
self.tag(),
a.repr(self.fields.infcx.tcx),
b.repr(self.fields.infcx.tcx));
// Note: this is a subtle algorithm. For a full explanation,
// please see the large comment in `region_inference.rs`.
- debug!("{}.fn_sigs({:?}, {:?})",
+ debug!("{}.fn_sigs({}, {})",
self.tag(), a.repr(self.fields.infcx.tcx), b.repr(self.fields.infcx.tcx));
let _indenter = indenter();
}
this.fields.infcx.tcx.sess.span_bug(
this.fields.trace.origin.span(),
- format!("could not find original bound region for {:?}",
+ format!("could not find original bound region for {}",
r).as_slice())
}
r => {
this.infcx().tcx.sess.span_bug(
this.trace().origin.span(),
- format!("found non-region-vid: {:?}", r).as_slice());
+ format!("found non-region-vid: {}", r).as_slice());
}
}).collect()
}
// Regions that pre-dated the LUB computation stay as they are.
if !is_var_in_set(new_vars, r0) {
assert!(!r0.is_bound());
- debug!("generalize_region(r0={:?}): not new variable", r0);
+ debug!("generalize_region(r0={}): not new variable", r0);
return r0;
}
// *related* to regions that pre-date the LUB computation
// stay as they are.
if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) {
- debug!("generalize_region(r0={:?}): \
- non-new-variables found in {:?}",
+ debug!("generalize_region(r0={}): \
+ non-new-variables found in {}",
r0, tainted);
assert!(!r0.is_bound());
return r0;
// with.
for (a_br, a_r) in a_map.iter() {
if tainted.iter().any(|x| x == a_r) {
- debug!("generalize_region(r0={:?}): \
- replacing with {:?}, tainted={:?}",
+ debug!("generalize_region(r0={}): \
+ replacing with {}, tainted={}",
r0, *a_br, tainted);
return ty::ReLateBound(new_scope, *a_br);
}
this.fields.infcx.tcx.sess.span_bug(
this.fields.trace.origin.span(),
- format!("region {:?} is not associated with \
+ format!("region {} is not associated with \
any bound region from A!",
r0).as_slice())
}
/// Why did we require that the two types be related?
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum TypeOrigin {
// Not yet categorized in a better way
Misc(Span),
}
/// See `error_reporting.rs` for more details
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum ValuePairs {
Types(ty::expected_found<ty::t>),
TraitRefs(ty::expected_found<Rc<ty::TraitRef>>),
/// encounter an error or subtyping constraint.
///
/// See `error_reporting.rs` for more details.
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct TypeTrace {
origin: TypeOrigin,
values: ValuePairs,
/// The origin of a `r1 <= r2` constraint.
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum SubregionOrigin {
// Arose from a subtyping relation
Subtype(TypeTrace),
/// Reasons to create a region inference variable
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum RegionVariableOrigin {
// Region variables created for ill-categorized reasons,
// mostly indicates places in need of refactoring
expected_ty: Option<ty::t>,
actual_ty: String,
err: Option<&ty::type_err>) {
- debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty);
+ debug!("hi! expected_ty = {}, actual_ty = {}", expected_ty, actual_ty);
let error_str = err.map_or("".to_string(), |t_err| {
format!(" ({})", ty::type_err_to_str(self.tcx, t_err))
replace_late_bound_regions_in_fn_sig(self.tcx, fsig, |br| {
let rvar = self.next_region_var(
BoundRegionInFnType(trace.origin.span(), br));
- debug!("Bound region {} maps to {:?}",
+ debug!("Bound region {} maps to {}",
bound_region_to_string(self.tcx, "", false, br),
rvar);
rvar
}
Reborrow(a) => format!("Reborrow({})", a.repr(tcx)),
ReborrowUpvar(a, b) => {
- format!("ReborrowUpvar({},{:?})", a.repr(tcx), b)
+ format!("ReborrowUpvar({},{})", a.repr(tcx), b)
}
ReferenceOutlivesReferent(_, a) => {
format!("ReferenceOutlivesReferent({})", a.repr(tcx))
Lub, Glb
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum RegionResolutionError {
/// `ConcreteFailure(o, a, b)`:
///
/// ```
/// would report an error because we expect 'a and 'b to match, and so we group
/// 'a and 'b together inside a SameRegions struct
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct SameRegions {
pub scope_id: ast::NodeId,
pub regions: Vec<BoundRegion>
let (skol_map, b_sig) = {
replace_late_bound_regions_in_fn_sig(self.fields.infcx.tcx, b, |br| {
let skol = self.fields.infcx.region_vars.new_skolemized(br);
- debug!("Bound region {} skolemized to {:?}",
+ debug!("Bound region {} skolemized to {}",
bound_region_to_string(self.fields.infcx.tcx, "", false, br),
skol);
skol
pub fn make_lub_ty(&self, t1: ty::t, t2: ty::t) -> ty::t {
match self.lub().tys(t1, t2) {
Ok(t) => t,
- Err(ref e) => fail!("unexpected error computing LUB: {:?}",
+ Err(ref e) => fail!("unexpected error computing LUB: {}",
ty::type_err_to_str(self.infcx.tcx, e))
}
}
self.ty_to_string(t_glb));
match self.glb().tys(t1, t2) {
Err(e) => {
- fail!("unexpected error computing LUB: {:?}", e)
+ fail!("unexpected error computing LUB: {}", e)
}
Ok(t) => {
self.assert_eq(t, t_glb);
pub mod coherence;
pub mod variance;
-#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd)]
+#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd, Show)]
pub struct param_index {
pub space: subst::ParamSpace,
pub index: uint
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub enum MethodOrigin {
// fully statically resolved method
MethodStatic(ast::DefId),
// details for a method invoked with a receiver whose type is a type parameter
// with a bounded trait.
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct MethodParam {
// the precise trait reference that occurs as a bound -- this may
// be a supertrait of what the user actually typed.
}
// details for a method invoked with a receiver whose type is an object
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct MethodObject {
// the (super)trait containing the method to be invoked
pub trait_ref: Rc<ty::TraitRef>,
fn repr(&self, tcx: &ty::ctxt) -> String {
match *self {
vtable_static(def_id, ref tys, ref vtable_res) => {
- format!("vtable_static({:?}:{}, {}, {})",
+ format!("vtable_static({}:{}, {}, {})",
def_id,
ty::item_path_str(tcx, def_id),
tys.repr(tcx),
}
vtable_param(x, y) => {
- format!("vtable_param({:?}, {:?})", x, y)
+ format!("vtable_param({}, {})", x, y)
}
vtable_unboxed_closure(def_id) => {
type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
+#[deriving(Show)]
struct InferredIndex(uint);
enum VarianceTerm<'a> {
assert!(newly_added);
debug!("add_inferred(item_id={}, \
- kind={:?}, \
+ kind={}, \
index={}, \
param_id={},
- inf_index={:?})",
+ inf_index={})",
item_id, kind, index, param_id, inf_index);
}
region_param_defs: &[ty::RegionParameterDef],
substs: &subst::Substs,
variance: VarianceTermPtr<'a>) {
- debug!("add_constraints_from_substs(def_id={:?})", def_id);
+ debug!("add_constraints_from_substs(def_id={})", def_id);
for p in type_param_defs.iter() {
let variance_decl =
use std::cell::RefCell;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
+use std::fmt::Show;
use syntax::ast;
use syntax::visit;
use syntax::visit::Visitor;
rv
}
-pub fn indent<R>(op: || -> R) -> R {
+pub fn indent<R: Show>(op: || -> R) -> R {
// Use in conjunction with the log post-processor like `src/etc/indenter`
// to make debug output more readable.
debug!(">>");
let r = op();
- debug!("<< (Result = {:?})", r);
+ debug!("<< (Result = {})", r);
r
}
// I believe these cases should not occur (except when debugging,
// perhaps)
ty::ReInfer(_) | ty::ReLateBound(..) => {
- (format!("lifetime {:?}", region), None)
+ (format!("lifetime {}", region), None)
}
};
impl Repr for def::Def {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
Some(ast_map::NodeVariant(..)) |
Some(ast_map::NodeStructCtor(..)) => {
return format!(
- "{:?}:{}",
+ "{}:{}",
*self,
ty::item_path_str(tcx, *self))
}
_ => {}
}
}
- return format!("{:?}", *self)
+ return format!("{}", *self)
}
}
impl Repr for ast::ExplicitSelf_ {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ast::Visibility {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ty::BareFnTy {
fn repr(&self, tcx: &ctxt) -> String {
- format!("BareFnTy {{fn_style: {:?}, abi: {}, sig: {}}}",
+ format!("BareFnTy {{fn_style: {}, abi: {}, sig: {}}}",
self.fn_style,
self.abi.to_string(),
self.sig.repr(tcx))
impl Repr for typeck::MethodObject {
fn repr(&self, tcx: &ctxt) -> String {
- format!("MethodObject({},{:?},{:?})",
+ format!("MethodObject({},{},{})",
self.trait_ref.repr(tcx),
self.method_num,
self.real_index)
impl Repr for ty::BuiltinBound {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ast::Mutability {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ty::BorrowKind {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ty::IntVarValue {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ast::IntTy {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ast::UintTy {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}
impl Repr for ast::FloatTy {
fn repr(&self, _tcx: &ctxt) -> String {
- format!("{:?}", *self)
+ format!("{}", *self)
}
}