-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
overly restrictive closure borrow-checking #104477
Copy link
Copy link
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.NLL-completeWorking towards the "valid code works" goalWorking towards the "valid code works" goalT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Both of these test cases should pass borrowck: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=50a263a9626cb0b08f5cee334df8a852
They both fail because of the unnecessarily restrictive algorithm in try_propagate_universal_region_error:
case1fails because'_has multiple "non-local upper bounds"['a, 'b]and we do propagate the error to both of them while choosing a single one would be sufficient.case2fails because'_has multiple "non-local lower bounds"['a, 'b]and the call to non_lcal_lower_bound simply returnsNonein this case!case1when swapping arguments is due to the shortcut inrust/compiler/rustc_borrowck/src/region_infer/mod.rs
Line 1560 in 79146ba
@rustbot label C-bug T-types A-NLL NLL-complete A-borrow-checker
@rustbot claim