Issue 1:
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.

Looks superficially similar to #23888 but it's not clear that my changes have introduced an == on "fat raw pointers".

src/geometry.rs:72:26: 72:29 warning: unused variable: rng, #[warn(unused_variables)] on by default

src/geometry.rs:72 fn random_pos(&self, rng: &mut F64Rng) -> Vec3d {

^~~

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: run with RUST_BACKTRACE=1 for a backtrace

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

stack backtrace:

1: 0x7f7444b3f449 - sys::backtrace::write::hbc46dc0cfb3b9537d4r

2: 0x7f7444b47156 - panicking::on_panic::h74d3c14d86c58ac8jrw

3: 0x7f7444b0a462 - rt::unwind::begin_unwind_inner::h382cea404b11eb00t6v

4: 0x7f744420137e - rt::unwind::begin_unwind::h11527883117899559464

5: 0x7f7444291db2 - trans::datum::Datum<'tcx, K>::to_llscalarish::h13658016800508616489

6: 0x7f7444314d08 - trans::expr::trans_binary::h675be97e90ac8015O6B

7: 0x7f744430b72c - trans::expr::trans_unadjusted::h36bc1189b1eec85e9zA

8: 0x7f7444244ad4 - trans::expr::trans::h7f89da2569c8dc1bgdA

9: 0x7f744430d086 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A

10: 0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z

11: 0x7f7444265b0e - trans::controlflow::trans_block::hfa898015a1217b0b02u

12: 0x7f744430c6e9 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A

13: 0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z

14: 0x7f744434b753 - trans::_match::trans_match_inner::h6119af2a2800890b61H

15: 0x7f744430c6b3 - trans::expr::trans_rvalue_dps_unadjusted::h7c0140fcbfb13319C5A

16: 0x7f74442e0fd7 - trans::expr::trans_into::h10885d95ed8d401aX6z

17: 0x7f7444265b0e - trans::controlflow::trans_block::hfa898015a1217b0b02u

18: 0x7f74442645b1 - trans::base::trans_closure::h8e5687f4ccb96c5eLCh

19: 0x7f74442660ea - trans::base::trans_fn::h0bc8fb6dbe17d6adtNh

20: 0x7f7444269c44 - trans::base::trans_item::h4f9c99b1e4474396Fbi

21: 0x7f7444269ab8 - trans::base::trans_item::h4f9c99b1e4474396Fbi

22: 0x7f744427756d - trans::base::trans_crate::haa02506df24d5efcF0i

23: 0x7f744508d0fa - driver::phase_4_translate_to_llvm::h86d6fb84c5c936d5hOa

24: 0x7f7445064faa - driver::compile_input::hb78754f2f33c01efQba

25: 0x7f74451264d1 - run_compiler::h258d36d5501c1cdfz4b

26: 0x7f7445124122 - boxed::F.FnBox::call_box::h7239693171334256553

27: 0x7f7445123659 - rt::unwind::try::try_fn::h14329119008520845439

28: 0x7f7444bb9ac8 - rust_try_inner

29: 0x7f7444bb9ab5 - rust_try

30: 0x7f7445123908 - boxed::F.FnBox::call_box::h17332056298259451807

31: 0x7f7444b46041 - sys:🧵:create::thread_start::h490278b5c3c0b49faqv

32: 0x7f743f3c8181 - start_thread

33: 0x7f744479047c - __clone

34: 0x0 -

Could not compile path_tracer.

Caused by:

Process didn't exit successfully: 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 (exit code: 101)

I've checked in the code at https://github.com/mattgodbolt/path-tracer/tree/ice and will leave that 'ice' branch pointing at the broken build while I try and find a workaround and/or fix.

Issue 2:
Imagine a tail call { be foo() as int } where foo() returns an i32 and on the current arch it is known that integers are 32 bit wide.

In this case, it should be ok to drop the cast and tail-call foo().

The idea for this came up when rewriting std::math, cf

https://github.com/boggle/rust/blob/libmath/src/lib/math.rs