Skip to content

Commit 483600e

Browse files
committed
Auto merge of #28178 - christopherdumas:fix_ice, r=nikomatsakis
This fixes the ICE, and makes it just a compiler error/warning. I'm not exactly sure that's whats wanted, so tell me if it isn't.
2 parents cedbd99 + 4611308 commit 483600e

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/librustc/middle/check_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
378378
"lower range bound must be less than or equal to upper");
379379
}
380380
None => {
381-
self.tcx.sess.span_bug(
382-
start.span, "literals of different types in range pat");
381+
self.tcx.sess.delay_span_bug(start.span,
382+
"non-constant path in constant expr");
383383
}
384384
}
385385
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let x = 0;
13+
match 1 {
14+
0 ... x => {}
15+
//~^ ERROR non-constant path in constant expr
16+
//~| ERROR paths in constants may only refer to constants or functions
17+
};
18+
}

0 commit comments

Comments
 (0)