Skip to content

dogfooding miri #282

Open
Open
@oli-obk

Description

@oli-obk

This issue is just to document my process. It's ridiculously slow, but a lot of fun.

  1. Build yourself a rustc with -Zalways-encode-mir (stage2 build necessary)
  2. Add it to rustup (e.g. under the name stage2)
  3. Build miri in release mode with --verbose and RUSTFLAGS=-Zalways-encode-mir -Zmir-opt-level=3
  4. Copy all the --extern flags and the -L dependency=... flag
  5. RUSTFLAGS=-Zalways-encode-mir -Zmir-opt-level=3 rustup run stage2 cargo run --bin miri/bin/miri.rs --verbose -- -Zmir-opt-level=3 and append all the flags from 4. after that command line
  6. have patience
  7. rejoice
WARN:miri::fn_call: ignoring C ABI call: pthread_attr_init
WARN:miri::fn_call: ignoring C ABI call: pthread_self
WARN:miri::fn_call: ignoring C ABI call: pthread_getattr_np
WARN:miri::fn_call: ignoring C ABI call: pthread_attr_getstack
WARN:miri::fn_call: ignoring C ABI call: pthread_attr_destroy
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_lock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_unlock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutexattr_init
WARN:miri::fn_call: ignoring C ABI call: pthread_mutexattr_settype
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_init
WARN:miri::fn_call: ignoring C ABI call: pthread_mutexattr_destroy
WARN:miri::fn_call: ignoring C ABI call: pthread_condattr_init
WARN:miri::fn_call: ignoring C ABI call: pthread_condattr_setclock
WARN:miri::fn_call: ignoring C ABI call: pthread_cond_init
WARN:miri::fn_call: ignoring C ABI call: pthread_condattr_destroy
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_lock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_unlock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_lock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_unlock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_lock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_unlock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_lock
WARN:miri::fn_call: ignoring C ABI call: pthread_mutex_unlock
error: get_field_offset: can't handle type: getopts::HasArg, with layout: CEnum { discr: I8, signed: false, non_zero: false, min: 0, max: 2 }
    --> rust/rust/src/liballoc/vec.rs:1825:17
     |
1825 | /                 for element in iterator {
1826 | |                     ptr::write(ptr, element);
1827 | |                     ptr = ptr.offset(1);
1828 | |                     // NB can't overflow since we would have had to alloc the address space
1829 | |                     local_len.increment_len(1);
1830 | |                 }
     | |_________________^
     |
note: inside call to <std::vec::Vec<T> as std::vec::SpecExtend<T, I>><getopts::Opt, std::iter::Map<std::slice::Iter<getopts::OptGroup>, [closure@DefId { krate: CrateNum(12), node: DefIndex(2147483707) => getopts/12fdf82::{{impl}}[0]::parse[0]::{{closure}}[0] }]>>::spec_extend
    --> rust/rust/src/liballoc/vec.rs:1808:9
     |
1808 |         vector.spec_extend(iterator);
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to <std::vec::Vec<T> as std::vec::SpecExtend<T, I>><getopts::Opt, std::iter::Map<std::slice::Iter<getopts::OptGroup>, [closure@DefId { krate: CrateNum(12), node: DefIndex(2147483707) => getopts/12fdf82::{{impl}}[0]::parse[0]::{{closure}}[0] }]>>::from_iter
    --> rust/rust/src/liballoc/vec.rs:1695:9
     |
1695 |         <Self as SpecExtend<T, I::IntoIter>>::from_iter(iter.into_iter())
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to <std::vec::Vec<T> as std::iter::FromIterator<T>><getopts::Opt>::from_iter::<std::iter::Map<std::slice::Iter<getopts::OptGroup>, [closure@DefId { krate: CrateNum(12), node: DefIndex(2147483707) => getopts/12fdf82::{{impl}}[0]::parse[0]::{{closure}}[0] }]>>
    --> rust/rust/src/libcore/iter/iterator.rs:1302:9
     |
1302 |         FromIterator::from_iter(self)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to <std::iter::Map<std::slice::Iter<getopts::OptGroup>, [closure@DefId { krate: CrateNum(12), node: DefIndex(2147483707) => getopts/12fdf82::{{impl}}[0]::parse[0]::{{closure}}[0] }]> as std::iter::Iterator>::collect::<std::vec::Vec<getopts::Opt>>
    --> /home/ws/ca8159/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.14/src/lib.rs:301:30
     |
301  |         let opts: Vec<Opt> = self.grps.iter().map(|x| x.long_to_short()).collect();
     |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to getopts::Options::parse::<&[std::string::String]>
    --> rust/rust/src/librustc_driver/lib.rs:1031:25
     |
1031 |     let matches = match options.parse(args) {
     |                         ^^^^^^^^^^^^^^^^^^^
note: inside call to rustc_driver::handle_options
    --> rust/rust/src/librustc_driver/lib.rs:170:25
     |
170  |     let matches = match handle_options(args) {
     |                         ^^^^^^^^^^^^^^^^^^^^
note: inside call to rustc_driver::run_compiler
    --> miri/bin/miri.rs:206:5
     |
206  |     rustc_driver::run_compiler(&args, &mut MiriCompilerCalls(RustcDefaultCalls), None, None);
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to main
    --> rust/rust/src/libcore/ops/function.rs:143:5
     |
143  |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
    --> rust/rust/src/libstd/sys_common/backtrace.rs:136:5
     |
136  |     f()
     |     ^^^
note: inside call to std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
    --> rust/rust/src/libstd/rt.rs:62:13
     |
62   |             ::sys_common::backtrace::__rust_begin_short_backtrace(main)
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to closure
    --> rust/rust/src/libstd/panicking.rs:479:40
     |
479  |             ptr::write(&mut (*data).r, f());
     |                                        ^^^
note: inside call to std::panicking::try::do_call::<[closure@DefId { krate: CrateNum(1), node: DefIndex(2147491399) => std/78549ff::rt[0]::lang_start[0]::{{closure}}[0] } 0:&fn()], ()>
    --> rust/rust/src/libstd/panicking.rs:475:5
     |
475  | /     fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
476  | |         unsafe {
477  | |             let data = data as *mut Data<F, R>;
478  | |             let f = ptr::read(&mut (*data).f);
479  | |             ptr::write(&mut (*data).r, f());
480  | |         }
481  | |     }
     | |_____^
note: inside call to std::panicking::try::<(), [closure@DefId { krate: CrateNum(1), node: DefIndex(2147491399) => std/78549ff::rt[0]::lang_start[0]::{{closure}}[0] } 0:&fn()]>
    --> rust/rust/src/libstd/panic.rs:361:9
     |
361  |         panicking::try(f)
     |         ^^^^^^^^^^^^^^^^^
note: inside call to std::panic::catch_unwind::<[closure@DefId { krate: CrateNum(1), node: DefIndex(2147491399) => std/78549ff::rt[0]::lang_start[0]::{{closure}}[0] } 0:&fn()], ()>
    --> rust/rust/src/libstd/rt.rs:61:19
     |
61   |           let res = panic::catch_unwind(|| {
     |  ___________________^
62   | |             ::sys_common::backtrace::__rust_begin_short_backtrace(main)
63   | |         });
     | |__________^
note: inside call to std::rt::lang_start
    --> rust/rust/src/libstd/rt.rs:34:1
     |
34   | / fn lang_start(main: fn(), argc: isize, argv: *const *const u8) -> isize {
35   | |     use panic;
36   | |     use sys;
37   | |     use sys_common;
...    |
74   | |     }
75   | | }
     | |_^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsArea: affects our test suite or CIC-proposalCategory: a proposal for something we might want to do, or maybe not; details still being worked out

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions