Skip to content

Commit 5dbf881

Browse files
committed
three new tests for assigning to various unassignable things
1 parent b4d1f1b commit 5dbf881

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const foo: int = 5;
2+
3+
fn main() {
4+
// assigning to various global constants
5+
none = some(3); //! ERROR assigning to static item
6+
foo = 6; //! ERROR assigning to static item
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
enum foo = int;
2+
3+
fn main() {
4+
let x = foo(3);
5+
*x = 4; //! ERROR assigning to enum content
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource r(_r: int) {}
2+
3+
fn main() {
4+
let x = r(3);
5+
*x = 4; //! ERROR assigning to resource content
6+
}

0 commit comments

Comments
 (0)