Skip to content

Apparent infinite loop in AST validation with nested extern crate declaration #37887

Closed
@fweimer

Description

@fweimer

This program

fn main() {
    extern crate libc;
    use libc::*;
}

seems to cause the compiler too loop endlessly in AST validation, allocating more and more memory:

$ rustc -Z time-passes oom.rs 
warning: the option `Z` is unstable and should only be used on the nightly compiler, but it is currently accepted for backwards compatibility; this will soon change, see issue #31847 for more details

time: 0.000; rss: 31MB  parsing
time: 0.000; rss: 31MB  recursion limit
time: 0.000; rss: 31MB  crate injection
time: 0.000; rss: 31MB  plugin loading
time: 0.000; rss: 31MB  plugin registration
time: 0.024; rss: 51MB  expansion
time: 0.000; rss: 51MB  maybe building test harness
time: 0.000; rss: 51MB  maybe creating a macro crate
time: 0.000; rss: 51MB  checking for inline asm in case the target doesn't support it
time: 0.000; rss: 51MB  complete gated feature checking
time: 0.000; rss: 51MB  collecting defs
time: 0.000; rss: 51MB  early lint checks
time: 0.000; rss: 51MB  AST validation
^C
$ rustc --version
rustc 1.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions