-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Nested method calls with &mut
receivers result in borrowck errors
#6268
Comments
There are various FIXMEs in the code with commented out bits of code related to this issue. |
Here is a test case (at least I think it relates to this issue):
The error rustc produces is:
|
Nominated for feature complete (not backwards compatible since it generates strictly more errors than it should) |
The following types are renamed: ```rust block_ => Block block => @mut Block fn_ctx_ => FunctionContext fn_ctx => @mut FunctionContext scope_info => ScopeInfo ``` I also tried to convert instances of `@mut` to `&mut` or `&` but a lot of them are blocked by issue #6268, so I left it for some time later.
accepted for feature-complete |
This can be added backwards-compatibly. Its a nice enhancement but not known to be a major problem to work-around. P-low, not 1.0. |
By the way, the reason that this does not type check under our current model is provided in the internal docs for the type checker; see: typeck/infer/region_inference/doc.rs lines 171 through 262. |
Triage bump; still an issue. |
cc me, I still hit this with surprising regularity. |
Closing in favor of rust-lang/rfcs#811 |
Most of these are old, but some specific messages for specific tests: * trait-contravariant-self.rs: failed due to a soundess hole: rust-lang@05e3248 * process-detatch: rust-lang@15966c3 says "this test is being ignored until signals are implemented" That's not happening for a long time, and when it is, we'll write tests for it. * deep-vector{,2}.rs: "too big for our poor macro infrastructure", and has been ignored over a year. * borrowck-nested-calls.rs's FIXME rust-lang#6268 was closed in favor of rust-lang/rfcs#811 * issue-15167.rs works properly now * issue-9737.rs works properly now * match-var-hygiene.rs works properly now Addresses a chunk of rust-lang#3965
Seems to be a blocker for some async IO patterns needed for lowest-latency processing. cc me. |
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
This is challenging to resolve. I thought I could fit into the new borrow checker, but it is worth addressing separately since there are a number of subtle issues. What this really amounts to is that you need to support borrows where the lifetime of the borrow pointer does not encompass the borrow itself. To handle this safely, we wind up with two loans, the primary one and then a secondary, aliasing loan that tracks the fact that a pointer has been created, even if the memory it points at cannot be dereferenced yet.
Part of #5074
The text was updated successfully, but these errors were encountered: