Skip to content

Diagnostics for conversions erroneously say that 'as' only works between primitive types. #47136

Open
@alercah

Description

@alercah

See https://play.rust-lang.org/?gist=7194dac428b4355e3f2872e9c0206800&version=stable

The note says "an as expression can only be used to convert between primitive types. Consider using the From trait", but as show by the expression Baz as i32, this is not true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions