rust/src/test/compile-fail/repeat_count.rs
Alex Crichton cdccecb24f Test fixes from the rollup
Closes #14482 (std: Bring back half of Add on String)
Closes #15026 (librustc: Remove the fallback to `int` from typechecking.)
Closes #15119 (Add more description to c_str::unwrap().)
Closes #15120 (Add tests for #12470 and #14285)
Closes #15122 (Remove the cheat sheet.)
Closes #15126 (rustc: Always include the morestack library)
Closes #15127 (Improve ambiguous pronoun.)
Closes #15130 (Fix #15129)
Closes #15131 (Add the Guide, add warning to tutorial.)
Closes #15134 (Xfailed tests for hygiene, etc.)
Closes #15135 (core: Add stability attributes to Clone)
Closes #15136 (Some minor improvements to core::bool)
Closes #15137 (std: Add stability attributes to primitive numeric modules)
Closes #15141 (Fix grammar in tutorial)
Closes #15143 (Remove few FIXMEs)
Closes #15145 (Avoid unnecessary temporary on assignments)
Closes #15147 (Small improvements for metaprogramming)
Closes #15153 (librustc: Check function argument patterns for legality of by-move)
Closes #15154 (test: Add a test for regions, traits, and variance.)
Closes #15159 (rustc: Don't register syntax crates twice)
Closes #13816 (Stabilize version output for rustc and rustdoc)
2014-06-24 18:57:01 -07:00

27 lines
1.3 KiB
Rust

// Copyright 2013-2014 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.
// Regression test for issue #3645
fn main() {
let n = 1;
let a = [0, ..n]; //~ ERROR expected constant integer for repeat count but found variable
let b = [0, ..()]; //~ ERROR expected positive integer for repeat count but found ()
//~^ ERROR: expected `uint` but found `()`
let c = [0, ..true]; //~ ERROR expected positive integer for repeat count but found boolean
//~^ ERROR: expected `uint` but found `bool`
let d = [0, ..0.5]; //~ ERROR expected positive integer for repeat count but found float
//~^ ERROR: expected `uint` but found `<generic float #0>`
let e = [0, .."foo"]; //~ ERROR expected positive integer for repeat count but found string
//~^ ERROR: expected `uint` but found `&'static str`
let f = [0, ..-4];
//~^ ERROR expected positive integer for repeat count but found negative integer
}