Skip to content

Commit af1ddb9

Browse files
authored
Rollup merge of #39700 - msopena:master, r=est31
Adding compile fail test for const_indexing feature First attempt at contributing to rust. Picked up an easy feature to test. Issue #39059 r? @est31
2 parents ae5d8fc + ec4a3cc commit af1ddb9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
12+
fn main() {
13+
const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47];
14+
const IDX: usize = 3;
15+
const VAL: i32 = ARR[IDX];
16+
const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; //~ ERROR constant evaluation error
17+
}

src/tools/tidy/src/features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub fn check(path: &Path, bad: &mut bool) {
167167
// FIXME get this whitelist empty.
168168
let whitelist = vec![
169169
"abi_ptx", "simd", "static_recursion",
170-
"cfg_target_has_atomic", "staged_api", "const_indexing",
170+
"cfg_target_has_atomic", "staged_api",
171171
"unboxed_closures", "stmt_expr_attributes",
172172
"cfg_target_thread_local", "unwind_attributes",
173173
"inclusive_range_syntax"

0 commit comments

Comments
 (0)