mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
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.
This commit is contained in:
commit
483600e65f
@ -378,8 +378,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
|
||||
"lower range bound must be less than or equal to upper");
|
||||
}
|
||||
None => {
|
||||
self.tcx.sess.span_bug(
|
||||
start.span, "literals of different types in range pat");
|
||||
self.tcx.sess.delay_span_bug(start.span,
|
||||
"non-constant path in constant expr");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
src/test/compile-fail/non-constant-in-const-path.rs
Normal file
18
src/test/compile-fail/non-constant-in-const-path.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let x = 0;
|
||||
match 1 {
|
||||
0 ... x => {}
|
||||
//~^ ERROR non-constant path in constant expr
|
||||
//~| ERROR paths in constants may only refer to constants or functions
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user