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

Display information about captured variable in FnMut error #72598

Merged
merged 1 commit into from
Jun 15, 2020

Commits on May 26, 2020

  1. Display information about captured variable in FnMut error

    Fixes rust-lang#69446
    
    When we encounter a region error involving an `FnMut` closure, we
    display a specialized error message. However, we currently do not
    tell the user which upvar was captured. This makes it difficult to
    determine the cause of the error, especially when the closure is large.
    
    This commit records marks constraints involving closure upvars
    with `ConstraintCategory::ClosureUpvar`. When we decide to 'blame'
    a `ConstraintCategory::Return`, we additionall store
    the captured upvar if we found a `ConstraintCategory::ClosureUpvar` in
    the path.
    
    When generating an error message, we point to relevant spans if we have
    closure upvar information available. We further customize the message if
    an `async` closure is being returned, to make it clear that the captured
    variable is being returned indirectly.
    Aaron1011 committed May 26, 2020
    Configuration menu
    Copy the full SHA
    9cee22c View commit details
    Browse the repository at this point in the history