overly restrictive closure borrow-checking #104477
Labels
A-borrow-checker
Area: The borrow checker
A-NLL
Area: Non-lexical lifetimes (NLL)
C-bug
Category: This is a bug.
NLL-complete
Working towards the "valid code works" goal
T-types
Relevant to the types team, which will review and decide on the PR/issue.
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:
case1
fails 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.case2
fails because'_
has multiple "non-local lower bounds"['a, 'b]
and the call to non_lcal_lower_bound simply returnsNone
in this case!case1
when 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
The text was updated successfully, but these errors were encountered: