a-mir-formality icon indicating copy to clipboard operation
a-mir-formality copied to clipboard

Convert issue-25860 Ruts into a formality test case, including MIR

Open nikomatsakis opened this issue 3 years ago • 0 comments

Depends on #25

Convert

static UNIT: &'static &'static () = &&();

fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T {
    v
}

fn bad<'a, T>(x: &'a T) -> &'static T {
    let f: fn(_, &'a T) -> &'static T = foo;
    f(UNIT, x)
}

fn main() {
    let value = {
        let data = 22;
        bad(&data)
    };
    let _ = *value;
}

into a representative test case, including MIR.

This requires extending the MIR layer with a bit of plumbing (it can be dummy plumbing).

nikomatsakis avatar May 17 '22 21:05 nikomatsakis