Skip to content

Commit 08d1b76

Browse files
committed
---
yaml --- r: 273841 b: refs/heads/beta c: 065dcd0 h: refs/heads/master i: 273839: e7ec5a9
1 parent 5c96f64 commit 08d1b76

File tree

9 files changed

+29
-36
lines changed

9 files changed

+29
-36
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: e3a7a66f1a842ec6eb03416ae5dfc082a119da8c
26+
refs/heads/beta: 065dcd0702769de9bd95d0e9887713c6778ed67f
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_borrowck/borrowck/fragments.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc::middle::mem_categorization as mc;
2727
use std::mem;
2828
use std::rc::Rc;
2929
use syntax::ast;
30-
use syntax::codemap::Span;
30+
use syntax::codemap::{Span, DUMMY_SP};
3131
use syntax::attr::AttrMetaMethods;
3232

3333
#[derive(PartialEq, Eq, PartialOrd, Ord)]
@@ -428,8 +428,8 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
428428
let tuple_idx = match *origin_field_name {
429429
mc::PositionalField(tuple_idx) => tuple_idx,
430430
mc::NamedField(_) =>
431-
panic!("tuple type {:?} should not have named fields.",
432-
parent_ty),
431+
bug!("tuple type {:?} should not have named fields.",
432+
parent_ty),
433433
};
434434
let tuple_len = v.len();
435435
for i in 0..tuple_len {
@@ -493,10 +493,11 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
493493
}
494494

495495
ref sty_and_variant_info => {
496-
let msg = format!("type {:?} ({:?}) is not fragmentable",
497-
parent_ty, sty_and_variant_info);
498496
let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id));
499-
tcx.sess.opt_span_bug(opt_span, &msg[..])
497+
span_bug!(opt_span.unwrap_or(DUMMY_SP),
498+
"type {:?} ({:?}) is not fragmentable",
499+
parent_ty,
500+
sty_and_variant_info);
500501
}
501502
}
502503
}

branches/beta/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
7878
LpDowncast(ref base_lp, _) =>
7979
move_data.add_variant_match(
8080
tcx, lp.clone(), move_pat.id, base_lp.clone(), mode),
81-
_ => panic!("should only call gather_match_variant \
82-
for cat_downcast cmt"),
81+
_ => bug!("should only call gather_match_variant \
82+
for cat_downcast cmt"),
8383
}
8484
}
8585
None => {

branches/beta/src/librustc_borrowck/borrowck/gather_loans/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,10 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
378378
ty::ReEarlyBound(..) |
379379
ty::ReVar(..) |
380380
ty::ReSkolemized(..) => {
381-
self.tcx().sess.span_bug(
381+
span_bug!(
382382
cmt.span,
383-
&format!("invalid borrow lifetime: {:?}",
384-
loan_region));
383+
"invalid borrow lifetime: {:?}",
384+
loan_region);
385385
}
386386
};
387387
debug!("loan_scope = {:?}", loan_scope);

branches/beta/src/librustc_borrowck/borrowck/gather_loans/move_error.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
134134
a non-copy fixed-size array",
135135
b.ty)
136136
} else {
137-
bccx.span_bug(move_from.span, "this path should not cause illegal move");
138-
unreachable!();
137+
span_bug!(move_from.span, "this path should not cause illegal move");
139138
}
140139
}
141140

@@ -150,14 +149,12 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
150149
b.ty)
151150
},
152151
_ => {
153-
bccx.span_bug(move_from.span, "this path should not cause illegal move");
154-
unreachable!();
152+
span_bug!(move_from.span, "this path should not cause illegal move");
155153
}
156154
}
157155
}
158156
_ => {
159-
bccx.span_bug(move_from.span, "this path should not cause illegal move");
160-
unreachable!();
157+
span_bug!(move_from.span, "this path should not cause illegal move");
161158
}
162159
}
163160
}

branches/beta/src/librustc_borrowck/borrowck/mir/gather_moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &TyCtxt<'tcx>) -> MoveData<'tcx> {
569569
Rvalue::InlineAsm { .. } => {}
570570

571571
Rvalue::Slice {..} => {
572-
bb_ctxt.tcx.sess.bug("cannot move out of slice");
572+
bug!("cannot move out of slice");
573573
}
574574
}
575575
}

branches/beta/src/librustc_borrowck/borrowck/mod.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ pub fn closure_to_block(closure_id: ast::NodeId,
420420
block.id
421421
}
422422
_ => {
423-
panic!("encountered non-closure id: {}", closure_id)
423+
bug!("encountered non-closure id: {}", closure_id)
424424
}
425425
},
426-
_ => panic!("encountered non-expr id: {}", closure_id)
426+
_ => bug!("encountered non-expr id: {}", closure_id)
427427
}
428428
}
429429

@@ -704,10 +704,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
704704
(self.tcx.expr_ty_adjusted(&expr), expr.span)
705705
}
706706
r => {
707-
self.tcx.sess.bug(&format!("MoveExpr({}) maps to \
708-
{:?}, not Expr",
709-
the_move.id,
710-
r))
707+
bug!("MoveExpr({}) maps to {:?}, not Expr",
708+
the_move.id,
709+
r)
711710
}
712711
};
713712
let (suggestion, _) =
@@ -766,10 +765,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
766765
(self.tcx.expr_ty_adjusted(&expr), expr.span)
767766
}
768767
r => {
769-
self.tcx.sess.bug(&format!("Captured({}) maps to \
770-
{:?}, not Expr",
771-
the_move.id,
772-
r))
768+
bug!("Captured({}) maps to {:?}, not Expr",
769+
the_move.id,
770+
r)
773771
}
774772
};
775773
let (suggestion, help) =
@@ -852,10 +850,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
852850
self.tcx.sess.span_err_with_code(s, msg, code);
853851
}
854852

855-
pub fn span_bug(&self, s: Span, m: &str) {
856-
self.tcx.sess.span_bug(s, m);
857-
}
858-
859853
pub fn bckerr_to_string(&self, err: &BckError<'tcx>) -> String {
860854
match err.code {
861855
err_mutbl => {
@@ -895,7 +889,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
895889
format!("cannot borrow {} as mutable", descr)
896890
}
897891
BorrowViolation(euv::ClosureInvocation) => {
898-
self.tcx.sess.span_bug(err.span,
892+
span_bug!(err.span,
899893
"err_mutbl with a closure invocation");
900894
}
901895
}
@@ -1035,7 +1029,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
10351029
// We need to determine which is the case here.
10361030
let kind = match err.cmt.upvar().unwrap().cat {
10371031
Categorization::Upvar(mc::Upvar { kind, .. }) => kind,
1038-
_ => unreachable!()
1032+
_ => bug!()
10391033
};
10401034
if kind == ty::ClosureKind::Fn {
10411035
db.span_help(

branches/beta/src/librustc_borrowck/borrowck/move_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ impl<'tcx> MoveData<'tcx> {
515515
assignment_index);
516516
}
517517
LpExtend(..) => {
518-
tcx.sess.bug("var assignment for non var path");
518+
bug!("var assignment for non var path");
519519
}
520520
}
521521
}

branches/beta/src/librustc_borrowck/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
3333
// refers to the borrowck-specific graphviz adapter traits.
3434
extern crate graphviz as dot;
35+
#[macro_use]
3536
extern crate rustc;
3637
extern crate rustc_front;
3738
extern crate rustc_mir;

0 commit comments

Comments
 (0)