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

Simplify dyn/impl parsing enabled by Punctuated improvements #1248

Closed
wants to merge 1 commit into from

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 1, 2022

Cleanup of the code added in #1245. Enabled by #1247. This code is where I noticed #1246.

Copy link
Owner Author

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this only works on Rust 1.40+, which we aren't requiring yet.

@dtolnay
Copy link
Owner Author

dtolnay commented Dec 1, 2022

Older rustc:

error[E0505]: cannot move out of `bounds` because it is borrowed
   --> src/ty.rs:930:59
    |
928 |   for bound in &bounds {
    |                -------
    |                |
    |                borrow of `bounds` occurs here
    |                a temporary with access to the borrow is created here ...
929 |       match bound {
930 |           TypeParamBound::Trait(_) => return Ok(bounds),
    |                                                 ^^^^^^ move out of `bounds` occurs here
...
935 |   }
    |   - ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `punctuated::Iter<'_, generics::TypeParamBound>`

@dtolnay dtolnay closed this Dec 1, 2022
@dtolnay dtolnay deleted the parsebounds branch December 1, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant