Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
38aa6bdfd705ea0604d7d5dd9fabc5e8f853a4fc
0ec370670220b712b042ee09aab067ec7e5878d5
2 changes: 2 additions & 0 deletions tests/run-pass/c_enums.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(const_err)] // don't warn about truncating casts
Copy link
Member

Choose a reason for hiding this comment

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

Wait, so hard errors inside constants and const-prop-originating warnings outside constants use the same lint name? Isn't that odd?

Copy link
Member

Choose a reason for hiding this comment

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

Ah no, turns out rust-lang/rust#67676 made these overflows err-by-default, actually. Interesting.

Copy link
Member

Choose a reason for hiding this comment

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

But to me the lint looks wrong here:

enum Signed {
    Bar = -42,
    Baz,
    Quux = 100,
}
fn signed() -> [i8; 3] {
    let baz = Signed::Baz; // let-expansion changes the MIR significantly
    [Signed::Bar as i8, baz as i8, Signed::Quux as i8]
}

Signed::Bar is -42 which is well inside the range of i8. So why is there an error shown?


enum Foo {
Bar = 42,
Baz,
Expand Down