Skip to content

Commit b4a4865

Browse files
committed
---
yaml --- r: 271797 b: refs/heads/auto c: 9799cac h: refs/heads/master i: 271795: c4b89d7
1 parent f5d156d commit b4a4865

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: cd80c1bb5540fa2610a8f3d8a25560d1f0981400
11+
refs/heads/auto: 9799cacba3042420cc7b49d555289241cf0456e1
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ impl NodeIdAssigner for Session {
336336
fn peek_node_id(&self) -> NodeId {
337337
self.next_node_id.get().checked_add(1).unwrap()
338338
}
339+
340+
fn diagnostic(&self) -> &errors::Handler {
341+
self.diagnostic()
342+
}
339343
}
340344

341345
fn split_msg_into_multilines(msg: &str) -> Option<String> {

branches/auto/src/librustc_front/lowering.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use std::collections::HashMap;
6868
use std::iter;
6969
use syntax::ast::*;
7070
use syntax::attr::{ThinAttributes, ThinAttributesExt};
71+
use syntax::errors::Handler;
7172
use syntax::ext::mtwt;
7273
use syntax::ptr::P;
7374
use syntax::codemap::{respan, Spanned, Span};
@@ -140,6 +141,11 @@ impl<'a, 'hir> LoweringContext<'a> {
140141
result
141142
}
142143
}
144+
145+
// panics if this LoweringContext's NodeIdAssigner is not a Session
146+
fn diagnostic(&self) -> &Handler {
147+
self.id_assigner.diagnostic()
148+
}
143149
}
144150

145151
// Utility fn for setting and unsetting the cached id.
@@ -1289,7 +1295,8 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
12891295
make_struct(lctx, e, &["RangeInclusive", "NonEmpty"],
12901296
&[("start", e1), ("end", e2)]),
12911297

1292-
_ => panic!("impossible range in AST"),
1298+
_ => panic!(lctx.diagnostic().span_fatal(e.span,
1299+
"inclusive range with no end"))
12931300
}
12941301
});
12951302
}

branches/auto/src/libsyntax/ast.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub use self::PathParameters::*;
1919
use attr::ThinAttributes;
2020
use codemap::{Span, Spanned, DUMMY_SP, ExpnId};
2121
use abi::Abi;
22+
use errors;
2223
use ext::base;
2324
use ext::tt::macro_parser;
2425
use parse::token::InternedString;
@@ -344,6 +345,10 @@ pub const DUMMY_NODE_ID: NodeId = !0;
344345
pub trait NodeIdAssigner {
345346
fn next_node_id(&self) -> NodeId;
346347
fn peek_node_id(&self) -> NodeId;
348+
349+
fn diagnostic(&self) -> &errors::Handler {
350+
panic!("this ID assigner cannot emit diagnostics")
351+
}
347352
}
348353

349354
/// The AST represents all type param bounds as types.

branches/auto/src/test/parse-fail/range_inclusive.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(inclusive_range_syntax, inclusive_range)]
1414

1515
pub fn main() {
16-
for _ in 1... {}
17-
} //~ ERROR expected one of
16+
for _ in 1... {} //~ERROR inclusive range with no end
17+
//~^HELP 28237
18+
}
1819

0 commit comments

Comments
 (0)