Skip to content

No warning on assigning to field of const that doesn't succeed #74053

Closed
@CraftSpider

Description

@CraftSpider

I tried this code:

I expected to see this happen:

  • Either successful assignment or a compiler error, I actually would prefer the first but I'm not sure the intended behavior either way.

Instead, this happened:

  • Compile succeeds without warning, the value doesn't change.

Meta

Occurs in Stable, Beta, and Nightly builds on the playground.

No backtrace is emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions