rust
rust copied to clipboard
yet another silly `delay_span_bug` issue
playground
Code
trait Marker {}
impl<T> Marker for T {}
fn maybe<T>(_t: T) ->
Option<
//removing the line below makes it compile
&'static
T> {
None
}
fn _g<T>(t: &'static T) -> &'static impl Marker {
if let Some(t) = maybe(t) {
return _g(t);
}
todo!()
}
Error output
..: no errors encountered even though `delay_span_bug` issued
..: broken MIR in DefId(0:8 ~ playground[bb98]::_g) (Terminator { source_info: SourceInfo { span: src/main.rs:15:16: 15:21 (#0), scope: scope[0] }, kind: _0 = _g::<&T>(move _8) -> [return: bb4, unwind: bb6] }): call dest mismatch (&impl Marker <- &'static impl Marker): NoSolution
searched nightlies: from nightly-2022-01-01 to nightly-2022-08-02 regressed nightly: nightly-2022-04-30 searched commit range: https://github.com/rust-lang/rust/compare/e85edd9a844b523a02dbd89f3c02cd13e4c9fe46...a707f401074bc769bab4efb2bfdde7f6c5a4068d regressed commit: https://github.com/rust-lang/rust/commit/87937d3b6c302dfedfa5c4b94d0a30985d46298d
bisected with cargo-bisect-rustc v0.6.3
Host triple: x86_64-unknown-linux-gnu Reproduce with:
cargo bisect-rustc --start 2022-01-01 --preserve --prompt -- build
A rollup, but the most likely suspect is https://github.com/rust-lang/rust/pull/96516 ?
Minimized:
fn opaque<T>(t: T) -> impl Sized {
opaque(Some(t))
}
#[allow(dead_code)]
fn main() {}
Let me find a good way to explain what the issue is.
edit: left a bit of an explanation in the linked PR.
That issue title is..not particularly ideal.