Skip to content

Adding a Drop impl to a type is a breaking change #58379

Closed
@oli-obk

Description

@oli-obk

uncommenting the drop impl in the following program causes it to not compile

struct Foo;

/*
impl Drop for Foo {
    fn drop(&mut self) { }
}
*/

const fn new(_: Foo) { }

if the definition of Foo were in another crate, adding that Drop impl would break compilation of the crate with the const fn.

cc @Centril

I don't think adding a drop impl was a breaking change before const fn. But maybe I just can't come up with an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)T-langRelevant to the language team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions