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

Meta: Borrow checker rules rewrite #5074

Closed
nikomatsakis opened this issue Feb 21, 2013 · 10 comments
Closed

Meta: Borrow checker rules rewrite #5074

nikomatsakis opened this issue Feb 21, 2013 · 10 comments
Assignees
Labels
A-lifetimes Area: Lifetimes / regions A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. metabug Issues about issues themselves ("bugs about bugs")

Comments

@nikomatsakis
Copy link
Contributor

The current borrow checker rules are not quite sound and also insufficient expressive. They don't support nested calls nor are they flow-sensitive. I have a rewrite in progress to address these 3 issues.

@thestinger
Copy link
Contributor

Here's a test case for the issue with multiple ref mut patterns, that I ran into in writing find_mut for the trie:

enum Foo {
    A(int), B(int), C
}

fn main() {
    let mut x = A(5);
    let res = match x {
        A(ref mut a) => Some(a),
        B(ref mut b) => Some(b),
        C => None
    };
}

@nikomatsakis
Copy link
Contributor Author

I am going to treat this as a meta-issue, since it is evident that not everything will be landed in one go.

One sub-issue is #4903 (Flow sensitivity)

@nikomatsakis
Copy link
Contributor Author

A related issue is #4384 and #5016, since I think that move checking should move into the borrow checker

@nikomatsakis
Copy link
Contributor Author

A related issue is #3387, which concerns moves in overloaded operators (this should be fixed on my branch).

@nikomatsakis
Copy link
Contributor Author

A related issue is #3850, also addressed in my branch.

@nikomatsakis
Copy link
Contributor Author

Nominating for milestone: feature complete.

@graydon
Copy link
Contributor

graydon commented Aug 8, 2013

accepted for production-ready milestone

@pnkfelix
Copy link
Member

niko says we can close this; the remaining linked issues can stand on their own.

@nikomatsakis
Copy link
Contributor Author

closing

@Eh2406
Copy link
Contributor

Eh2406 commented Sep 3, 2017

There is a FIXME related to this issue,
https://github.com/rust-lang/rust/blob/master/src/librustc_borrowck/borrowck/gather_loans/mod.rs#L420
Now that the issue is closed can the FIXME be fix, or made more specific?

nivkner added a commit to nivkner/rust that referenced this issue Oct 7, 2017
update FIXME(rust-lang#6298) to point to open issue 15020
update FIXME(rust-lang#6268) to point to RFC 811
update FIXME(rust-lang#10520) to point to RFC 1751
remove FIXME for emscripten issue 4563 and include target in `test_estimate_scaling_factor`
remove FIXME(rust-lang#18207) since node_id isn't used for `ref` pattern analysis
remove FIXME(rust-lang#6308) since DST was implemented in rust-lang#12938
remove FIXME(rust-lang#2658) since it was decided to not reorganize module
remove FIXME(rust-lang#20590) since it was decided to stay conservative with projection types
remove FIXME(rust-lang#20297) since it was decided that solving the issue is unnecessary
remove FIXME(rust-lang#27086) since closures do correspond to structs now
remove FIXME(rust-lang#13846) and enable `function_sections` for windows
remove mention of rust-lang#22079 in FIXME(rust-lang#22079) since this is a general FIXME
remove FIXME(rust-lang#5074) since the restriction on borrow were lifted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. metabug Issues about issues themselves ("bugs about bugs")
Projects
None yet
Development

No branches or pull requests

5 participants