mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Add some tests for obsolete code, sugar used in appropriate ways.
This commit is contained in:
parent
0fefd835f2
commit
9c9253e859
17
src/test/compile-fail/obsolete-proc.rs
Normal file
17
src/test/compile-fail/obsolete-proc.rs
Normal file
@ -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 <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.
|
||||
|
||||
// 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() { }
|
@ -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 <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.
|
||||
|
||||
|
||||
// Test that parentheses form doesn't work with struct types appearing in local variables.
|
||||
|
||||
struct Bar<A,R> {
|
||||
f: A, r: R
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let x: Box<Bar()> = panic!();
|
||||
//~^ ERROR E0169
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -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 <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.
|
||||
|
||||
// Test that parentheses form doesn't work in expression paths.
|
||||
|
||||
struct Bar<A,R> {
|
||||
f: A, r: R
|
||||
}
|
||||
|
||||
impl<A,B> Bar<A,B> {
|
||||
fn new() -> Bar<A,B> { panic!() }
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let b = Box::Bar::<int,uint>::new(); // OK
|
||||
|
||||
let b = Box::Bar::()::new();
|
||||
//~^ ERROR expected ident, found `(`
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -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 <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.
|
||||
|
||||
// Test that parentheses form doesn't work with struct types appearing in argument types.
|
||||
|
||||
struct Bar<A,R> {
|
||||
f: A, r: R
|
||||
}
|
||||
|
||||
fn foo(b: Box<Bar()>) {
|
||||
//~^ ERROR E0169
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
Loading…
Reference in New Issue
Block a user