Skip to content

Conversation

@Jaidenmagnan
Copy link

@Jaidenmagnan Jaidenmagnan commented Jan 14, 2026

Issue: #151116
A more descriptive error message when casting an enum to an Integer. Please review issue linked above. Here is a screenshot of the casting tests passing.

image

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer


fn main() {
let priority = &Priority::Normal;
let priority = priority as u8; //~ ERROR casting `&Priority` as `u8` is invalid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to check the HELP message as well.
like

Suggested change
let priority = priority as u8; //~ ERROR casting `&Priority` as `u8` is invalid
let priority = priority as u8; //~ ERROR casting `&Priority` as `u8` is invalid
//~| HELP: dereference the expression

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to check the HELP message as well. like

Ty! will add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants