<p dir="auto">A bug (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="20128173" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/9531" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/9531/hovercard" href="https://github.com/rust-lang/rust/issues/9531">#9531</a>) went undetected because I was careless and failed to put a variable definition before all of its uses (SHA: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/b1a22518f0c687db008c4abf5e8e0411fb58c2f5/hovercard" href="https://github.com/rust-lang/rust/commit/b1a22518f0c687db008c4abf5e8e0411fb58c2f5"><tt>b1a2251</tt></a>).</p>
<p dir="auto">Further investigation revealed that make <em>does</em> offer an <code class="notranslate">--warn-undefined-variables</code> option that will list all variables that are expanded without being provided a definition.</p>
<p dir="auto">It might be good if we tried to minimize the number of warnings emitted by that flag, by putting explicit (even if empty) definitions up before their first use.</p>
<p dir="auto">(Here's the list of warnings emitted, with obvious duplicate entries removed.)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% make -j1 --warn-undefined-variables
Makefile:76: warning: undefined variable `MAKE_RESTARTS'
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
Makefile:91: warning: undefined variable `RUSTFLAGS'
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
cfg: using ccache clang
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:370: warning: undefined variable `CFG_LDPATH_i686-pc-mingw32'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:422: warning: undefined variable `CFG_LDPATH_x86_64-w64-mingw32'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTC_FLAGS_x86_64-apple-darwin'
Makefile:497: warning: undefined variable `CFG_PERF_TOOL'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
Makefile:548: warning: undefined variable `CFG_IN_TRANSITION'
Makefile:570: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `BORROWCK'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `CFG_PAXCTL'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/host.mk:148: warning: undefined variable `STDLIB_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `OSTYPE_'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:40: warning: undefined variable `MAKECMDGOALS'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_0'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_2'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_3'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `LIBRUST_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/docs.mk:41: warning: undefined variable `NO_DOCS'
Makefile:628: warning: undefined variable `MAKECMDGOALS'
make: Nothing to be done for `all'."><pre class="notranslate"><code class="notranslate">% make -j1 --warn-undefined-variables
Makefile:76: warning: undefined variable `MAKE_RESTARTS'
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
Makefile:91: warning: undefined variable `RUSTFLAGS'
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
cfg: using ccache clang
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:370: warning: undefined variable `CFG_LDPATH_i686-pc-mingw32'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/platform.mk:422: warning: undefined variable `CFG_LDPATH_x86_64-w64-mingw32'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTC_FLAGS_x86_64-apple-darwin'
Makefile:497: warning: undefined variable `CFG_PERF_TOOL'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE0'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:497: warning: undefined variable `RUSTFLAGS_STAGE3'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
Makefile:518: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
Makefile:548: warning: undefined variable `CFG_IN_TRANSITION'
Makefile:570: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `BORROWCK'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `CFG_PAXCTL'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/target.mk:134: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/host.mk:148: warning: undefined variable `STDLIB_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:29: warning: undefined variable `OSTYPE_'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:40: warning: undefined variable `MAKECMDGOALS'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_0'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_1'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_2'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `,'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/rt.mk:287: warning: undefined variable `MORESTACK_OBJS_x86_64-apple-darwin_3'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT0_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:219: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `LIBRUST_DSYM_GLOB'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT1_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT2_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/tools.mk:226: warning: undefined variable `HLIBSYNTAX_DEFAULT3_H_x86_64-apple-darwin'
/Users/pnkfelix/Dev/Mozilla/rust.git/mk/docs.mk:41: warning: undefined variable `NO_DOCS'
Makefile:628: warning: undefined variable `MAKECMDGOALS'
make: Nothing to be done for `all'.
</code></pre></div>
<p dir="auto">I encountered this error while building "router" crate.</p>
<p dir="auto">/Users/.cargo/registry/src/github.com-1ecc6299db9ec823/router-0.0.9/src/router.rs:158:1: 158:45 error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait <code class="notranslate">core::marker::MarkerTrait</code> for the type <code class="notranslate">iron::middleware::Handler</code><br>
/Users/biye/.cargo/registry/src/github.com-1ecc6299db9ec823/router-0.0.9/src/router.rs:158 impl Key for Router { type Value = Params; }<br>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
note: the compiler unexpectedly panicked. this is a bug.<br>
note: we would appreciate a bug report: <a href="https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports">https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports</a><br>
note: run with <code class="notranslate">RUST_BACKTRACE=1</code> for a backtrace</p>
<p dir="auto">thread 'rustc' panicked at 'Box', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:130</p>
<p dir="auto">stack backtrace:<br>
1:        0x1090eddf7 - sys::backtrace::write::hcdd8cf990b8f0f0e1LC<br>
2:        0x10911bccd - panicking::on_panic::hbbf8c269bccad920HAI<br>
3:        0x10904015e - rt::unwind::begin_unwind_inner::h2f66a36e4dcc3e43iiI<br>
4:        0x1088174ee - rt::unwind::begin_unwind::h4366604798127356786<br>
5:        0x10881749b - diagnostic::SpanHandler::span_bug::h0e21e2a54cd366dbjnB<br>
6:        0x1062d2666 - middle::traits::error_reporting::report_fulfillment_error::h24e2f9dcf11073a7hTN<br>
7:        0x10613ede1 - middle::traits::error_reporting::report_fulfillment_errors::he23632a94223023axSN<br>
8:        0x10567f7c2 - check::vtable::select_all_fcx_obligations_or_error::hded438f3b654ae6bX1b<br>
9:        0x10570b76e - check::wf::CheckTypeWellFormedVisitor&lt;'ccx, 'tcx&gt;::check_item_well_formed::h50d40da11e7554f3mWk<br>
10:        0x105714261 - visit::walk_item::h17483634980229280695<br>
11:        0x105814569 - check_crate::closure.36302<br>
12:        0x10580ea37 - check_crate::hf2047274e19fe4f4bwC<br>
13:        0x10552c2d5 - driver::phase_3_run_analysis_passes::h7ac32f1d1ca0be7dgGa<br>
14:        0x105510a05 - driver::compile_input::haed712778d66caf6Qba<br>
15:        0x1055ce985 - run_compiler::h2df8296b9f7c362fV4b<br>
16:        0x1055cc152 - boxed::F.FnBox::call_box::h8968837061369711197<br>
17:        0x1055cb647 - rt::unwind::try::try_fn::h5695919628988619761<br>
18:        0x1091a5d28 - rust_try_inner<br>
19:        0x1091a5d15 - rust_try<br>
20:        0x1055cb93a - boxed::F.FnBox::call_box::h17367168855684310088<br>
21:        0x1091051fd - sys:<g-emoji class="g-emoji" alias="thread" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f9f5.png">🧵</g-emoji>:create::thread_start::he0d7c708bf73803bihH<br>
22:     0x7fff8c0a2267 - _pthread_body<br>
23:     0x7fff8c0a21e4 - _pthread_start</p>