Skip to content

NLL: dropck_vec_cycle_checked.rs very slow to compile #49998

Closed
@pnkfelix

Description

@pnkfelix

As noted on #49900 (comment) it appears that dropck_vec_cycle_checked.rs under -Znll requires more than an hour to compile (not yet clear how much time is actually required.)

Here is a reduced version of that test case that exhibits a 50x slowdown under -Znll. (Namely, it takes 0.163s to compile without -Znll, and takes 8.424s to compile with -Znll

// Reduced version of compile-fail/dropck_vec_cycle_checked.rs that
// still exhibits unacceptable time blow-up (but not to the point of
// being unrunnable).

use std::cell::Cell;

trait HasId { }
struct CheckId<T:HasId> { v: T }
impl<T:HasId> Drop for CheckId<T> { fn drop(&mut self) { } }
struct C<'a> { v: Vec<CheckId<Cell<Option<&'a C<'a>>>>> }
impl<'a> HasId for Cell<Option<&'a C<'a>>> { }
impl<'a> C<'a> { fn new() -> C<'a> { C { v: Vec::new() } } }

fn main() {
    let (mut c1, mut c2);
    c1 = C::new();
    c2 = C::new();

    c1.v[0].v.set(Some(&c2));
    //~^ ERROR `c2` does not live long enough

    c1.v[0].v.set(Some(&c2));
    //~^ ERROR `c2` does not live long enough
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    NLL-performantWorking towards the "performance is good" goal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions