<p dir="auto">While refactoring some code I tripped over this one. As most of the program has changed, I'm not sure what the actual cause is. Posting here in case someone can help me fathom what it is.</p>
<p dir="auto">Looks superficially similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="65410617" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/23888" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/23888/hovercard" href="https://github.com/rust-lang/rust/issues/23888">#23888</a> but it's not clear that my changes have introduced an == on "fat raw pointers".</p>
<p dir="auto">src/geometry.rs:72:26: 72:29 warning: unused variable: <code class="notranslate">rng</code>, #[warn(unused_variables)] on by default<br>
src/geometry.rs:72     fn random_pos(&amp;self, rng: &amp;mut F64Rng) -&gt; Vec3d {<br>
^~~<br>
error: internal compiler error: unexpected panic<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<br>
thread 'rustc' panicked at 'assertion failed: self.appropriate_rvalue_mode(bcx.ccx()) == ByValue', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_trans/trans/datum.rs:646</p>
<p dir="auto">stack backtrace:<br>
1:     0x7f7444b3f449 - sys::backtrace::write::hbc46dc0cfb3b9537d4r<br>
2:     0x7f7444b47156 - panicking::on_panic::h74d3c14d86c58ac8jrw<br>
3:     0x7f7444b0a462 - rt::unwind::begin_unwind_inner::h382cea404b11eb00t6v<br>
4:     0x7f744420137e - rt::unwind::begin_unwind::h11527883117899559464<br>
5:     0x7f7444291db2 - trans::datum::Datum&lt;'tcx, K&gt;::to_llscalarish::h13658016800508616489<br>
6:     0x7f7444314d08 - trans::expr::trans_binary::h675be97e90ac8015O6B<br>
7:     0x7f744430b72c - trans::expr::trans_unadjusted::h36bc1189b1eec85e9zA<br>
8:     0x7f7444244ad4 - trans::expr::trans::h7f89da2569c8dc1bgdA<br>
9:     0x7f744430d086 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A<br>
10:     0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z<br>
11:     0x7f7444265b0e - trans::controlflow::trans_block::hfa898015a1217b0b02u<br>
12:     0x7f744430c6e9 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A<br>
13:     0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z<br>
14:     0x7f744434b753 - trans::_match::trans_match_inner::h6119af2a2800890b61H<br>
15:     0x7f744430c6b3 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A<br>
16:     0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z<br>
17:     0x7f7444265b0e - trans::controlflow::trans_block::hfa898015a1217b0b02u<br>
18:     0x7f74442645b1 - trans::base::trans_closure::h8e5687f4ccb96c5eLCh<br>
19:     0x7f74442660ea - trans::base::trans_fn::h0bc8fb6dbe17d6adtNh<br>
20:     0x7f7444269c44 - trans::base::trans_item::h4f9c99b1e4474396Fbi<br>
21:     0x7f7444269ab8 - trans::base::trans_item::h4f9c99b1e4474396Fbi<br>
22:     0x7f744427756d - trans::base::trans_crate::haa02506df24d5efcF0i<br>
23:     0x7f744508d0fa - driver::phase_4_translate_to_llvm::h86d6fb84c5c936d5hOa<br>
24:     0x7f7445064faa - driver::compile_input::hb78754f2f33c01efQba<br>
25:     0x7f74451264d1 - run_compiler::h258d36d5501c1cdfz4b<br>
26:     0x7f7445124122 - boxed::F.FnBox::call_box::h7239693171334256553<br>
27:     0x7f7445123659 - rt::unwind::try::try_fn::h14329119008520845439<br>
28:     0x7f7444bb9ac8 - rust_try_inner<br>
29:     0x7f7444bb9ab5 - rust_try<br>
30:     0x7f7445123908 - boxed::F.FnBox::call_box::h17332056298259451807<br>
31:     0x7f7444b46041 - 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::h490278b5c3c0b49faqv<br>
32:     0x7f743f3c8181 - start_thread<br>
33:     0x7f744479047c - __clone<br>
34:                0x0 - </p>
<p dir="auto">Could not compile <code class="notranslate">path_tracer</code>.</p>
<p dir="auto">Caused by:<br>
Process didn't exit successfully: <code class="notranslate">rustc src/lib.rs --crate-name path_tracer --crate-type lib -g --out-dir /home/mgodbolt/dev/path-tracer/target/debug --emit=dep-info,link -L dependency=/home/mgodbolt/dev/path-tracer/target/debug -L dependency=/home/mgodbolt/dev/path-tracer/target/debug/deps --extern image=/home/mgodbolt/dev/path-tracer/target/debug/deps/libimage-0d2eddca90a3c251.rlib --extern threadpool=/home/mgodbolt/dev/path-tracer/target/debug/deps/libthreadpool-213781c0d8fba90b.rlib --extern rand=/home/mgodbolt/dev/path-tracer/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib --extern num_cpus=/home/mgodbolt/dev/path-tracer/target/debug/deps/libnum_cpus-d64cdaf0c78cf4e8.rlib --extern argparse=/home/mgodbolt/dev/path-tracer/target/debug/deps/libargparse-e91dcf4972ac931d.rlib</code> (exit code: 101)</p>
<p dir="auto">I've checked in the code at <a href="https://github.com/mattgodbolt/path-tracer/tree/ice">https://github.com/mattgodbolt/path-tracer/tree/ice</a> and will leave that 'ice' branch pointing at the broken build while I try and find a workaround and/or fix.</p>
<p dir="auto">Imagine a tail call <code class="notranslate">{ be foo() as int }</code> where <code class="notranslate">foo()</code> returns an <code class="notranslate">i32</code> and on the current arch it is known that integers are 32 bit wide.</p>
<p dir="auto">In this case, it should be ok to drop the cast and tail-call <code class="notranslate">foo()</code>.</p>
<p dir="auto">The idea for this came up when rewriting <code class="notranslate">std::math</code>, cf</p>
<p dir="auto"><a href="https://github.com/boggle/rust/blob/libmath/src/lib/math.rs">https://github.com/boggle/rust/blob/libmath/src/lib/math.rs</a></p>