diff --git a/src/test/compile-fail/obsolete-proc.rs b/src/test/compile-fail/obsolete-proc.rs new file mode 100644 index 00000000000..5208cdb6ad2 --- /dev/null +++ b/src/test/compile-fail/obsolete-proc.rs @@ -0,0 +1,17 @@ +// 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. + +// Test that we generate obsolete syntax errors around usages of `proc`. + +fn foo(p: proc()) { } //~ ERROR obsolete syntax: the `proc` type + +fn bar() { proc() 1; } //~ ERROR obsolete syntax: `proc` expression + +fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs new file mode 100644 index 00000000000..2c1dee36b9a --- /dev/null +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs @@ -0,0 +1,24 @@ +// 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. + + +// Test that parentheses form doesn't work with struct types appearing in local variables. + +struct Bar { + f: A, r: R +} + +fn bar() { + let x: Box = panic!(); + //~^ ERROR E0169 +} + +fn main() { } + diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs new file mode 100644 index 00000000000..5e16adc4e42 --- /dev/null +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs @@ -0,0 +1,29 @@ +// 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. + +// Test that parentheses form doesn't work in expression paths. + +struct Bar { + f: A, r: R +} + +impl Bar { + fn new() -> Bar { panic!() } +} + +fn bar() { + let b = Box::Bar::::new(); // OK + + let b = Box::Bar::()::new(); + //~^ ERROR expected ident, found `(` +} + +fn main() { } + diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs new file mode 100644 index 00000000000..db94127a9ea --- /dev/null +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs @@ -0,0 +1,22 @@ +// 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. + +// Test that parentheses form doesn't work with struct types appearing in argument types. + +struct Bar { + f: A, r: R +} + +fn foo(b: Box) { + //~^ ERROR E0169 +} + +fn main() { } +