Skip to content

rustdoc: ICE: synthetic blanket impls: no errors encountered even though span_delayed_bug issued #119792

Closed

Description

@spearman

This only happens with rust doc.

Crate builds and runs tests successfully on current master: https://gitlab.com/spearman/math-utils-rs/-/commit/9a16929f40de8a21815cae85d889bca8edf28ae2

ICE occurs with $ cargo doc --no-deps

Code

The backtrace doesn't seem to point to any specific code in the crate.

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (190f4c961 2024-01-09)
binary: rustc
commit-hash: 190f4c96116a3b59b7de4881cfec544be0246d84
commit-date: 2024-01-09
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

Backtrace

$ cargo doc --no-deps
 Documenting math-utils v0.0.13 (/home/spearman/rs/local/utils-math)
error: internal compiler error: no errors encountered even though `span_delayed_bug` issued

error: internal compiler error: Impl DefId(0:4614 ~ math_utils[6851]::types::{impl#286}) was matchable against Obligation(predicate=Binder { value: TraitPredicate(<types::AngleWrapped<_> as std::ops::Rem<_>>, polarity:Positive), bound_vars: [] }, depth=2) but now is not
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/select/mod.rs:2429:45
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxt>::emit_diagnostic
             2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
             3: <rustc_trait_selection::traits::select::SelectionContext>::poly_select
             4: rustc_trait_selection::traits::project::opt_normalize_projection_type
             5: rustc_trait_selection::traits::project::poly_project_and_unify_type
             6: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_candidate
             7: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
             8: <rustc_trait_selection::traits::select::SelectionContext>::evaluation_probe::<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>
             9: rustc_traits::evaluate_obligation::evaluate_obligation
            10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 2]>>
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::Canonical<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, rustc_middle::query::erase::Erased<[u8; 2]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            12: rustc_query_impl::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
            13: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
            14: rustdoc::clean::utils::get_auto_trait_and_blanket_impls
            15: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            16: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            17: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            18: rustdoc::passes::collect_trait_impls::collect_trait_impls
            19: rustdoc::core::run_global_ctxt
            20: rustdoc::main_args::{closure#1}::{closure#0}::{closure#0}
            21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}
            22: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            23: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/alloc/src/boxed.rs:2016:9
            25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/alloc/src/boxed.rs:2016:9
            26: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/std/src/sys/unix/thread.rs:108:17
            27: start_thread
            28: __GI___clone3
          

error: internal compiler error: Impl DefId(0:4713 ~ math_utils[6851]::types::{impl#313}) was matchable against Obligation(predicate=Binder { value: TraitPredicate(<types::AngleWrappedSigned<_> as std::ops::Rem<_>>, polarity:Positive), bound_vars: [] }, depth=2) but now is not
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/select/mod.rs:2429:45
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             1: <rustc_errors::DiagCtxt>::emit_diagnostic
             2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
             3: <rustc_trait_selection::traits::select::SelectionContext>::poly_select
             4: rustc_trait_selection::traits::project::opt_normalize_projection_type
             5: rustc_trait_selection::traits::project::poly_project_and_unify_type
             6: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_candidate
             7: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
             8: <rustc_trait_selection::traits::select::SelectionContext>::evaluation_probe::<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>
             9: rustc_traits::evaluate_obligation::evaluate_obligation
            10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 2]>>
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::Canonical<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, rustc_middle::query::erase::Erased<[u8; 2]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            12: rustc_query_impl::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
            13: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
            14: rustdoc::clean::utils::get_auto_trait_and_blanket_impls
            15: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            16: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            17: <rustdoc::passes::collect_trait_impls::SyntheticImplCollector as rustdoc::visit::DocVisitor>::visit_item
            18: rustdoc::passes::collect_trait_impls::collect_trait_impls
            19: rustdoc::core::run_global_ctxt
            20: rustdoc::main_args::{closure#1}::{closure#0}::{closure#0}
            21: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}
            22: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            23: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustdoc::main_args::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/alloc/src/boxed.rs:2016:9
            25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/alloc/src/boxed.rs:2016:9
            26: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/190f4c96116a3b59b7de4881cfec544be0246d84/library/std/src/sys/unix/thread.rs:108:17
            27: start_thread
            28: __GI___clone3
          

note: 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/spearman/rs/local/utils-math/rustc-ice-2024-01-10T01_15_36-693223.txt` to your bug report

note: compiler flags: --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not document `math-utils`

Caused by:
  process didn't exit successfully: `/home/spearman/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc --edition=2021 --crate-type lib --crate-name math_utils src/lib.rs -o /home/spearman/rs/local/utils-math/target/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=199 -C metadata=1228b3c84efd442c -L dependency=/home/spearman/rs/local/utils-math/target/debug/deps --extern cordic=/home/spearman/rs/local/utils-math/target/debug/deps/libcordic-38a1c6708d30398f.rmeta --extern derive_more=/home/spearman/rs/local/utils-math/target/debug/deps/libderive_more-350f12f6eba7e9a6.so --extern either=/home/spearman/rs/local/utils-math/target/debug/deps/libeither-360ce3c4f1737f87.rmeta --extern fixed=/home/spearman/rs/local/utils-math/target/debug/deps/libfixed-e8718b679acab2b3.rmeta --extern fixed_sqrt=/home/spearman/rs/local/utils-math/target/debug/deps/libfixed_sqrt-6fc148de1837bfe5.rmeta --extern rand=/home/spearman/rs/local/utils-math/target/debug/deps/librand-dff2f50eb8111482.rmeta --extern strum=/home/spearman/rs/local/utils-math/target/debug/deps/libstrum-ee1653a868fa76dc.rmeta --extern vek=/home/spearman/rs/local/utils-math/target/debug/deps/libvek-da2680a69e1fa61a.rmeta --crate-version 0.0.13` (exit status: 101)

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 10, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 10, 2024
  3. changed the title [-]ICE: no errors encountered even though `span_delayed_bug` issued[/-] [+](rustdoc) ICE: no errors encountered even though `span_delayed_bug` issued[/+] on Jan 10, 2024
  4. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 10, 2024
  5. Luk-ESC commented on Feb 3, 2024

    @Luk-ESC
    Contributor

    Minimized to:

    struct Wrapper<T>(T);
    
    trait Div<Rhs> {}
    trait Mul<Rhs> {
        type Output;
    }
    
    impl<T> Mul<T> for Wrapper<T> {
        type Output = ();
    }
    
    impl<T> Div<Self> for Wrapper<T> {}
    
    pub trait NumOps<Rhs> {}
    
    impl<T, Rhs> NumOps<Rhs> for T where T: Mul<Rhs, Output = ()> + Div<Rhs> {}
  6. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Feb 28, 2024
  7. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Apr 30, 2024
  8. fmease commented on Apr 30, 2024

    @fmease
    Member

    #119792 (comment)

    Triage: I can no longer reproduce this. Can be closed once a regression test has been added.

  9. changed the title [-](rustdoc) ICE: no errors encountered even though `span_delayed_bug` issued[/-] [+]rustdoc: ICE: synthetic blanket impls: no errors encountered even though `span_delayed_bug` issued[/+] on Jun 3, 2024
  10. added a commit that references this issue on Jun 3, 2024
    0d5f055
  11. added 2 commits that reference this issue on Jun 3, 2024
    64a62d4
    0b0dc46
  12. added 2 commits that reference this issue on Jun 4, 2024
    5e26f6a
    0ed7bbc
  13. added a commit that references this issue on Jun 4, 2024
    6abb7fb
  14. added a commit that references this issue on Jun 4, 2024
    1e71efa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-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.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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