Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: ICE: synthetic auto trait impls: no region_name found involving user-written impl that applies to higher-ranked lifetimes #123298

Open
fmease opened this issue Mar 31, 2024 · 1 comment
Assignees
Labels
A-auto-traits Area: auto traits (`auto trait Send`) A-lifetimes Area: lifetime related A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented Mar 31, 2024

Reproducer

pub struct Outer<'a>(Local<fn(&'a ())>);

struct Local<T>(T);

impl std::marker::Unpin for Local<for<'a> fn(&'a ())> {}

Compiler Output

thread 'rustc' panicked at src/librustdoc/clean/auto_trait.rs:222:52:
no region_name found
stack backtrace:
   0:     0x7f08e138bfa5 - std::backtrace_rs::backtrace::libunwind::trace::h78f4e9a1eb03772b
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f08e138bfa5 - std::backtrace_rs::backtrace::trace_unsynchronized::h3a38e307e09f41a8
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f08e138bfa5 - std::sys_common::backtrace::_print_fmt::he3d0e690b8551c2a
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f08e138bfa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1fad2a971ec36506
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f08e13dcfeb - core::fmt::rt::Argument::fmt::h7012a9e731998987
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/fmt/rt.rs:142:9
   5:     0x7f08e13dcfeb - core::fmt::write::h93b67068392b644b
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/fmt/mod.rs:1153:17
   6:     0x7f08e1380d3f - std::io::Write::write_fmt::he9d9e4eda6dbe3e6
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/io/mod.rs:1843:15
   7:     0x7f08e138bd7e - std::sys_common::backtrace::_print::h476d4a31909fadf9
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f08e138bd7e - std::sys_common::backtrace::print::h1fb17543fdb8f09d
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f08e138e9f9 - std::panicking::default_hook::{{closure}}::h6fc8d175caf3dd11
  10:     0x7f08e138e763 - std::panicking::default_hook::h29dd20611e406ef6
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/panicking.rs:292:9
  11:     0x7f08e43ca26f - std[7e22d6a0f2697500]::panicking::update_hook::<alloc[cc0f79cfb0d5dfba]::boxed::Box<rustc_driver_impl[6402987c68c0a870]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f08e138f150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h611aa430b073f4d2
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/alloc/src/boxed.rs:2029:9
  13:     0x7f08e138f150 - std::panicking::rust_panic_with_hook::h1aef15bad4c9dc6b
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/panicking.rs:783:13
  14:     0x7f08e138eea6 - std::panicking::begin_panic_handler::{{closure}}::h820c595fe343fedf
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/panicking.rs:657:13
  15:     0x7f08e138c469 - std::sys_common::backtrace::__rust_end_short_backtrace::h5f5dad5c075b596d
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f08e138ebd7 - rust_begin_unwind
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/panicking.rs:645:5
  17:     0x7f08e13d9486 - core::panicking::panic_fmt::hd12a49b253347127
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/panicking.rs:72:14
  18:     0x7f08e13d963c - core::panicking::panic_display::h5ead28ef6bb2b7dd
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/panicking.rs:193:5
  19:     0x7f08e13d924c - core::panicking::panic_str::hbc8176a12d958e35
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/panicking.rs:168:5
  20:     0x7f08e13d924c - core::option::expect_failed::h9309a723997892d7
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/core/src/option.rs:1994:5
  21:     0x55fe23356e96 - <rustc_trait_selection[ba26e62bc53f9bdc]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[653978f5a7bdea11]::clean::types::Generics, <rustdoc[653978f5a7bdea11]::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  22:     0x55fe234b9b50 - <rustdoc[653978f5a7bdea11]::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  23:     0x55fe234d7b81 - rustdoc[653978f5a7bdea11]::clean::utils::get_auto_trait_and_blanket_impls
  24:     0x55fe235e483a - <rustdoc[653978f5a7bdea11]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[653978f5a7bdea11]::visit::DocVisitor>::visit_item
  25:     0x55fe235e4b7a - <rustdoc[653978f5a7bdea11]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[653978f5a7bdea11]::visit::DocVisitor>::visit_item
  26:     0x55fe235e133d - rustdoc[653978f5a7bdea11]::passes::collect_trait_impls::collect_trait_impls
  27:     0x55fe2350a9fd - rustdoc[653978f5a7bdea11]::core::run_global_ctxt
  28:     0x55fe2340bcef - <rustc_middle[2a1b38579ffd754c]::ty::context::GlobalCtxt>::enter::<rustdoc[653978f5a7bdea11]::main_args::{closure#1}::{closure#0}::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#0}
  29:     0x55fe23415983 - rustc_interface[de4b62a04c0361df]::interface::run_compiler::<core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>, rustdoc[653978f5a7bdea11]::main_args::{closure#1}>::{closure#0}
  30:     0x55fe233e1a31 - std[7e22d6a0f2697500]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[de4b62a04c0361df]::util::run_in_thread_with_globals<rustc_interface[de4b62a04c0361df]::util::run_in_thread_pool_with_globals<rustc_interface[de4b62a04c0361df]::interface::run_compiler<core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>, rustdoc[653978f5a7bdea11]::main_args::{closure#1}>::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>
  31:     0x55fe2341f1c6 - <<std[7e22d6a0f2697500]::thread::Builder>::spawn_unchecked_<rustc_interface[de4b62a04c0361df]::util::run_in_thread_with_globals<rustc_interface[de4b62a04c0361df]::util::run_in_thread_pool_with_globals<rustc_interface[de4b62a04c0361df]::interface::run_compiler<core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>, rustdoc[653978f5a7bdea11]::main_args::{closure#1}>::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[40640d3ebf5fb0ac]::result::Result<(), rustc_span[e4a18c9710c4bc6]::ErrorGuaranteed>>::{closure#1} as core[40640d3ebf5fb0ac]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f08e1398919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb3b7a92ba6819109
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/alloc/src/boxed.rs:2015:9
  33:     0x7f08e1398919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbb9c447d7e0122c8
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/alloc/src/boxed.rs:2015:9
  34:     0x7f08e1398919 - std::sys::pal::unix::thread::Thread::new::thread_start::h7868674606c7eb25
                               at /rustc/85e449a3237e82c9ade8936a82bd4fc64cfe1057/library/std/src/sys/pal/unix/thread.rs:108:17
  35:     0x7f08e10939eb - <unknown>
  36:     0x7f08e11177cc - <unknown>
  37:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: it seems that this compiler `1.79.0-nightly (85e449a32 2024-03-22)` is outdated, a newer nightly should have been released in the mean time
  |
  = note: please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists
  = note: if the problem still persists, we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md

note: please attach the file at `/home/fmease/programming/rust2/rustc-ice-2024-03-31T19_57_39-248620.txt` to your bug report

query stack during panic:
end of query stack

Alternative Reproducer

Conceptually simpler but requires the use of unstable features:

#![feature(auto_traits)]

pub struct Outer<'a>(fn(&'a ()));

impl U for for<'a> fn(&'a ()) {}

pub auto trait U {}

Identical compiler output.

Meta

rustdoc -Vv:

rustc 1.79.0-nightly (85e449a32 2024-03-22)
binary: rustc
commit-hash: 85e449a3237e82c9ade8936a82bd4fc64cfe1057
commit-date: 2024-03-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
@fmease fmease added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls A-auto-traits Area: auto traits (`auto trait Send`) labels Mar 31, 2024
@fmease fmease self-assigned this Mar 31, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 31, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 31, 2024
@fmease fmease changed the title rustdoc: ICE: synthetic auto trait impls: no region_name found involving user-written impl only applying to higher-ranked lifetimes rustdoc: ICE: synthetic auto trait impls: no region_name found involving user-written impl that only applies to higher-ranked lifetimes Mar 31, 2024
@fmease fmease changed the title rustdoc: ICE: synthetic auto trait impls: no region_name found involving user-written impl that only applies to higher-ranked lifetimes rustdoc: ICE: synthetic auto trait impls: no region_name found involving user-written impl that applies to higher-ranked lifetimes Mar 31, 2024
@fmease
Copy link
Member Author

fmease commented Mar 31, 2024

And no, we ought not change region_name(region) to region.get_name(). Better reproducer that would fail even if we did that:

pub struct Outer<'a>(Local<fn(&'a ())>);

struct Local<T>(T);

impl std::marker::Unpin for Local<for<'x> fn(&'x ())> {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto-traits Area: auto traits (`auto trait Send`) A-lifetimes Area: lifetime related A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants