Skip to content

Regression in useless_transmute due to rustup #5343

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
flip1995 opened this issue Mar 19, 2020 · 2 comments
Open

Regression in useless_transmute due to rustup #5343

flip1995 opened this issue Mar 19, 2020 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience. I-false-positive Issue: The lint was triggered on code it shouldn't have T-middle Type: Probably requires verifiying types

Comments

@flip1995
Copy link
Member

After rust-lang/rust#69189, the following check returns true for types, where only the lifetimes differ: &'a T == &'b T

let from_ty = cx.tables.expr_ty(&args[0]);
let to_ty = cx.tables.expr_ty(e);
match (&from_ty.kind, &to_ty.kind) {
_ if from_ty == to_ty => span_lint(

According to rust-lang/rust#69189 (comment), this probably needs to be fixed by checking the lifetimes of the types with MIR borrowck.

Originally posted by @flip1995 in #5333

@flip1995 flip1995 added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. C-bug Category: Clippy is not doing the correct thing T-middle Type: Probably requires verifiying types labels Mar 19, 2020
@dtolnay
Copy link
Member

dtolnay commented Mar 23, 2020

👍 this was picked up in miniserde's build. https://travis-ci.org/github/dtolnay/miniserde/jobs/665845514

If this may take a while to fix, could you please consider making useless_transmute allow-by-default for now?

@flip1995
Copy link
Member Author

flip1995 commented Mar 23, 2020

Yes, I also thought about this, but wanted to wait until someone complains. 😄 I'll move it to nursery,

bors added a commit that referenced this issue Mar 23, 2020
…earth

Move useless_transmute to nursery

cc #5343

@rust-lang/clippy anyone against moving this to nursery?

changelog: Move [`useless_transmute`] to nursery
@phansch phansch added the I-false-positive Issue: The lint was triggered on code it shouldn't have label Dec 19, 2020
bors added a commit that referenced this issue May 31, 2022
Don't lint `useless_transmute` on types with erased regions

fixes #6356
fixes #3340
fixes #2906

This should get a proper fix at some point, but this at least gets the lint running on some types.

cc #5343

changelog: Don't lint `useless_transmute` on types with erased regions
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience. I-false-positive Issue: The lint was triggered on code it shouldn't have T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

3 participants