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

ICE: reached the recursion limit finding the struct tail for #109304

Closed
matthiaskrgr opened this issue Mar 18, 2023 · 1 comment · Fixed by #109856
Closed

ICE: reached the recursion limit finding the struct tail for #109304

matthiaskrgr opened this issue Mar 18, 2023 · 1 comment · Fixed by #109856
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

Could perhaps be an error instead of ice?

#![recursion_limit = "10"]
macro_rules! link {
    ($outer:ident, $inner:ident) => {
        struct $outer($inner);
        impl $outer {
            fn new() -> $outer {
                $outer($inner::new())
            }
        }
        impl std::ops::Deref for $outer {
            type Target = $inner;
            fn deref(&self) -> &$inner {
                &self.0
            }
        }
    };
}

struct Bottom;

impl Bottom {
    fn new() -> Bottom {
        Bottom
    }
}

link!(Top, A);
link!(A, B);
link!(B, C);
link!(C, D);
link!(D, E);
link!(E, F);
link!(F, G);
link!(G, H);
link!(H, I);
link!(I, J);
link!(J, K);
link!(K, Bottom);

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

warning: associated function `new` is never used
  --> treereduce.out:22:8
   |
22 |     fn new() -> Bottom {
   |        ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
27 | link!(Top, A);
   | ------------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
28 | link!(A, B);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
29 | link!(B, C);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
30 | link!(C, D);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
31 | link!(D, E);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
32 | link!(E, F);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
33 | link!(F, G);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
34 | link!(G, H);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
35 | link!(H, I);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
36 | link!(I, J);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
37 | link!(J, K);
   | ----------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `new` is never used
  --> treereduce.out:6:16
   |
6  |             fn new() -> $outer {
   |                ^^^
...
38 | link!(K, Bottom);
   | ---------------- in this macro invocation
   |
   = note: this warning originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info)
Backtrace


error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: reached the recursion limit finding the struct tail for Bottom
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
             3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
             4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
             6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
             8: rustc_hir_typeck::check::check_fn
             9: rustc_hir_typeck::typeck
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            11: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            12: rustc_hir_typeck::typeck_item_bodies
            13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            15: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            16: rustc_hir_analysis::check_crate
            17: rustc_interface::passes::analysis
            18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            20: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            21: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            22: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            23: 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_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            24: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
            25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            27: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
            28: <unknown>
            29: <unknown>


note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.70.0-nightly (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 13 warnings emitted

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 18, 2023
@langston-barrett
Copy link

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 19, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 21, 2023
@bors bors closed this as completed in 99a71dc Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants