diff --git a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs new file mode 100644 index 0000000000000..883ba5b0eaa67 --- /dev/null +++ b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; //~ ERROR expected constant integer for repeat count but found variable +} diff --git a/src/test/run-pass/const-enum-vec-repeat.rs b/src/test/run-pass/const-enum-vec-repeat.rs new file mode 100644 index 0000000000000..4ad4bbc4a8a57 --- /dev/null +++ b/src/test/run-pass/const-enum-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum State { ST_NULL, ST_WHITESPACE = 1 } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; +} diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs new file mode 100644 index 0000000000000..c28ddd2bcb511 --- /dev/null +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -0,0 +1,11 @@ +// Copyright 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { let _a = [0, ..1 as uint]; }