Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can write to immutable parts of a type. #118

Closed
froystig opened this issue Jul 22, 2010 · 1 comment
Closed

Can write to immutable parts of a type. #118

froystig opened this issue Jul 22, 2010 · 1 comment
Labels
A-typesystem Area: The type system E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@froystig
Copy link
Contributor

Each pair of lines in the following function:

fn main() {
  let vec[int] v = vec(1, 2, 3);
  v.(1) = 4;

  let tup(int) t = tup(1);
  t._0 = 5;

  let rec(int x) r = rec(x=1);
  r.x = 6;
}

shouldn't make it past the typechecking phase, but do. Also, the following object definition makes it past the typechecker:

obj objy(int x) {
    fn foo() -> () {
        x = 5;
    }
}

but should not. Fix the typechecker to disallow writing to immutable type-parts.

@graydon
Copy link
Contributor

graydon commented Jul 23, 2010

Improve mutability checking. Closed by 44e2dc2.

mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Oct 17, 2011
eddyb pushed a commit to eddyb/rust that referenced this issue Jun 30, 2020
djtech-dev pushed a commit to djtech-dev/rust that referenced this issue Dec 9, 2021
Add {set,get}_atomic_ordering to instruction_value.
bjorn3 pushed a commit to bjorn3/rust that referenced this issue Feb 1, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants