cargo: Build progressbar interleaved with rustc errors

[...]
error[E0308]: mismatched types
   --> /Users/bjorn/.cargo/git/checkouts/miri-f9dcdd0c0ec69fb1/9143a69/src/fn_call.rs:202:83
    |
202 |                     let ptr = self.memory.allocate(Size::from_bytes(size), align, Some(MemoryKind::C.into()))?;
    |                                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `rustc_mir::interpret::MemoryKind`, found enum `std::option::Option`
    |
    = note: expected type `rustc_mir::interpret::MemoryKind<memory::MemoryKind>`
               found type `std::option::Option<_>`

error[E0308]: mismatched types===============================>       ] 122/137: serde, hyper, serde_derive, miri, ring                               
   --> /Users/bjorn/.cargo/git/checkouts/miri-f9dcdd0c0ec69fb1/9143a69/src/fn_call.rs:398:25
    |
398 |                         Some(MemoryKind::Env.into()),
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `rustc_mir::interpret::MemoryKind`, found enum `std::option::Option`
    |
    = note: expected type `rustc_mir::interpret::MemoryKind<memory::MemoryKind>`
               found type `std::option::Option<_>`

error[E0308]: mismatched types===============================>       ] 122/137: serde, hyper, serde_derive, miri, ring                               
   --> /Users/bjorn/.cargo/git/checkouts/miri-f9dcdd0c0ec69fb1/9143a69/src/fn_call.rs:659:48
    |
659 |                                                Some(MemoryKind::Rust.into()))?;
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `rustc_mir::interpret::MemoryKind`, found enum `std::option::Option`
    |
    = note: expected type `rustc_mir::interpret::MemoryKind<memory::MemoryKind>`
               found type `std::option::Option<_>`

error[E0308]: mismatched types================================>      ] 123/137: serde, hyper, serde_derive, miri, ring                               
   --> /Users/bjorn/.cargo/git/checkouts/miri-f9dcdd0c0ec69fb1/9143a69/src/fn_call.rs:673:48
    |
673 |                                                Some(MemoryKind::Rust.into()))?;
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `rustc_mir::interpret::MemoryKind`, found enum `std::option::Option`
    |
    = note: expected type `rustc_mir::interpret::MemoryKind<memory::MemoryKind>`
               found type `std::option::Option<_>`

   Compiling toml v0.4.6                                                                                                                             
   Compiling bincode v1.0.1                                                                                                                          
error: aborting due to 9 previous errors======================>      ] 124/137: hyper, serde_derive, miri, ring, toml, bincode 

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@bjorn3 To address that, we can stream the output in the case that only one rustc is running. Otherwise, buffering benefits more because you don’t want the error contexts to be mixed up anyway.

[…] buffer all rustc output until the invocation ends […]

Please don’t, That would drastically increase the time before the first errors are printed in some cases.

@kennytm I believe that the solution here is to buffer all rustc output until the invocation ends, and rustc should never be interactive or display a progress indicator as it’s not a compiler’s job but the build tool’s.

Though, if we ever need to RPC with rustc, we can change the implementation when we do. I’d say that there’s not much motivation for it to be done in the near future, though.

@ishitatsuyuki Cargo currently needs to know the terminal size for the progress bar. This is done by ioctl(STDERR_FILENO, TIOCGWINSZ) on Unix and GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE)) on Windows. While rustc currently doesn’t need to know the terminal size, I cannot deny the possibility that it might be used in the future. Do you know if it is possible to transmit these info to the child process while piping/teeing their stdout/stderr?

I seem to remember a discussion about extracting rustc’s error formatting machinery into a reusable crate (though I can’t find that discussion, sorry!). If that happened, would using rustc’s JSON output be enough, as cargo could use that crate to recreate the errors?