Skip to content

Commit b3c253a

Browse files
committed
---
yaml --- r: 273836 b: refs/heads/beta c: 859b5a1 h: refs/heads/master
1 parent 7379f31 commit b3c253a

File tree

25 files changed

+96
-133
lines changed

25 files changed

+96
-133
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: fc7ec6b61438f5a7fef5afd4830f009acd02d8f2
26+
refs/heads/beta: 859b5a141c14ee875dcc1d061f4c94378a989844
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/infer/freshen.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
140140
ty::TyInfer(ty::FreshIntTy(c)) |
141141
ty::TyInfer(ty::FreshFloatTy(c)) => {
142142
if c >= self.freshen_count {
143-
tcx.sess.bug(
144-
&format!("Encountered a freshend type with id {} \
145-
but our counter is only at {}",
146-
c,
147-
self.freshen_count));
143+
bug!("Encountered a freshend type with id {} \
144+
but our counter is only at {}",
145+
c,
146+
self.freshen_count);
148147
}
149148
t
150149
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ pub fn mk_eq_impl_headers<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
471471
match (a.trait_ref, b.trait_ref) {
472472
(Some(a_ref), Some(b_ref)) => mk_eq_trait_refs(cx, a_is_expected, origin, a_ref, b_ref),
473473
(None, None) => mk_eqty(cx, a_is_expected, origin, a.self_ty, b.self_ty),
474-
_ => cx.tcx.sess.bug("mk_eq_impl_headers given mismatched impl kinds"),
474+
_ => bug!("mk_eq_impl_headers given mismatched impl kinds"),
475475
}
476476
}
477477

@@ -1114,9 +1114,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11141114
None if self.errors_since_creation() =>
11151115
self.tcx.types.err,
11161116
None => {
1117-
self.tcx.sess.bug(
1118-
&format!("no type for node {}: {} in fcx",
1119-
id, self.tcx.map.node_to_string(id)));
1117+
bug!("no type for node {}: {} in fcx",
1118+
id, self.tcx.map.node_to_string(id));
11201119
}
11211120
}
11221121
}
@@ -1125,7 +1124,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11251124
match self.tables.borrow().node_types.get(&ex.id) {
11261125
Some(&t) => t,
11271126
None => {
1128-
self.tcx.sess.bug("no type for expr in fcx");
1127+
bug!("no type for expr in fcx");
11291128
}
11301129
}
11311130
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
9090
};
9191

9292
if output_template.is_empty() {
93-
tcx.sess.bug("empty string provided as RUST_REGION_GRAPH");
93+
bug!("empty string provided as RUST_REGION_GRAPH");
9494
}
9595

9696
if output_template.contains('%') {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
413413
self.bound_count.set(sc + 1);
414414

415415
if sc >= self.bound_count.get() {
416-
self.tcx.sess.bug("rollover in RegionInference new_bound()");
416+
bug!("rollover in RegionInference new_bound()");
417417
}
418418

419419
ReLateBound(debruijn, BrFresh(sc))
@@ -733,7 +733,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
733733
(_, ReLateBound(..)) |
734734
(ReEarlyBound(..), _) |
735735
(_, ReEarlyBound(..)) => {
736-
self.tcx.sess.bug(&format!("cannot relate bound region: LUB({:?}, {:?})", a, b));
736+
bug!("cannot relate bound region: LUB({:?}, {:?})", a, b);
737737
}
738738

739739
(ReStatic, _) | (_, ReStatic) => {

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
127127
self.tcx().types.err
128128
}
129129
ty::TyInfer(_) => {
130-
self.infcx.tcx.sess.bug(
131-
&format!("Unexpected type in full type resolver: {:?}",
132-
t));
130+
bug!("Unexpected type in full type resolver: {:?}", t);
133131
}
134132
_ => {
135133
t.super_fold_with(self)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl LintStore {
183183
// We load builtin lints first, so a duplicate is a compiler bug.
184184
// Use early_error when handling -W help with no crate.
185185
(None, _) => early_error(config::ErrorOutputType::default(), &msg[..]),
186-
(Some(sess), false) => sess.bug(&msg[..]),
186+
(Some(_), false) => bug!("{}", msg),
187187

188188
// A duplicate name from a plugin is a user error.
189189
(Some(sess), true) => sess.err(&msg[..]),
@@ -221,7 +221,7 @@ impl LintStore {
221221
// We load builtin lints first, so a duplicate is a compiler bug.
222222
// Use early_error when handling -W help with no crate.
223223
(None, _) => early_error(config::ErrorOutputType::default(), &msg[..]),
224-
(Some(sess), false) => sess.bug(&msg[..]),
224+
(Some(_), false) => bug!("{}", msg),
225225

226226
// A duplicate name from a plugin is a user error.
227227
(Some(sess), true) => sess.err(&msg[..]),
@@ -447,7 +447,7 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
447447
(Warn, None) => sess.struct_warn(&msg[..]),
448448
(Deny, Some(sp)) => sess.struct_span_err(sp, &msg[..]),
449449
(Deny, None) => sess.struct_err(&msg[..]),
450-
_ => sess.bug("impossible level in raw_emit_lint"),
450+
_ => bug!("impossible level in raw_emit_lint"),
451451
};
452452

453453
// Check for future incompatibility lints and issue a stronger warning.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl OverloadedCallType {
224224
}
225225
}
226226

227-
tcx.sess.bug("overloaded call didn't map to known function trait")
227+
bug!("overloaded call didn't map to known function trait")
228228
}
229229

230230
fn from_method_id(tcx: &TyCtxt, method_id: DefId)

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl FreeRegionMap {
4949
}
5050

5151
pub fn relate_free_regions_from_predicates<'tcx>(&mut self,
52-
tcx: &TyCtxt<'tcx>,
52+
_tcx: &TyCtxt<'tcx>,
5353
predicates: &[ty::Predicate<'tcx>]) {
5454
debug!("relate_free_regions_from_predicates(predicates={:?})", predicates);
5555
for predicate in predicates {
@@ -72,10 +72,9 @@ impl FreeRegionMap {
7272
}
7373
_ => {
7474
// All named regions are instantiated with free regions.
75-
tcx.sess.bug(
76-
&format!("record_region_bounds: non free region: {:?} / {:?}",
77-
r_a,
78-
r_b));
75+
bug!("record_region_bounds: non free region: {:?} / {:?}",
76+
r_a,
77+
r_b);
7978
}
8079
}
8180
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
10441044
mutbl:m,
10451045
ty: match base_cmt.ty.builtin_deref(false, ty::NoPreference) {
10461046
Some(mt) => mt.ty,
1047-
None => self.tcx().sess.bug("Found non-derefable type")
1047+
None => bug!("Found non-derefable type")
10481048
},
10491049
note: NoteNone
10501050
})

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,8 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
312312
ast_map::NodeVariant(_) |
313313
ast_map::NodeStructCtor(_) => {}
314314
_ => {
315-
self.tcx
316-
.sess
317-
.bug(&format!("found unexpected thingy in worklist: {}",
318-
self.tcx
319-
.map
320-
.node_to_string(search_item)))
315+
bug!("found unexpected thingy in worklist: {}",
316+
self.tcx.map.node_to_string(search_item))
321317
}
322318
}
323319
}

branches/beta/src/librustc/mir/tcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'tcx> LvalueTy<'tcx> {
7070
variant_index: index }
7171
}
7272
_ => {
73-
tcx.sess.bug(&format!("cannot downcast non-enum type: `{:?}`", self))
73+
bug!("cannot downcast non-enum type: `{:?}`", self)
7474
}
7575
},
7676
ProjectionElem::Field(_, fty) => LvalueTy::Ty { ty: fty }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl Session {
270270

271271
match id.checked_add(count) {
272272
Some(next) => self.next_node_id.set(next),
273-
None => self.bug("Input too large, ran out of node ids!")
273+
None => bug!("Input too large, ran out of node ids!")
274274
}
275275

276276
id

branches/beta/src/librustc/traits/coherence.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &TyCtxt<'tcx>,
291291
}
292292

293293
ty::TyClosure(..) => {
294-
tcx.sess.bug(
295-
&format!("ty_is_local invoked on unexpected type: {:?}",
296-
ty))
294+
bug!("ty_is_local invoked on unexpected type: {:?}", ty)
297295
}
298296
}
299297
}

branches/beta/src/librustc/traits/project.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ fn project_type<'cx,'tcx>(
719719
// The essential problem here is that the projection fails,
720720
// leaving two unnormalized types, which appear not to unify
721721
// -- so the overlap check succeeds, when it should fail.
722-
selcx.tcx().sess.bug("Tried to project an inherited associated type during \
723-
coherence checking, which is currently not supported.");
722+
bug!("Tried to project an inherited associated type during \
723+
coherence checking, which is currently not supported.");
724724
}
725725
}
726726
}

branches/beta/src/librustc/traits/select.rs

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16011601
ObjectCandidate |
16021602
ParamCandidate(_) | ProjectionCandidate => match victim.candidate {
16031603
DefaultImplCandidate(..) => {
1604-
self.tcx().sess.bug(
1604+
bug!(
16051605
"default implementations shouldn't be recorded \
16061606
when there are other valid candidates");
16071607
}
@@ -1703,7 +1703,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17031703
ty::BoundSized => ok_if(Vec::new()),
17041704

17051705
ty::BoundSync | ty::BoundSend => {
1706-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1706+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17071707
}
17081708
}
17091709
}
@@ -1713,7 +1713,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17131713
ty::BoundCopy | ty::BoundSized => ok_if(Vec::new()),
17141714

17151715
ty::BoundSync | ty::BoundSend => {
1716-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1716+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17171717
}
17181718
}
17191719
}
@@ -1741,7 +1741,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17411741
}
17421742
}
17431743
ty::BoundSync | ty::BoundSend => {
1744-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1744+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17451745
}
17461746
}
17471747
}
@@ -1762,7 +1762,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17621762
ty::BoundSized => ok_if(Vec::new()),
17631763

17641764
ty::BoundSync | ty::BoundSend => {
1765-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1765+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17661766
}
17671767
}
17681768
}
@@ -1773,15 +1773,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17731773
ty::BoundCopy => ok_if(vec![element_ty]),
17741774
ty::BoundSized => ok_if(Vec::new()),
17751775
ty::BoundSync | ty::BoundSend => {
1776-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1776+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17771777
}
17781778
}
17791779
}
17801780

17811781
ty::TyStr | ty::TySlice(_) => {
17821782
match bound {
17831783
ty::BoundSync | ty::BoundSend => {
1784-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1784+
bug!("Send/Sync shouldn't occur in builtin_bounds()");
17851785
}
17861786

17871787
ty::BoundCopy | ty::BoundSized => Err(Unimplemented),
@@ -1847,10 +1847,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18471847
ty::TyInfer(ty::FreshTy(_))
18481848
| ty::TyInfer(ty::FreshIntTy(_))
18491849
| ty::TyInfer(ty::FreshFloatTy(_)) => {
1850-
self.tcx().sess.bug(
1851-
&format!(
1852-
"asked to assemble builtin bounds of unexpected type: {:?}",
1853-
self_ty));
1850+
bug!("asked to assemble builtin bounds of unexpected type: {:?}",
1851+
self_ty);
18541852
}
18551853
};
18561854

@@ -1911,10 +1909,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19111909
ty::TyInfer(ty::FreshTy(_)) |
19121910
ty::TyInfer(ty::FreshIntTy(_)) |
19131911
ty::TyInfer(ty::FreshFloatTy(_)) => {
1914-
self.tcx().sess.bug(
1915-
&format!(
1916-
"asked to assemble constituent types of unexpected type: {:?}",
1917-
t));
1912+
bug!("asked to assemble constituent types of unexpected type: {:?}",
1913+
t);
19181914
}
19191915

19201916
ty::TyBox(referent_ty) => { // Box<T>
@@ -2135,10 +2131,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
21352131
match self.match_where_clause_trait_ref(obligation, param.clone()) {
21362132
Ok(obligations) => obligations,
21372133
Err(()) => {
2138-
self.tcx().sess.bug(
2139-
&format!("Where clause `{:?}` was applicable to `{:?}` but now is not",
2140-
param,
2141-
obligation));
2134+
bug!("Where clause `{:?}` was applicable to `{:?}` but now is not",
2135+
param,
2136+
obligation);
21422137
}
21432138
}
21442139
}
@@ -2175,7 +2170,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
21752170
let trait_def = match self.tcx().lang_items.from_builtin_kind(bound) {
21762171
Ok(def_id) => def_id,
21772172
Err(_) => {
2178-
self.tcx().sess.bug("builtin trait definition not found");
2173+
bug!("builtin trait definition not found");
21792174
}
21802175
};
21812176

@@ -2238,10 +2233,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
22382233
self.vtable_default_impl(obligation, trait_def_id, all_types)
22392234
}
22402235
_ => {
2241-
self.tcx().sess.bug(
2242-
&format!(
2243-
"asked to confirm default object implementation for non-object type: {:?}",
2244-
self_ty));
2236+
bug!("asked to confirm default object implementation for non-object type: {:?}",
2237+
self_ty);
22452238
}
22462239
}
22472240
}
@@ -2692,10 +2685,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
26922685
match self.match_impl(impl_def_id, obligation, snapshot) {
26932686
Ok((substs, skol_map)) => (substs, skol_map),
26942687
Err(()) => {
2695-
self.tcx().sess.bug(
2696-
&format!("Impl {:?} was matchable against {:?} but now is not",
2697-
impl_def_id,
2698-
obligation));
2688+
bug!("Impl {:?} was matchable against {:?} but now is not",
2689+
impl_def_id,
2690+
obligation);
26992691
}
27002692
}
27012693
}

branches/beta/src/librustc/traits/specialize/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ pub fn translate_substs<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
9393
}
9494

9595
fulfill_implication(infcx, source_trait_ref, target_impl).unwrap_or_else(|_| {
96-
infcx.tcx
97-
.sess
98-
.bug("When translating substitutions for specialization, the expected \
99-
specializaiton failed to hold")
96+
bug!("When translating substitutions for specialization, the expected \
97+
specializaiton failed to hold")
10098
})
10199
}
102100
specialization_graph::Node::Trait(..) => source_trait_ref.substs.clone(),

branches/beta/src/librustc/traits/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ pub fn get_vtable_index_of_object_method<'tcx>(tcx: &TyCtxt<'tcx>,
481481
}
482482
}
483483

484-
tcx.sess.bug(&format!("get_vtable_index_of_object_method: {:?} was not found",
485-
method_def_id));
484+
bug!("get_vtable_index_of_object_method: {:?} was not found",
485+
method_def_id);
486486
}
487487

488488
pub enum TupleArgumentsFlag { Yes, No }

0 commit comments

Comments
 (0)