Skip to content

miri: invalid enum discriminant value read #49777

Description

@bjorn3

When running it with priroda, the value for which the discriminant is read is 0xff

---- [ui] run-pass/issue-15523-big.rs stdout ----
	normalized stderr:
error[E0080]: constant evaluation error
  --> $DIR/issue-15523-big.rs:17:21
   |
17 | #[derive(PartialEq, PartialOrd)]
   |                     ^^^^^^^^^^ invalid enum discriminant value read
   |
note: inside call to `<Eu64 as std::cmp::PartialOrd>::partial_cmp`
  --> /home/bjorn/Documenten/rust2/src/libcore/cmp.rs:647:15
   |
647|         match self.partial_cmp(other) {
   |               ^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<Eu64 as std::cmp::PartialOrd>::lt`
  --> $DIR/issue-15523-big.rs:37:13
   |
37 |     assert!(Eu64::Pos2 < Eu64::PosMax);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `main`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:74:34
   |
74 |     lang_start_internal(&move || main().report(), argc, argv)
   |                                  ^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:59:75
   |
59 |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
   |                                                                           ^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/sys_common/backtrace.rs:136:5
   |
136|     f()
   |     ^^^
note: inside call to `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1/1:1802 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:59:13
   |
59 |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/panicking.rs:306:40
   |
306|             ptr::write(&mut (*data).r, f());
   |                                        ^^^
note: inside call to `std::panicking::try::do_call::<[closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/panicking.rs:302:5
   |
302| /     fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
303| |         unsafe {
304| |             let data = data as *mut Data<F, R>;
305| |             let f = ptr::read(&mut (*data).f);
306| |             ptr::write(&mut (*data).r, f());
307| |         }
308| |     }
   | |_____^
note: inside call to `std::panicking::try::<i32, [closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>`
  --> /home/bjorn/Documenten/rust2/src/libstd/panic.rs:361:9
   |
361|         panicking::try(f)
   |         ^^^^^^^^^^^^^^^^^
note: inside call to `std::panic::catch_unwind::<[closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:58:25
   |
58 |           let exit_code = panic::catch_unwind(|| {
   |  _________________________^
59 | |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
60 | |         });
   | |__________^
note: inside call to `std::rt::lang_start_internal`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:74:5
   |
74 |     lang_start_internal(&move || main().report(), argc, argv)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.

cc @oli-obk
blocking rust-lang/miri#364

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions