0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-12-01 13:18:54 +01:00

three new tests for assigning to various unassignable things

This commit is contained in:
Niko Matsakis 2012-05-11 06:41:58 -07:00
parent b4d1f1b2c1
commit 5dbf881e87
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,7 @@
const foo: int = 5;
fn main() {
// assigning to various global constants
none = some(3); //! ERROR assigning to static item
foo = 6; //! ERROR assigning to static item
}

View File

@ -0,0 +1,6 @@
enum foo = int;
fn main() {
let x = foo(3);
*x = 4; //! ERROR assigning to enum content
}

View File

@ -0,0 +1,6 @@
resource r(_r: int) {}
fn main() {
let x = r(3);
*x = 4; //! ERROR assigning to resource content
}