Skip to content

Commit 814586b

Browse files
committed
librustc: Remove all uses of {:?}.
1 parent 26e547a commit 814586b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+386
-341
lines changed

src/librustc/driver/pretty.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ pub fn pretty_print_input(sess: Session,
518518
}
519519
None => {
520520
let message = format!("--pretty=flowgraph needs \
521-
block, fn, or method; got {:?}",
521+
block, fn, or method; got {}",
522522
node);
523523

524524
// point to what was found, if there's an
@@ -542,7 +542,6 @@ fn print_flowgraph<W:io::Writer>(variants: Vec<borrowck_dot::Variant>,
542542
blocks::BlockCode(block) => cfg::CFG::new(ty_cx, &*block),
543543
blocks::FnLikeCode(fn_like) => cfg::CFG::new(ty_cx, &*fn_like.body()),
544544
};
545-
debug!("cfg: {:?}", cfg);
546545

547546
match code {
548547
_ if variants.len() == 0 => {

src/librustc/metadata/csearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ pub fn get_field_type(tcx: &ty::ctxt, class_id: ast::DefId,
226226
let class_doc = expect(tcx.sess.diagnostic(),
227227
decoder::maybe_find_item(class_id.node, all_items),
228228
|| {
229-
(format!("get_field_type: class ID {:?} not found",
229+
(format!("get_field_type: class ID {} not found",
230230
class_id)).to_string()
231231
});
232232
let the_field = expect(tcx.sess.diagnostic(),
233233
decoder::maybe_find_item(def.node, class_doc),
234234
|| {
235-
(format!("get_field_type: in class {:?}, field ID {:?} not found",
235+
(format!("get_field_type: in class {}, field ID {} not found",
236236
class_id,
237237
def)).to_string()
238238
});

src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ fn encode_symbol(ecx: &EncodeContext,
256256
rbml_w.start_tag(tag_items_data_item_symbol);
257257
match ecx.item_symbols.borrow().find(&id) {
258258
Some(x) => {
259-
debug!("encode_symbol(id={:?}, str={})", id, *x);
259+
debug!("encode_symbol(id={}, str={})", id, *x);
260260
rbml_w.writer.write(x.as_bytes());
261261
}
262262
None => {
@@ -308,7 +308,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
308308
id: NodeId,
309309
variants: &[P<Variant>],
310310
index: &mut Vec<entry<i64>>) {
311-
debug!("encode_enum_variant_info(id={:?})", id);
311+
debug!("encode_enum_variant_info(id={})", id);
312312

313313
let mut disr_val = 0;
314314
let mut i = 0;
@@ -592,7 +592,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
592592
ItemImpl(..) => {
593593
let (ident, did) = (item.ident, item.id);
594594
debug!("(encoding info for module) ... encoding impl {} \
595-
({:?}/{:?})",
595+
({}/{})",
596596
token::get_ident(ident),
597597
did, ecx.tcx.map.node_to_string(did));
598598

@@ -853,7 +853,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
853853
parent_id: NodeId,
854854
ast_item_opt: Option<&ImplItem>) {
855855

856-
debug!("encode_info_for_method: {:?} {}", m.def_id,
856+
debug!("encode_info_for_method: {} {}", m.def_id,
857857
token::get_ident(m.ident));
858858
rbml_w.start_tag(tag_items_data_item);
859859

src/librustc/metadata/filesearch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a> FileSearch<'a> {
3939
let mut visited_dirs = HashSet::new();
4040
let mut found = false;
4141

42-
debug!("filesearch: searching additional lib search paths [{:?}]",
42+
debug!("filesearch: searching additional lib search paths [{}]",
4343
self.addl_lib_search_paths.borrow().len());
4444
for path in self.addl_lib_search_paths.borrow().iter() {
4545
match f(path) {
@@ -66,7 +66,7 @@ impl<'a> FileSearch<'a> {
6666
for path in rustpath.iter() {
6767
let tlib_path = make_rustpkg_lib_path(
6868
self.sysroot, path, self.triple);
69-
debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
69+
debug!("is {} in visited_dirs? {}", tlib_path.display(),
7070
visited_dirs.contains_equiv(&tlib_path.as_vec().to_vec()));
7171

7272
if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {

src/librustc/metadata/tydecode.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use syntax::parse::token;
4343
// def-id will depend on where it originated from. Therefore, the conversion
4444
// function is given an indicator of the source of the def-id. See
4545
// astencode.rs for more information.
46+
#[deriving(Show)]
4647
pub enum DefIdSource {
4748
// Identifies a struct, trait, enum, etc.
4849
NominalType,
@@ -390,7 +391,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
390391
}
391392
'p' => {
392393
let did = parse_def(st, TypeParameter, |x,y| conv(x,y));
393-
debug!("parsed ty_param: did={:?}", did);
394+
debug!("parsed ty_param: did={}", did);
394395
let index = parse_uint(st);
395396
assert_eq!(next(st), '|');
396397
let space = parse_param_space(st);
@@ -603,12 +604,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
603604

604605
let crate_num = match uint::parse_bytes(crate_part, 10u) {
605606
Some(cn) => cn as ast::CrateNum,
606-
None => fail!("internal error: parse_def_id: crate number expected, found {:?}",
607+
None => fail!("internal error: parse_def_id: crate number expected, found {}",
607608
crate_part)
608609
};
609610
let def_num = match uint::parse_bytes(def_part, 10u) {
610611
Some(dn) => dn as ast::NodeId,
611-
None => fail!("internal error: parse_def_id: id expected, found {:?}",
612+
None => fail!("internal error: parse_def_id: id expected, found {}",
612613
def_part)
613614
};
614615
ast::DefId { krate: crate_num, node: def_num }

src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
18071807
NominalType | TypeWithId | RegionParameter => dcx.tr_def_id(did),
18081808
TypeParameter => dcx.tr_intern_def_id(did)
18091809
};
1810-
debug!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r);
1810+
debug!("convert_def_id(source={}, did={})={}", source, did, r);
18111811
return r;
18121812
}
18131813
}
@@ -1841,7 +1841,7 @@ fn decode_side_tables(dcx: &DecodeContext,
18411841
}
18421842
c::tag_table_node_type => {
18431843
let ty = val_dsr.read_ty(dcx);
1844-
debug!("inserting ty for node {:?}: {}",
1844+
debug!("inserting ty for node {}: {}",
18451845
id, ty_to_string(dcx.tcx, ty));
18461846
dcx.tcx.node_types.borrow_mut().insert(id as uint, ty);
18471847
}

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'a, 'tcx> euv::Delegate for CheckLoanCtxt<'a, 'tcx> {
119119
loan_cause: euv::LoanCause)
120120
{
121121
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
122-
bk={}, loan_cause={:?})",
122+
bk={}, loan_cause={})",
123123
borrow_id, cmt.repr(self.tcx()), loan_region,
124124
bk, loan_cause);
125125

@@ -185,7 +185,7 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
185185
all_loans: &[Loan],
186186
decl: &ast::FnDecl,
187187
body: &ast::Block) {
188-
debug!("check_loans(body id={:?})", body.id);
188+
debug!("check_loans(body id={})", body.id);
189189

190190
let mut clcx = CheckLoanCtxt {
191191
bccx: bccx,
@@ -336,10 +336,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
336336
//! issued when we enter `scope_id` (for example, we do not
337337
//! permit two `&mut` borrows of the same variable).
338338
339-
debug!("check_for_conflicting_loans(scope_id={:?})", scope_id);
339+
debug!("check_for_conflicting_loans(scope_id={})", scope_id);
340340

341341
let new_loan_indices = self.loans_generated_by(scope_id);
342-
debug!("new_loan_indices = {:?}", new_loan_indices);
342+
debug!("new_loan_indices = {}", new_loan_indices);
343343

344344
self.each_issued_loan(scope_id, |issued_loan| {
345345
for &new_loan_index in new_loan_indices.iter() {
@@ -651,7 +651,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
651651
use_path: &LoanPath,
652652
borrow_kind: ty::BorrowKind)
653653
-> UseError {
654-
debug!("analyze_restrictions_on_use(expr_id={:?}, use_path={})",
654+
debug!("analyze_restrictions_on_use(expr_id={}, use_path={})",
655655
self.tcx().map.node_to_string(expr_id),
656656
use_path.repr(self.tcx()));
657657

@@ -679,7 +679,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
679679
* is using a moved/uninitialized value
680680
*/
681681

682-
debug!("check_if_path_is_moved(id={:?}, use_kind={:?}, lp={})",
682+
debug!("check_if_path_is_moved(id={}, use_kind={}, lp={})",
683683
id, use_kind, lp.repr(self.bccx.tcx));
684684
let base_lp = owned_ptr_base_path_rc(lp);
685685
self.move_data.each_move_of(id, &base_lp, |the_move, moved_lp| {

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a, 'tcx> euv::Delegate for GatherLoanCtxt<'a, 'tcx> {
112112
loan_cause: euv::LoanCause)
113113
{
114114
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
115-
bk={}, loan_cause={:?})",
115+
bk={}, loan_cause={})",
116116
borrow_id, cmt.repr(self.tcx()), loan_region,
117117
bk, loan_cause);
118118

@@ -218,8 +218,8 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
218218
* dynamically that they are not freed.
219219
*/
220220

221-
debug!("guarantee_valid(borrow_id={:?}, cmt={}, \
222-
req_mutbl={:?}, loan_region={:?})",
221+
debug!("guarantee_valid(borrow_id={}, cmt={}, \
222+
req_mutbl={}, loan_region={})",
223223
borrow_id,
224224
cmt.repr(self.tcx()),
225225
req_kind,
@@ -257,7 +257,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
257257
self.bccx, borrow_span, cause,
258258
cmt.clone(), loan_region);
259259

260-
debug!("guarantee_valid(): restrictions={:?}", restr);
260+
debug!("guarantee_valid(): restrictions={}", restr);
261261

262262
// Create the loan record (if needed).
263263
let loan = match restr {
@@ -289,17 +289,17 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
289289
ty::ReInfer(..) => {
290290
self.tcx().sess.span_bug(
291291
cmt.span,
292-
format!("invalid borrow lifetime: {:?}",
292+
format!("invalid borrow lifetime: {}",
293293
loan_region).as_slice());
294294
}
295295
};
296-
debug!("loan_scope = {:?}", loan_scope);
296+
debug!("loan_scope = {}", loan_scope);
297297

298298
let gen_scope = self.compute_gen_scope(borrow_id, loan_scope);
299-
debug!("gen_scope = {:?}", gen_scope);
299+
debug!("gen_scope = {}", gen_scope);
300300

301301
let kill_scope = self.compute_kill_scope(loan_scope, &*loan_path);
302-
debug!("kill_scope = {:?}", kill_scope);
302+
debug!("kill_scope = {}", kill_scope);
303303

304304
if req_kind == ty::MutBorrow {
305305
self.mark_loan_path_as_mutated(&*loan_path);
@@ -318,7 +318,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
318318
}
319319
};
320320

321-
debug!("guarantee_valid(borrow_id={:?}), loan={}",
321+
debug!("guarantee_valid(borrow_id={}), loan={}",
322322
borrow_id, loan.repr(self.tcx()));
323323

324324
// let loan_path = loan.loan_path;

src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use util::ppaux::Repr;
2121

2222
use std::rc::Rc;
2323

24+
#[deriving(Show)]
2425
pub enum RestrictionResult {
2526
Safe,
2627
SafeIf(Rc<LoanPath>, Vec<Rc<LoanPath>>)

src/librustc/middle/borrowck/mod.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ impl Loan {
264264
}
265265
}
266266

267-
#[deriving(PartialEq, Eq, Hash)]
267+
#[deriving(PartialEq, Eq, Hash, Show)]
268268
pub enum LoanPath {
269269
LpVar(ast::NodeId), // `x` in doc.rs
270270
LpUpvar(ty::UpvarId), // `x` captured by-value into closure
271271
LpExtend(Rc<LoanPath>, mc::MutabilityCategory, LoanPathElem)
272272
}
273273

274-
#[deriving(PartialEq, Eq, Hash)]
274+
#[deriving(PartialEq, Eq, Hash, Show)]
275275
pub enum LoanPathElem {
276276
LpDeref(mc::PointerKind), // `*LV` in doc.rs
277277
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
@@ -421,6 +421,7 @@ pub enum AliasableViolationKind {
421421
BorrowViolation(euv::LoanCause)
422422
}
423423

424+
#[deriving(Show)]
424425
pub enum MovedValueUseKind {
425426
MovedInUse,
426427
MovedInCapture,
@@ -530,8 +531,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
530531
(ty::expr_ty_adjusted(self.tcx, &*expr), expr.span)
531532
}
532533
r => {
533-
self.tcx.sess.bug(format!("MoveExpr({:?}) maps to \
534-
{:?}, not Expr",
534+
self.tcx.sess.bug(format!("MoveExpr({}) maps to \
535+
{}, not Expr",
535536
the_move.id,
536537
r).as_slice())
537538
}
@@ -566,8 +567,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
566567
(ty::expr_ty_adjusted(self.tcx, &*expr), expr.span)
567568
}
568569
r => {
569-
self.tcx.sess.bug(format!("Captured({:?}) maps to \
570-
{:?}, not Expr",
570+
self.tcx.sess.bug(format!("Captured({}) maps to \
571+
{}, not Expr",
571572
the_move.id,
572573
r).as_slice())
573574
}
@@ -892,7 +893,7 @@ impl DataFlowOperator for LoanDataFlowOperator {
892893

893894
impl Repr for Loan {
894895
fn repr(&self, tcx: &ty::ctxt) -> String {
895-
format!("Loan_{:?}({}, {:?}, {:?}-{:?}, {})",
896+
format!("Loan_{}({}, {}, {}-{}, {})",
896897
self.index,
897898
self.loan_path.repr(tcx),
898899
self.kind,

src/librustc/middle/borrowck/move_data.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct FlowedMoveData<'a, 'tcx: 'a> {
6868
}
6969

7070
/// Index into `MoveData.paths`, used like a pointer
71-
#[deriving(PartialEq)]
71+
#[deriving(PartialEq, Show)]
7272
pub struct MovePathIndex(uint);
7373

7474
impl MovePathIndex {
@@ -120,7 +120,7 @@ pub struct MovePath {
120120
pub next_sibling: MovePathIndex,
121121
}
122122

123-
#[deriving(PartialEq)]
123+
#[deriving(PartialEq, Show)]
124124
pub enum MoveKind {
125125
Declared, // When declared, variables start out "moved".
126126
MoveExpr, // Expression or binding that moves a variable
@@ -284,7 +284,7 @@ impl MoveData {
284284
}
285285
};
286286

287-
debug!("move_path(lp={}, index={:?})",
287+
debug!("move_path(lp={}, index={})",
288288
lp.repr(tcx),
289289
index);
290290

@@ -341,7 +341,7 @@ impl MoveData {
341341
* location `id` with kind `kind`.
342342
*/
343343

344-
debug!("add_move(lp={}, id={:?}, kind={:?})",
344+
debug!("add_move(lp={}, id={}, kind={})",
345345
lp.repr(tcx),
346346
id,
347347
kind);
@@ -372,7 +372,7 @@ impl MoveData {
372372
* location `id` with the given `span`.
373373
*/
374374

375-
debug!("add_assignment(lp={}, assign_id={:?}, assignee_id={:?}",
375+
debug!("add_assignment(lp={}, assign_id={}, assignee_id={}",
376376
lp.repr(tcx), assign_id, assignee_id);
377377

378378
let path_index = self.move_path(tcx, lp.clone());
@@ -391,12 +391,12 @@ impl MoveData {
391391
};
392392

393393
if self.is_var_path(path_index) {
394-
debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
394+
debug!("add_assignment[var](lp={}, assignment={}, path_index={})",
395395
lp.repr(tcx), self.var_assignments.borrow().len(), path_index);
396396

397397
self.var_assignments.borrow_mut().push(assignment);
398398
} else {
399-
debug!("add_assignment[path](lp={}, path_index={:?})",
399+
debug!("add_assignment[path](lp={}, path_index={})",
400400
lp.repr(tcx), path_index);
401401

402402
self.path_assignments.borrow_mut().push(assignment);

0 commit comments

Comments
 (0)