Skip to content

Infinite loop in get_all_import_attributes #107350

Closed
@Jake-Shadle

Description

@Jake-Shadle

I tried this code:

pub mod oops {
    pub use crate::oops::OhNo;

    mod inner {
        pub enum OhNo {
            Item = 1,
        }
    }

    pub use inner::*;
}

I expected to see this happen: rustdoc successfully documents our code

Instead, this happened: rustdoc infinitely loops inside get_all_import_attributes

Meta

rustc --version --verbose:

rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6
Backtrace

 thread #2, name = 'rustc', stop reason = signal SIGSTOP
    frame #0: 0x00007f1856b981ed librustc_driver-2e8cbd5b30733393.so`<rustc_middle::hir::map::Map>::get_if_local + 461
    frame #1: 0x00005623c1409031 rustdoc`rustdoc::clean::get_all_import_attributes + 145
    frame #2: 0x00005623c13861f5 rustdoc`<rustdoc::core::DocContext>::with_param_env::<alloc::vec::Vec<rustdoc::clean::types::Item>, rustdoc::clean::clean_maybe_renamed_item::{closure#1}> + 3205
    frame #3: 0x00005623c13f5c2c rustdoc`<&mut rustdoc::clean::clean_doc_module::{closure#2} as core::ops::function::FnOnce<(&(&rustc_hir::hir::Item, core::option::Option<rustc_span::symbol::Symbol>, core::option::Option<rustc_hir::hir_id::HirId>),)>>::call_once + 188
    frame #4: 0x00005623c121c154 rustdoc`<alloc::vec::Vec<rustdoc::clean::types::Item> as alloc::vec::spec_extend::SpecExtend<rustdoc::clean::types::Item, core::iter::adapters::flatten::FlatMap<core::slice::iter::Iter<(&rustc_hir::hir::Item, core::option::Option<rustc_span::symbol::Symbol>, core::option::Option<rustc_hir::hir_id::HirId>)>, alloc::vec::Vec<rustdoc::clean::types::Item>, rustdoc::clean::clean_doc_module::{closure#2}>>>::spec_extend + 596
    frame #5: 0x00005623c13fa862 rustdoc`rustdoc::clean::clean_doc_module + 370
    frame #6: 0x00005623c13f548b rustdoc`<&mut rustdoc::clean::clean_doc_module::{closure#1} as core::ops::function::FnMut<(&rustdoc::visit_ast::Module,)>>::call_mut + 267
    frame #7: 0x00005623c121b62e rustdoc`<alloc::vec::Vec<rustdoc::clean::types::Item> as alloc::vec::spec_extend::SpecExtend<rustdoc::clean::types::Item, core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rustdoc::visit_ast::Module>, rustdoc::clean::clean_doc_module::{closure#1}>>>::spec_extend + 94
    frame #8: 0x00005623c13fa813 rustdoc`rustdoc::clean::clean_doc_module + 291
    frame #9: 0x00005623c11359be rustdoc`rustdoc::clean::utils::krate + 2718
    frame #10: 0x00005623c12ecb24 rustdoc`<rustc_session::session::Session>::time::<rustdoc::clean::types::Crate, rustdoc::core::run_global_ctxt::{closure#4}> + 116
    frame #11: 0x00005623c138b7b4 rustdoc`rustdoc::core::run_global_ctxt + 2228
    frame #12: 0x00005623c12eec54 rustdoc`<rustc_interface::passes::QueryContext>::enter::<rustdoc::main_args::{closure#1}::{closure#0}::{closure#1}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> + 468
    frame #13: 0x00005623c115253a rustdoc`<rustc_interface::interface::Compiler>::enter::<rustdoc::main_args::{closure#1}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> + 714
    frame #14: 0x00005623c128d20a rustdoc`rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}::{closure#0}> + 458
    frame #15: 0x00005623c1254615 rustdoc`<scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> + 1493
    frame #16: 0x00005623c129e8f0 rustdoc`std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> + 128
    frame #17: 0x00005623c13f18ff rustdoc`<<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 207
    frame #18: 0x00007f1855572803 libstd-2a15b3cd0948397b.so`std::sys::unix::thread::Thread::new::thread_start::h1541b4390bbc26ca [inlined] _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::ha93239d92e7b610d at boxed.rs:2000:9
    frame #19: 0x00007f18555727fd libstd-2a15b3cd0948397b.so`std::sys::unix::thread::Thread::new::thread_start::h1541b4390bbc26ca [inlined] _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::hebda57b0236de612 at boxed.rs:2000:9
    frame #20: 0x00007f18555727f6 libstd-2a15b3cd0948397b.so`std::sys::unix::thread::Thread::new::thread_start::h1541b4390bbc26ca at thread.rs:108:17
    frame #21: 0x00007f185531412d libc.so.6`start_thread + 717
    frame #22: 0x00007f1855395bc0 libc.so.6`__clone3 + 48

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc 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