Skip to content

Hang in item-bodies checking when dependency contains pub use crate #58430

Closed as duplicate of#57500
@dtolnay

Description

@dtolnay

Compiling the following pair of crates hangs and chews up memory.

src/main.rs

fn main() {
    repro_dep::S.f();
}

dep/src/lib.rs

pub use crate as krate;
pub struct S;

Repro script:

#!/bin/bash

cargo new --bin repro
cargo new --lib repro-dep

echo >repro/src/main.rs '
fn main() {
    repro_dep::S.f();
}
'

echo >>repro/Cargo.toml '
repro-dep = { path = "../repro-dep" }
'

echo >repro-dep/src/lib.rs '
pub use crate as krate;
pub struct S;
'

cargo rustc --manifest-path repro/Cargo.toml -- -Ztime-passes

Mentioning @petrochenkov and @nikomatsakis who worked on #45477.
Mentioning @nrc who hit this in a real project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions