diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-06-15 02:09:53 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-06-15 02:09:53 +0200 |
| commit | a80840f75196b69ea3f6c8b1fdaa032be609e9f5 (patch) | |
| tree | 1fce4698956f7a3d7a0082c3c3f01c16264c71d2 /src/test | |
| parent | 8d65dd62b17892102231101a7e58de0a20b5dd21 (diff) | |
| download | rust-a80840f75196b69ea3f6c8b1fdaa032be609e9f5.tar.gz rust-a80840f75196b69ea3f6c8b1fdaa032be609e9f5.zip | |
Added more tests
Diffstat (limited to 'src/test')
3 files changed, 30 insertions, 1 deletions
diff --git a/src/test/compile-fail/for-loop-unconstrained-element-type.rs b/src/test/compile-fail/for-loop-unconstrained-element-type.rs new file mode 100644 index 00000000000..f7dccc7f2ac --- /dev/null +++ b/src/test/compile-fail/for-loop-unconstrained-element-type.rs @@ -0,0 +1,13 @@ +// Copyright 2017 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() { + for i in Vec::new() { } //~ ERROR type annotations needed +} diff --git a/src/test/run-pass/for-loop-lifetime-of-unbound-values.rs b/src/test/run-pass/for-loop-lifetime-of-unbound-values.rs index a0562edfadd..4653a493898 100644 --- a/src/test/run-pass/for-loop-lifetime-of-unbound-values.rs +++ b/src/test/run-pass/for-loop-lifetime-of-unbound-values.rs @@ -35,4 +35,4 @@ fn main() { } // The Flag value should be dead outside of the loop assert_eq!(alive.get(), false); -} \ No newline at end of file +} diff --git a/src/test/run-pass/for-loop-unconstrained-element-type-i32-fallback.rs b/src/test/run-pass/for-loop-unconstrained-element-type-i32-fallback.rs new file mode 100644 index 00000000000..d9a876d9c95 --- /dev/null +++ b/src/test/run-pass/for-loop-unconstrained-element-type-i32-fallback.rs @@ -0,0 +1,16 @@ +// Copyright 2017 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 mut sum = 0; + for i in Vec::new() { + sum += i; + } +} |
