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

ZeroVec Yoke impl started failing "forget-copy" on Nightly #3436

Closed
sffc opened this issue May 15, 2023 · 3 comments · Fixed by #3437
Closed

ZeroVec Yoke impl started failing "forget-copy" on Nightly #3436

sffc opened this issue May 15, 2023 · 3 comments · Fixed by #3437
Labels
C-zerovec Component: Yoke, ZeroVec, DataBake T-bug Type: Bad behavior, security, privacy

Comments

@sffc
Copy link
Member

sffc commented May 15, 2023

The error is:

error: calls to `std::mem::forget` with a value that implements `Copy` does nothing
   --> utils/zerovec/src/yoke_impls.rs:174:13
    |
174 |             mem::forget(self);
    |             ^^^^^^^^^^^^----^
    |                         |
    |                         argument has type `map::borrowed::ZeroMapBorrowed<'_, K, V>`
    |
    = note: use `let _ = ...` to ignore the expression or result
    = note: `-D forget-copy` implied by `-D warnings`

error: calls to `std::mem::forget` with a value that implements `Copy` does nothing
   --> utils/zerovec/src/yoke_impls.rs:182:9
    |
182 |         mem::forget(from);
    |         ^^^^^^^^^^^^----^
    |                     |
    |                     argument has type `map::borrowed::ZeroMapBorrowed<'_, K, V>`
    |
    = note: use `let _ = ...` to ignore the expression or result

error: calls to `std::mem::forget` with a value that implements `Copy` does nothing
   --> utils/zerovec/src/yoke_impls.rs:2[70](https://github.com/unicode-org/icu4x/actions/runs/4981308660/jobs/8915392667#step:8:71):13
    |
270 |             mem::forget(self);
    |             ^^^^^^^^^^^^----^
    |                         |
    |                         argument has type `map2d::borrowed::ZeroMap2dBorrowed<'_, K0, K1, V>`
    |
    = note: use `let _ = ...` to ignore the expression or result

error: calls to `std::mem::forget` with a value that implements `Copy` does nothing
   --> utils/zerovec/src/yoke_impls.rs:278:9
    |
278 |         mem::forget(from);
    |         ^^^^^^^^^^^^----^
    |                     |
    |                     argument has type `map2d::borrowed::ZeroMap2dBorrowed<'_, K0, K1, V>`
    |
    = note: use `let _ = ...` to ignore the expression or result

It seems harmless to fix, but I would really like to stop breaking clients; see #3425

However, it appears to only be a lint, so we might be good if we patch the lint.

CC @Manishearth

@sffc sffc added T-bug Type: Bad behavior, security, privacy C-zerovec Component: Yoke, ZeroVec, DataBake labels May 15, 2023
@sffc sffc changed the title ZeroVec Yoke impl started failing to compile on Nightly ZeroVec Yoke impl started failing "forget-copy" on Nightly May 15, 2023
@sffc
Copy link
Member Author

sffc commented May 15, 2023

The file already has #![allow(clippy::forget_copy)] on the top. Hmm. I guess the lint moved into rustlang?

@sffc
Copy link
Member Author

sffc commented May 15, 2023

Most likely culprit PR: rust-lang/rust#109732

@Manishearth
Copy link
Member

Manishearth commented May 15, 2023

This doesn't break clients.

Yes, the lint was uplifted to rustc, and the forget is there in code as more of a visual indicator of end-of-use for the borrow. We should update the allow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-zerovec Component: Yoke, ZeroVec, DataBake T-bug Type: Bad behavior, security, privacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants