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:
parent
b4d1f1b2c1
commit
5dbf881e87
7
src/test/compile-fail/borrowck-assign-to-constants.rs
Normal file
7
src/test/compile-fail/borrowck-assign-to-constants.rs
Normal 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
|
||||
}
|
6
src/test/compile-fail/borrowck-assign-to-enum.rs
Normal file
6
src/test/compile-fail/borrowck-assign-to-enum.rs
Normal file
@ -0,0 +1,6 @@
|
||||
enum foo = int;
|
||||
|
||||
fn main() {
|
||||
let x = foo(3);
|
||||
*x = 4; //! ERROR assigning to enum content
|
||||
}
|
6
src/test/compile-fail/borrowck-assign-to-resource.rs
Normal file
6
src/test/compile-fail/borrowck-assign-to-resource.rs
Normal file
@ -0,0 +1,6 @@
|
||||
resource r(_r: int) {}
|
||||
|
||||
fn main() {
|
||||
let x = r(3);
|
||||
*x = 4; //! ERROR assigning to resource content
|
||||
}
|
Loading…
Reference in New Issue
Block a user