Stream: general

Topic: playground-mir-output


davidtwco (Oct 05 2018 at 13:46, on Zulip):

Does anyone know why I always see:

warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

warning: ignoring --out-dir flag due to -o flag

warning: ignoring -C extra-filename flag due to -o flag

and no MIR output when trying to output MIR from the playground?

davidtwco (Oct 05 2018 at 13:47, on Zulip):

Only happens when there's a compilation failure.

Jake Goulding (Oct 05 2018 at 13:55, on Zulip):

It shouldn't be only when there's a failure...

It's because of the way that the command line is constructed. Lemme see if I can rustle it up.

davidtwco (Oct 05 2018 at 13:56, on Zulip):

Well, the only time I run into it is when there's a failure.

davidtwco (Oct 05 2018 at 13:57, on Zulip):

I often try get the MIR output for a failing test case on the playground so I can understand what's happening better - it's quicker than writing it to a file and dumping it locally.

Jake Goulding (Oct 05 2018 at 14:00, on Zulip):
Compilation command is "docker" "run" "--rm" "--cap-drop=ALL" "--cap-add=DAC_OVERRIDE" "--security-opt=no-new-privileges" "--workdir" "/playground" "--net" "none" "--memory" "256m" "--memory-swap" "320m" "--env" "PLAYGROUND_TIMEOUT=10" "--pids-limit" "512" "--volume" "/var/folders/_b/d4_bd15x7s5g99cjvyhpw26w0000gp/T/33433498d126482c8c126597d9eb9c98:/playground/src/main.rs" "--volume" "/var/folders/_b/d4_bd15x7s5g99cjvyhpw26w0000gp/T/9d2b307dc4d9471f890629a2bca5f037:/playground-result" "rust-stable" "cargo" "rustc" "--" "-o" "/playground-result/compilation" "--emit=mir"
Jake Goulding (Oct 05 2018 at 14:01, on Zulip):

So cargo rustc -- -o /playground-result/compilation --emit=mir

Jake Goulding (Oct 05 2018 at 14:03, on Zulip):

But I see it in success cases, like fn example() {}:

Standard Error
   Compiling playground v0.0.1 (file:///playground)
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

warning: ignoring --out-dir flag due to -o flag

warning: ignoring -C extra-filename flag due to -o flag

warning: function is never used: `example`
 --> src/lib.rs:1:1
  |
1 | fn example() {}
  | ^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.51s
Result
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn example() -> (){
    let mut _0: ();                      // return place

    bb0: {
        return;                          // bb0[0]: scope 0 at src/lib.rs:1:16: 1:16
    }
}
Jake Goulding (Oct 05 2018 at 14:03, on Zulip):

IIRC, it's because Cargo also specifies an output directory, and then we override it.

davidtwco (Oct 05 2018 at 14:04, on Zulip):

Yeah, it works in success cases. When I'm working on diagnostics, it is never success cases, so every so often I forget that and try it on playground and end up needing to do it locally which is more annoying.

Jake Goulding (Oct 05 2018 at 14:05, on Zulip):

Oh! So your real question is why is there no output? I was misled by you asking about the warning messages.

davidtwco (Oct 05 2018 at 14:05, on Zulip):

I guess yeah.

davidtwco (Oct 05 2018 at 14:06, on Zulip):

It'd be real helpful if the MIR was output regardless of success or failure.

davidtwco (Oct 05 2018 at 14:06, on Zulip):

Well, in cases where it gets to the point in the compiler where that is generated.

Jake Goulding (Oct 05 2018 at 14:07, on Zulip):

Is MIR actually output when the compiler fails (and when using those stable arguments)?

davidtwco (Oct 05 2018 at 14:07, on Zulip):

I have no idea about stable arguments, I only ever use -Z dump-mir=all.

Jake Goulding (Oct 05 2018 at 14:09, on Zulip):

Having nightly-only logic is one of the more painful parts of the playground (and expressing that difference in easily-digestible terms in the UI).

Jake Goulding (Oct 05 2018 at 14:10, on Zulip):

you got a small example of something that should generate MIR but the playground doesn't show it?

davidtwco (Oct 05 2018 at 14:11, on Zulip):

I've got this example - it's a slightly modified test case of an issue I'm tackling now.

davidtwco (Oct 05 2018 at 14:12, on Zulip):

Running that with -Z mir-dump=all gives a folder with a dozen or so files in mir_dump.

Jake Goulding (Oct 05 2018 at 14:25, on Zulip):

I know that @nikomatsakis has mused that they'd like to have all of those shown in the playground

Last update: Nov 21 2019 at 23:50UTC