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

Tracking issue for future-incompatibility lint cenum_impl_drop_cast #73333

Open
oddg opened this issue Jun 13, 2020 · 1 comment
Open

Tracking issue for future-incompatibility lint cenum_impl_drop_cast #73333

oddg opened this issue Jun 13, 2020 · 1 comment
Labels
A-destructors Area: Destructors (`Drop`, …) A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-future-incompatibility Category: Future-incompatibility lints C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oddg
Copy link
Contributor

oddg commented Jun 13, 2020

This is the summary issue for the CENUM_IMPL_DROP_CAST future-incompatibility lint and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

The warning is issue when a C-like enum implementing the Drop trait is cast. For example:

enum E {
    A = 0,
}

impl Drop for E {
    fn drop(&mut self) {
        println!("Drop");
    }
}

fn main() {
    let e = E::A;
    let i = e as u32;
            ^^^^^^^^ here is the cast
}

This cast will be rejected to enforce uniformity between all moving operations. See #35941 for more details.

When will this warning become a hard error?

At the beginning of each 6-week release cycle, the Rust compiler team will review the set of outstanding future compatibility warnings and nominate some of them for Final Comment Period. Toward the end of the cycle, we will review any comments and make a final determination whether to convert the warning into a hard error or remove it entirely.

@oddg oddg added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Jun 13, 2020
@jonas-schievink jonas-schievink added A-destructors Area: Destructors (`Drop`, …) C-future-incompatibility Category: Future-incompatibility lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels Jun 13, 2020
@RalfJung
Copy link
Member

RalfJung commented Jun 2, 2022

In #97652 I am proposing to make this deny-by-default and make it show up in future breakage reports.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 18, 2022
make cenum_impl_drop_cast deny-by-default

Also make it show up as future breakage diagnostic.

In rust-lang#96862 we are proposing to change behavior of those drops *again*, so this looks like a good opportunity to increase our pressure on getting them out of the ecosystem. Looking at the [tracking issue](rust-lang#73333), so far nobody spoke up in favor of this (accidental) feature.

Cc rust-lang#73333 `@oli-obk`
@fmease fmease added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Sep 14, 2024
@fmease fmease changed the title Tracking Issue for forbidding cast of C-like enum implementing Drop Tracking issue for future-incompatibility lint cenum_impl_drop_cast Sep 14, 2024
@fmease fmease added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Sep 14, 2024
@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-destructors Area: Destructors (`Drop`, …) A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-future-incompatibility Category: Future-incompatibility lints C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Archived in project
Development

No branches or pull requests

4 participants