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

Infer may_dangle on type parameters of Punctuated iterator Drop impls #1247

Merged
merged 2 commits into from Dec 1, 2022

Commits on Dec 1, 2022

  1. Add regression test for issue 1246

        error[E0505]: cannot move out of `p` because it is borrowed
          --> tests/test_iterators.rs:56:18
           |
        54 |     for element in &p {
           |                    --
           |                    |
           |                    borrow of `p` occurs here
           |                    a temporary with access to the borrow is created here ...
        55 |         if *element == 2 {
        56 |             drop(p);
           |                  ^ move out of `p` occurs here
        ...
        59 |     }
           |     - ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `syn::punctuated::Iter<'_, i32>`
    
        error[E0505]: cannot move out of `p` because it is borrowed
          --> tests/test_iterators.rs:64:18
           |
        62 |     for element in &mut p {
           |                    ------
           |                    |
           |                    borrow of `p` occurs here
           |                    a temporary with access to the borrow is created here ...
        63 |         if *element == 2 {
        64 |             drop(p);
           |                  ^ move out of `p` occurs here
        ...
        67 |     }
           |     - ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `syn::punctuated::IterMut<'_, i32>`
    dtolnay committed Dec 1, 2022
    Configuration menu
    Copy the full SHA
    3eaa443 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9113ad0 View commit details
    Browse the repository at this point in the history