diff --git a/src/test/compile-fail/borrowck-assign-to-constants.rs b/src/test/compile-fail/borrowck-assign-to-constants.rs new file mode 100644 index 00000000000..59ced0275c0 --- /dev/null +++ b/src/test/compile-fail/borrowck-assign-to-constants.rs @@ -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 +} \ No newline at end of file diff --git a/src/test/compile-fail/borrowck-assign-to-enum.rs b/src/test/compile-fail/borrowck-assign-to-enum.rs new file mode 100644 index 00000000000..927bcfdc85e --- /dev/null +++ b/src/test/compile-fail/borrowck-assign-to-enum.rs @@ -0,0 +1,6 @@ +enum foo = int; + +fn main() { + let x = foo(3); + *x = 4; //! ERROR assigning to enum content +} \ No newline at end of file diff --git a/src/test/compile-fail/borrowck-assign-to-resource.rs b/src/test/compile-fail/borrowck-assign-to-resource.rs new file mode 100644 index 00000000000..b04ac704df7 --- /dev/null +++ b/src/test/compile-fail/borrowck-assign-to-resource.rs @@ -0,0 +1,6 @@ +resource r(_r: int) {} + +fn main() { + let x = r(3); + *x = 4; //! ERROR assigning to resource content +} \ No newline at end of file