rust icon indicating copy to clipboard operation
rust copied to clipboard

yet another silly `delay_span_bug` issue

Open Hezuikn opened this issue 3 years ago • 3 comments

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

Hezuikn avatar Aug 02 '22 20:08 Hezuikn

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 ?

5225225 avatar Aug 02 '22 20:08 5225225

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.

compiler-errors avatar Aug 03 '22 00:08 compiler-errors

That issue title is..not particularly ideal.

gimbling-away avatar Aug 05 '22 10:08 gimbling-away