Allow some resources to be considered const.
This commit is contained in:
parent
3acc3c4d85
commit
0470abe1d2
2 changed files with 7 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
fn foo<T: const>(_x: T) { }
|
||||
|
||||
resource r(_x: int) {}
|
||||
resource r2(_x: @mut int) {}
|
||||
|
||||
fn main() {
|
||||
foo({f: 3});
|
||||
|
|
@ -13,7 +14,8 @@ fn main() {
|
|||
foo(~mut 1); //! ERROR missing `const`
|
||||
foo(@1);
|
||||
foo(@mut 1); //! ERROR missing `const`
|
||||
foo(r(1)); //! ERROR missing `const`
|
||||
foo(r(1)); // this is okay now.
|
||||
foo(r2(@mut 1)); //! ERROR missing `const`
|
||||
foo("123");
|
||||
foo({f: {mut f: 1}}); //! ERROR missing `const`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue