Skip to content

Commit 56eb057

Browse files
author
Oliver Schneider
committed
this was wrong anyway, but now is also unnecessary due to the const indexing fallback
1 parent bbc43a4 commit 56eb057

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/librustc/middle/const_eval.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -896,17 +896,13 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
896896
ast::ExprPath(..) => {
897897
let opt_def = tcx.def_map.borrow().get(&e.id).map(|d| d.full_def());
898898
let (const_expr, const_ty) = match opt_def {
899-
Some(def::DefConst(def_id))
900-
| Some(def::DefStatic(def_id, false)) => {
899+
Some(def::DefConst(def_id)) => {
901900
if ast_util::is_local(def_id) {
902901
match tcx.map.find(def_id.node) {
903902
Some(ast_map::NodeItem(it)) => match it.node {
904903
ast::ItemConst(ref ty, ref expr) => {
905904
(Some(&**expr), Some(&**ty))
906905
}
907-
ast::ItemStatic(ref ty, ast::MutImmutable, ref expr) => {
908-
(Some(&**expr), Some(&**ty))
909-
}
910906
_ => (None, None)
911907
},
912908
_ => (None, None)

src/test/compile-fail/array_const_index-0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ static B: i32 = (&A)[1]; //~ ERROR: array index out of bounds
1414

1515
fn main() {
1616
let _ = B;
17-
}
17+
}

0 commit comments

Comments
 (0)