]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/indexing_slicing.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / indexing_slicing.rs
index b9f1c4a4a5d5f7df2cb20b2d4d471b68c30b070b..a9e697e519f87e65eba863b368f91e78ac399d42 100644 (file)
@@ -1,4 +1,11 @@
-#![feature(tool_lints)]
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// 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.
 
 #![feature(plugin)]
 #![warn(clippy::indexing_slicing)]
@@ -81,4 +88,9 @@ fn main() {
     x[M]; // Ok, should not produce stderr.
     v[N];
     v[M];
+
+    // issue 3102
+    let num = 1;
+    &x[num..10]; // should trigger out of bounds error
+    &x[10..num]; // should trigger out of bounds error
 }