Skip to content

Commit 2c1c8b4

Browse files
committed
---
yaml --- r: 273837 b: refs/heads/beta c: bcdaccf h: refs/heads/master i: 273835: 7379f31
1 parent b3c253a commit 2c1c8b4

File tree

22 files changed

+163
-177
lines changed

22 files changed

+163
-177
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 859b5a141c14ee875dcc1d061f4c94378a989844
26+
refs/heads/beta: bcdaccfbbec562e8fb927359deada166d15dcf58
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/cfg/construct.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
583583
return *l;
584584
}
585585
}
586-
self.tcx.sess.span_bug(expr.span,
587-
&format!("no loop scope for id {}", loop_id));
586+
span_bug!(expr.span, "no loop scope for id {}", loop_id);
588587
}
589588

590589
r => {
591-
self.tcx.sess.span_bug(expr.span,
592-
&format!("bad entry `{:?}` in def_map for label", r));
590+
span_bug!(expr.span, "bad entry `{:?}` in def_map for label", r);
593591
}
594592
}
595593
}

branches/beta/src/librustc/infer/combine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ impl<'cx, 'tcx> ty::fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
339339
// Early-bound regions should really have been substituted away before
340340
// we get to this point.
341341
ty::ReEarlyBound(..) => {
342-
self.tcx().sess.span_bug(
342+
span_bug!(
343343
self.span,
344-
&format!("Encountered early bound region when generalizing: {:?}",
345-
r));
344+
"Encountered early bound region when generalizing: {:?}",
345+
r);
346346
}
347347

348348
// Always make a fresh region variable for skolemized regions;

branches/beta/src/librustc/infer/higher_ranked/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,10 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
183183
}
184184
}
185185

186-
infcx.tcx.sess.span_bug(
186+
span_bug!(
187187
span,
188-
&format!("region {:?} is not associated with \
189-
any bound region from A!",
190-
r0))
188+
"region {:?} is not associated with any bound region from A!",
189+
r0)
191190
}
192191
}
193192

@@ -297,7 +296,7 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
297296

298297
if a_r.is_some() && b_r.is_some() && only_new_vars {
299298
// Related to exactly one bound variable from each fn:
300-
return rev_lookup(infcx, span, a_map, a_r.unwrap());
299+
return rev_lookup(span, a_map, a_r.unwrap());
301300
} else if a_r.is_none() && b_r.is_none() {
302301
// Not related to bound variables from either fn:
303302
assert!(!r0.is_bound());
@@ -308,8 +307,7 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
308307
}
309308
}
310309

311-
fn rev_lookup(infcx: &InferCtxt,
312-
span: Span,
310+
fn rev_lookup(span: Span,
313311
a_map: &FnvHashMap<ty::BoundRegion, ty::Region>,
314312
r: ty::Region) -> ty::Region
315313
{
@@ -318,9 +316,10 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
318316
return ty::ReLateBound(ty::DebruijnIndex::new(1), *a_br);
319317
}
320318
}
321-
infcx.tcx.sess.span_bug(
319+
span_bug!(
322320
span,
323-
&format!("could not find original bound region for {:?}", r));
321+
"could not find original bound region for {:?}",
322+
r);
324323
}
325324

326325
fn fresh_bound_variable(infcx: &InferCtxt, debruijn: ty::DebruijnIndex) -> ty::Region {
@@ -336,9 +335,10 @@ fn var_ids<'a, 'tcx>(fields: &CombineFields<'a, 'tcx>,
336335
.map(|(_, r)| match *r {
337336
ty::ReVar(r) => { r }
338337
r => {
339-
fields.tcx().sess.span_bug(
338+
span_bug!(
340339
fields.trace.origin.span(),
341-
&format!("found non-region-vid: {:?}", r));
340+
"found non-region-vid: {:?}",
341+
r);
342342
}
343343
})
344344
.collect()

branches/beta/src/librustc/infer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,10 @@ pub fn drain_fulfillment_cx_or_panic<'a,'tcx,T>(span: Span,
536536
match drain_fulfillment_cx(infcx, fulfill_cx, result) {
537537
Ok(v) => v,
538538
Err(errors) => {
539-
infcx.tcx.sess.span_bug(
539+
span_bug!(
540540
span,
541-
&format!("Encountered errors `{:?}` fulfilling during trans",
542-
errors));
541+
"Encountered errors `{:?}` fulfilling during trans",
542+
errors);
543543
}
544544
}
545545
}

branches/beta/src/librustc/infer/region_inference/mod.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
497497
(ReLateBound(..), _) |
498498
(_, ReEarlyBound(..)) |
499499
(_, ReLateBound(..)) => {
500-
self.tcx.sess.span_bug(origin.span(),
501-
&format!("cannot relate bound region: {:?} <= {:?}",
502-
sub,
503-
sup));
500+
span_bug!(origin.span(),
501+
"cannot relate bound region: {:?} <= {:?}",
502+
sub,
503+
sup);
504504
}
505505
(_, ReStatic) => {
506506
// all regions are subregions of static, so we can ignore this
@@ -570,9 +570,9 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
570570
pub fn resolve_var(&self, rid: RegionVid) -> ty::Region {
571571
match *self.values.borrow() {
572572
None => {
573-
self.tcx.sess.span_bug((*self.var_origins.borrow())[rid.index as usize].span(),
574-
"attempt to resolve region variable before values have \
575-
been computed!")
573+
span_bug!((*self.var_origins.borrow())[rid.index as usize].span(),
574+
"attempt to resolve region variable before values have \
575+
been computed!")
576576
}
577577
Some(ref values) => {
578578
let r = lookup(values, rid);
@@ -745,11 +745,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
745745
}
746746

747747
(ReVar(v_id), _) | (_, ReVar(v_id)) => {
748-
self.tcx.sess.span_bug((*self.var_origins.borrow())[v_id.index as usize].span(),
749-
&format!("lub_concrete_regions invoked with non-concrete \
750-
regions: {:?}, {:?}",
751-
a,
752-
b));
748+
span_bug!((*self.var_origins.borrow())[v_id.index as usize].span(),
749+
"lub_concrete_regions invoked with non-concrete \
750+
regions: {:?}, {:?}",
751+
a,
752+
b);
753753
}
754754

755755
(ReFree(ref fr), ReScope(s_id)) |
@@ -1193,13 +1193,13 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
11931193
}
11941194
}
11951195

1196-
self.tcx.sess.span_bug((*self.var_origins.borrow())[node_idx.index as usize].span(),
1197-
&format!("collect_error_for_expanding_node() could not find \
1198-
error for var {:?}, lower_bounds={:?}, \
1199-
upper_bounds={:?}",
1200-
node_idx,
1201-
lower_bounds,
1202-
upper_bounds));
1196+
span_bug!((*self.var_origins.borrow())[node_idx.index as usize].span(),
1197+
"collect_error_for_expanding_node() could not find \
1198+
error for var {:?}, lower_bounds={:?}, \
1199+
upper_bounds={:?}",
1200+
node_idx,
1201+
lower_bounds,
1202+
upper_bounds);
12031203
}
12041204

12051205
fn collect_concrete_regions(&self,

branches/beta/src/librustc/lint/context.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,9 +1275,9 @@ pub fn check_crate(tcx: &TyCtxt, access_levels: &AccessLevels) {
12751275
// in the iteration code.
12761276
for (id, v) in tcx.sess.lints.borrow().iter() {
12771277
for &(lint, span, ref msg) in v {
1278-
tcx.sess.span_bug(span,
1279-
&format!("unprocessed lint {} at {}: {}",
1280-
lint.as_str(), tcx.map.node_to_string(*id), *msg))
1278+
span_bug!(span,
1279+
"unprocessed lint {} at {}: {}",
1280+
lint.as_str(), tcx.map.node_to_string(*id), *msg)
12811281
}
12821282
}
12831283

@@ -1314,9 +1314,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
13141314
// in the iteration code.
13151315
for (_, v) in sess.lints.borrow().iter() {
13161316
for &(lint, span, ref msg) in v {
1317-
sess.span_bug(span,
1318-
&format!("unprocessed lint {}: {}",
1319-
lint.as_str(), *msg))
1317+
span_bug!(span, "unprocessed lint {}: {}", lint.as_str(), *msg)
13201318
}
13211319
}
13221320
}

branches/beta/src/librustc/middle/astconv_util.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &TyCtxt<'tcx>, ast_ty: &ast::Ty)
6767
if let ast::TyPath(None, ref path) = ast_ty.node {
6868
let def = match tcx.def_map.borrow().get(&ast_ty.id) {
6969
None => {
70-
tcx.sess.span_bug(ast_ty.span,
71-
&format!("unbound path {:?}", path))
70+
span_bug!(ast_ty.span, "unbound path {:?}", path)
7271
}
7372
Some(d) => d.full_def()
7473
};

branches/beta/src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
125125
if let ty::TyStruct(def, _) = self.tcx.expr_ty_adjusted(lhs).sty {
126126
self.insert_def_id(def.struct_variant().field_named(name).did);
127127
} else {
128-
self.tcx.sess.span_bug(lhs.span, "named field access on non-struct")
128+
span_bug!(lhs.span, "named field access on non-struct")
129129
}
130130
}
131131

@@ -141,7 +141,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
141141
let pat_ty = self.tcx.node_id_to_type(lhs.id);
142142
let variant = match pat_ty.sty {
143143
ty::TyStruct(adt, _) | ty::TyEnum(adt, _) => adt.variant_of_def(def),
144-
_ => self.tcx.sess.span_bug(lhs.span, "non-ADT in struct pattern")
144+
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
145145
};
146146
for pat in pats {
147147
if let PatKind::Wild = pat.node.pat.node {

branches/beta/src/librustc/middle/expr_use_visitor.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,10 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
564564
OverloadedCallType::from_method_id(self.tcx(), method_id)
565565
}
566566
None => {
567-
self.tcx().sess.span_bug(
567+
span_bug!(
568568
callee.span,
569-
&format!("unexpected callee type {}", callee_ty))
569+
"unexpected callee type {}",
570+
callee_ty)
570571
}
571572
};
572573
match overloaded_call_type {
@@ -683,7 +684,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
683684
// may not. This will generate an error earlier in typeck,
684685
// so we can just ignore it.
685686
if !self.tcx().sess.has_errors() {
686-
self.tcx().sess.span_bug(
687+
span_bug!(
687688
with_expr.span,
688689
"with expression doesn't evaluate to a struct");
689690
}
@@ -750,9 +751,9 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
750751

751752
let (m, r) = match self_ty.sty {
752753
ty::TyRef(r, ref m) => (m.mutbl, r),
753-
_ => self.tcx().sess.span_bug(expr.span,
754-
&format!("bad overloaded deref type {:?}",
755-
method_ty))
754+
_ => span_bug!(expr.span,
755+
"bad overloaded deref type {:?}",
756+
method_ty)
756757
};
757758
let bk = ty::BorrowKind::from_mutbl(m);
758759
self.delegate.borrow(expr.id, expr.span, cmt,
@@ -934,7 +935,6 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
934935
debug!("determine_pat_move_mode cmt_discr={:?} pat={:?}", cmt_discr,
935936
pat);
936937
return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |_mc, cmt_pat, pat| {
937-
let tcx = self.tcx();
938938
let def_map = &self.tcx().def_map;
939939
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
940940
match pat.node {
@@ -947,7 +947,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
947947
}
948948
}
949949
_ => {
950-
tcx.sess.span_bug(
950+
span_bug!(
951951
pat.span,
952952
"binding pattern not an identifier");
953953
}
@@ -972,8 +972,6 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
972972
let delegate = &mut self.delegate;
973973
return_if_err!(mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
974974
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
975-
let tcx = typer.tcx;
976-
977975
debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",
978976
cmt_pat,
979977
pat,
@@ -1007,7 +1005,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
10071005
delegate.consume_pat(pat, cmt_pat, mode);
10081006
}
10091007
_ => {
1010-
tcx.sess.span_bug(
1008+
span_bug!(
10111009
pat.span,
10121010
"binding pattern not an identifier");
10131011
}
@@ -1117,10 +1115,10 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
11171115
// reported.
11181116

11191117
if !tcx.sess.has_errors() {
1120-
let msg = format!("Pattern has unexpected def: {:?} and type {:?}",
1121-
def,
1122-
cmt_pat.ty);
1123-
tcx.sess.span_bug(pat.span, &msg[..])
1118+
span_bug!(pat.span,
1119+
"Pattern has unexpected def: {:?} and type {:?}",
1120+
def,
1121+
cmt_pat.ty);
11241122
}
11251123
}
11261124
}

branches/beta/src/librustc/middle/intrinsicck.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
6666
let param_env = match self.param_envs.last() {
6767
Some(p) => p,
6868
None => {
69-
self.tcx.sess.span_bug(
69+
span_bug!(
7070
span,
7171
"transmute encountered outside of any fn");
7272
}
@@ -245,9 +245,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
245245
}
246246
}
247247
_ => {
248-
self.tcx
249-
.sess
250-
.span_bug(expr.span, "transmute wasn't a bare fn?!");
248+
span_bug!(expr.span, "transmute wasn't a bare fn?!");
251249
}
252250
}
253251
}

0 commit comments

Comments
 (0)