Skip to content

Commit 417fe6d

Browse files
committed
Refactor away method LoweringContext::diagnostic
1 parent df572fc commit 417fe6d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/librustc/hir/lowering.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use std::collections::BTreeMap;
5050
use std::iter;
5151
use syntax::ast::*;
5252
use syntax::attr::{ThinAttributes, ThinAttributesExt};
53-
use syntax::errors::Handler;
5453
use syntax::ext::mtwt;
5554
use syntax::ptr::P;
5655
use syntax::codemap::{respan, Spanned, Span};
@@ -94,7 +93,7 @@ impl Resolver for DummyResolver {
9493
}
9594
}
9695

97-
impl<'a, 'hir> LoweringContext<'a> {
96+
impl<'a> LoweringContext<'a> {
9897
pub fn new(id_assigner: &'a NodeIdAssigner,
9998
c: Option<&Crate>,
10099
resolver: &'a mut Resolver)
@@ -125,11 +124,6 @@ impl<'a, 'hir> LoweringContext<'a> {
125124
hir::Ident::from_name(token::gensym(s))
126125
}
127126

128-
// Panics if this LoweringContext's NodeIdAssigner is not able to emit diagnostics.
129-
fn diagnostic(&self) -> &Handler {
130-
self.id_assigner.diagnostic()
131-
}
132-
133127
fn with_parent_def<T, F: FnOnce() -> T>(&self, parent_id: NodeId, f: F) -> T {
134128
let old_def = self.parent_def.get();
135129
self.parent_def.set(match self.resolver.borrow_mut().definitions() {
@@ -1245,8 +1239,8 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
12451239
make_struct(lctx, e, &["RangeInclusive", "NonEmpty"],
12461240
&[("start", e1), ("end", e2)]),
12471241

1248-
_ => panic!(lctx.diagnostic().span_fatal(e.span,
1249-
"inclusive range with no end"))
1242+
_ => panic!(lctx.id_assigner.diagnostic()
1243+
.span_fatal(e.span, "inclusive range with no end")),
12501244
};
12511245
}
12521246
ExprKind::Path(ref qself, ref path) => {

0 commit comments

Comments
 (0)