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: broken MIR in DefId: index of non-array #118111

Closed
threadexio opened this issue Nov 20, 2023 · 3 comments · Fixed by #118112
Closed

ICE: broken MIR in DefId: index of non-array #118111

threadexio opened this issue Nov 20, 2023 · 3 comments · Fixed by #118112
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@threadexio
Copy link

Code

use core::ops::Index;

struct Map<T, F> {
    f: F,
    inner: T,
}

impl<T, F, Idx> Index<Idx> for Map<T, F>
where
    T: Index<Idx>,
    F: Fn(&T, Idx) -> Idx,
{
    type Output = T::Output;

    fn index(&self, index: Idx) -> &Self::Output {
        let index = (self.f)(&self.inner, index);
        self.inner.index(index)
    }
}

fn main() {
    let original = [0_usize, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    let transformed = Map {
        inner: original,
        f: |_, i: usize| original.len() - 1 - i,
    };

    let a = &original[0];
    let b = &transformed[0];
}

Meta

rustc --version --verbose:

rustc 1.74.0 (79e9716c9 2023-11-13)
binary: rustc
commit-hash: 79e9716c980570bfd1f666e3b16ac583f0168962
commit-date: 2023-11-13
host: x86_64-unknown-linux-gnu
release: 1.74.0
LLVM version: 17.0.4

Error output

thread 'rustc' panicked at compiler/rustc_middle/src/mir/tcx.rs:93:58:
called `Option::unwrap()` on a `None` value
stack backtrace:
// SNIP (BACKTRACE)

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

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.74.0 (79e9716c9 2023-11-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: expected fulfillment errors
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs:482:23
             0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
             3: <rustc_infer::infer::InferCtxt>::commit_if_ok::<(rustc_span::ErrorGuaranteed, rustc_middle::ty::Ty, rustc_middle::ty::Ty), rustc_middle::traits::query::NoSolution, <rustc_hir_typeck::fn_ctxt::FnCtxt>::find_and_report_unsatisfied_index_impl::{closure#1}>
             4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
             8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            10: rustc_hir_typeck::check::check_fn
            11: rustc_hir_typeck::typeck
            12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            13: <rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            15: rustc_query_impl::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
            16: rustc_data_structures::sync::parallel::disabled::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}>
            17: rustc_hir_analysis::check_crate
            18: rustc_interface::passes::analysis
            19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            20: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            22: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
            23: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            24: rustc_span::set_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}>
            25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_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>>
            26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_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}
            27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
            28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
            29: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
            30: start_thread
            31: __GI___clone3
          

error: internal compiler error: broken MIR in DefId(0:15 ~ testing[50aa]::main) (_2[_11]): index of non-array Map<[usize; 10_usize], Closure(DefId(0:16 ~ testing[50aa]::main::{closure#0}), [i8, Binder(extern "RustCall" fn((&'?9 [usize; 10_usize], usize)) -> usize, []), (&'?10 [usize; 10_usize],)])>
  --> src/main.rs:30:14
   |
30 |     let _b = &transformed[0];
   |              ^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:630:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_place
         3: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_body
         4: rustc_borrowck::type_check::type_check
         5: rustc_borrowck::nll::compute_regions
         6: rustc_borrowck::do_mir_borrowck
         7: rustc_borrowck::mir_borrowck
         8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         9: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
        10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        11: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
        12: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#1}>
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        17: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        18: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: rustc_span::set_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}>
        20: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_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>>
        21: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_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}
        22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        24: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
        25: start_thread
        26: __GI___clone3
  --> src/main.rs:30:14
   |
30 |     let _b = &transformed[0];
   |              ^^^^^^^^^^^^^^^

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:737:9
             0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_middle::ty::Ty>::new_misc_error
             3: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_place
             4: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_body
             5: rustc_borrowck::type_check::type_check
             6: rustc_borrowck::nll::compute_regions
             7: rustc_borrowck::do_mir_borrowck
             8: rustc_borrowck::mir_borrowck
             9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            10: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            12: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
            13: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#1}>
            14: rustc_interface::passes::analysis
            15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            16: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            18: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
            19: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            20: rustc_span::set_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}>
            21: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_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>>
            22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_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}
            23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
            24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
            25: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
            26: start_thread
            27: __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-compiler&template=ice.md

note: rustc 1.74.0 (79e9716c9 2023-11-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
thread 'rustc' panicked at library/core/src/panicking.rs:144:5:
panic in a destructor during cleanup

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

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.74.0 (79e9716c9 2023-11-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
thread caused non-unwinding panic. aborting.
Backtrace

   0:     0x7fcaf5d1433c - std::backtrace_rs::backtrace::libunwind::trace::h67a838aed1f4d6ec
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcaf5d1433c - std::backtrace_rs::backtrace::trace_unsynchronized::h1d1786bb1962baf8
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcaf5d1433c - std::sys_common::backtrace::_print_fmt::h5a0b1f807a002d23
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fcaf5d1433c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf84ab6ad0b91784c
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fcaf5d79f9c - core::fmt::rt::Argument::fmt::h28f463bd1fdabed5
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/rt.rs:138:9
   5:     0x7fcaf5d79f9c - core::fmt::write::ha37c23b175e921b3
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/mod.rs:1114:21
   6:     0x7fcaf5d070be - std::io::Write::write_fmt::haa1b000741bcbbe1
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/io/mod.rs:1763:15
   7:     0x7fcaf5d14124 - std::sys_common::backtrace::_print::h1ff1030b04dfb157
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fcaf5d14124 - std::sys_common::backtrace::print::hb982056c6f29541c
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fcaf5d17003 - std::panicking::default_hook::{{closure}}::h11f92f82c62fbd68
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:272:22
  10:     0x7fcaf5d16d24 - std::panicking::default_hook::hb8810fe276772c66
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:292:9
  11:     0x7fcaf8eff6ff - std[75110f2ce3cbb2c9]::panicking::update_hook::<alloc[e150e82988d12314]::boxed::Box<rustc_driver_impl[47b5c41fd5152b42]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fcaf5d17831 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h87b887549356728a
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2021:9
  13:     0x7fcaf5d17831 - std::panicking::rust_panic_with_hook::hd2f0efd2fec86cb0
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:735:13
  14:     0x7fcaf5d17566 - std::panicking::begin_panic_handler::{{closure}}::h3651b7fc4f61d784
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:601:13
  15:     0x7fcaf5d14866 - std::sys_common::backtrace::__rust_end_short_backtrace::hbc468e4b98c7ae04
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fcaf5d17302 - rust_begin_unwind
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
  17:     0x7fcaf5d76625 - core::panicking::panic_fmt::h979245e2fdb2fabd
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
  18:     0x7fcaf5d766c3 - core::panicking::panic::hcad0f3a89a1b36aa
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:127:5
  19:     0x7fcaf78c33ed - <rustc_middle[cfbee9f1a0b252f]::mir::syntax::Rvalue>::ty::<rustc_middle[cfbee9f1a0b252f]::mir::Body>
  20:     0x7fcaf78b340c - <rustc_borrowck[908b373b0898eafe]::type_check::TypeVerifier as rustc_middle[cfbee9f1a0b252f]::mir::visit::Visitor>::visit_body
  21:     0x7fcaf7823539 - rustc_borrowck[908b373b0898eafe]::type_check::type_check
  22:     0x7fcaf781a6ad - rustc_borrowck[908b373b0898eafe]::nll::compute_regions
  23:     0x7fcaf77ff4ec - rustc_borrowck[908b373b0898eafe]::do_mir_borrowck
  24:     0x7fcaf77fd8b3 - rustc_borrowck[908b373b0898eafe]::mir_borrowck
  25:     0x7fcaf706ba3e - rustc_query_impl[252fba113696aa73]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[252fba113696aa73]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfbee9f1a0b252f]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7fcaf706ba0e - <rustc_query_impl[252fba113696aa73]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[5a612027cd243909]::ops::function::FnOnce<(rustc_middle[cfbee9f1a0b252f]::ty::context::TyCtxt, rustc_span[56b754c3614a230e]::def_id::LocalDefId)>>::call_once
  27:     0x7fcaf76a2480 - rustc_query_system[835e2ed124ae29cf]::query::plumbing::try_execute_query::<rustc_query_impl[252fba113696aa73]::DynamicConfig<rustc_query_system[835e2ed124ae29cf]::query::caches::VecCache<rustc_span[56b754c3614a230e]::def_id::LocalDefId, rustc_middle[cfbee9f1a0b252f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[252fba113696aa73]::plumbing::QueryCtxt, true>
  28:     0x7fcaf884bec8 - rustc_query_impl[252fba113696aa73]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  29:     0x7fcaf840f39e - <rustc_session[b7494ff286ba0941]::session::Session>::time::<(), rustc_interface[dac25a6ec31f00eb]::passes::analysis::{closure#1}>
  30:     0x7fcaf840d994 - rustc_interface[dac25a6ec31f00eb]::passes::analysis
  31:     0x7fcaf83df3ea - rustc_query_impl[252fba113696aa73]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[252fba113696aa73]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cfbee9f1a0b252f]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7fcaf83df3d9 - <rustc_query_impl[252fba113696aa73]::query_impl::analysis::dynamic_query::{closure#2} as core[5a612027cd243909]::ops::function::FnOnce<(rustc_middle[cfbee9f1a0b252f]::ty::context::TyCtxt, ())>>::call_once
  33:     0x7fcaf86c24d9 - rustc_query_system[835e2ed124ae29cf]::query::plumbing::try_execute_query::<rustc_query_impl[252fba113696aa73]::DynamicConfig<rustc_query_system[835e2ed124ae29cf]::query::caches::SingleCache<rustc_middle[cfbee9f1a0b252f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[252fba113696aa73]::plumbing::QueryCtxt, true>
  34:     0x7fcaf86c2032 - rustc_query_impl[252fba113696aa73]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  35:     0x7fcaf808f632 - <rustc_middle[cfbee9f1a0b252f]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[47b5c41fd5152b42]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>>
  36:     0x7fcaf808e0b1 - rustc_span[56b754c3614a230e]::set_source_map::<core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>, rustc_interface[dac25a6ec31f00eb]::interface::run_compiler<core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>, rustc_driver_impl[47b5c41fd5152b42]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  37:     0x7fcaf8088c90 - std[75110f2ce3cbb2c9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dac25a6ec31f00eb]::util::run_in_thread_with_globals<rustc_interface[dac25a6ec31f00eb]::interface::run_compiler<core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>, rustc_driver_impl[47b5c41fd5152b42]::run_compiler::{closure#1}>::{closure#0}, core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>>
  38:     0x7fcaf87509ee - <<std[75110f2ce3cbb2c9]::thread::Builder>::spawn_unchecked_<rustc_interface[dac25a6ec31f00eb]::util::run_in_thread_with_globals<rustc_interface[dac25a6ec31f00eb]::interface::run_compiler<core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>, rustc_driver_impl[47b5c41fd5152b42]::run_compiler::{closure#1}>::{closure#0}, core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a612027cd243909]::result::Result<(), rustc_span[56b754c3614a230e]::ErrorGuaranteed>>::{closure#1} as core[5a612027cd243909]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7fcaf5d22395 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa37c25e0ad051b0
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
  40:     0x7fcaf5d22395 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9486bed8ab2e65ad
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
  41:     0x7fcaf5d22395 - std::sys::unix::thread::Thread::new::thread_start::hd28b46dbf5673d17
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7fcaf5abb084 - start_thread
  43:     0x7fcaf5b3d55c - __GI___clone3
  44:                0x0 - <unknown>

@threadexio threadexio added C-bug Category: This is a bug. 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. labels Nov 20, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 20, 2023
@matthiaskrgr matthiaskrgr added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Nov 20, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 20, 2023
@matthiaskrgr
Copy link
Member

Regression in nightly-2023-04-20

commit[0] 2023-04-18: Auto merge of #109772 - petrochenkov:slimchild, r=cjgillot
commit[1] 2023-04-18: Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillot
commit[2] 2023-04-19: Auto merge of #110229 - jyn514:download-rustc-tests, r=albertlarsan68
commit[3] 2023-04-19: Auto merge of #110477 - miguelraz:canoodling2-electric-boogaloo, r=compiler-errors
commit[4] 2023-04-19: Auto merge of #110522 - matthiaskrgr:rollup-9m7rw3u, r=matthiaskrgr
commit[5] 2023-04-19: Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwco
commit[6] 2023-04-19: Auto merge of #110393 - fee1-dead-contrib:rm-const-traits, r=oli-obk
commit[7] 2023-04-19: Auto merge of #110496 - WaffleLapkin:🏳️‍⚧️sound, r=compiler-errors
commit[8] 2023-04-19: Auto merge of #110546 - matthiaskrgr:rollup-346kik6, r=matthiaskrgr
commit[9] 2023-04-19: Auto merge of #106704 - ecnelises:big_archive, r=bjorn3
ERROR: no CI builds available between c609da5 and 39c6804 within last 167 days

@matthiaskrgr
Copy link
Member

Oh this might be #110432 contained in the first rollup ping @compiler-errors

reduced a bit:

use core::ops::Index;

struct Map<T, F> {
    f: F,
    inner: T,
}

impl<T, F, Idx> Index<Idx> for Map<T, F>
where
    T: Index<Idx>,
    F: Fn(&T, Idx) -> Idx,
{
    type Output = T::Output;

    fn index(&self, index: Idx) -> &Self::Output {
        self.inner.index(index)
    }
}

fn main() {
    Map {
        inner: [0_usize],
        f: |_, i: usize| 1_usize,
    }[0];
}

@compiler-errors compiler-errors self-assigned this Nov 20, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 21, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Nov 21, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 21, 2023
…e, r=aliemjay

Don't ICE when ambiguity is found when selecting `Index` implementation in typeck

Fixes rust-lang#118111

The problem here is when we're manually "selecting" an impl for `base_ty: Index<?0>`, we don't consider placeholder region errors (leak check) or ambiguous predicates. Those can lead to us not actually emitting any fulfillment errors on line 3131.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 21, 2023
…e, r=aliemjay

Don't ICE when ambiguity is found when selecting `Index` implementation in typeck

Fixes rust-lang#118111

The problem here is when we're manually "selecting" an impl for `base_ty: Index<?0>`, we don't consider placeholder region errors (leak check) or ambiguous predicates. Those can lead to us not actually emitting any fulfillment errors on line 3131.
@bors bors closed this as completed in 802f71b Nov 22, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 22, 2023
Rollup merge of rust-lang#118112 - compiler-errors:index-ambiguity-ice, r=aliemjay

Don't ICE when ambiguity is found when selecting `Index` implementation in typeck

Fixes rust-lang#118111

The problem here is when we're manually "selecting" an impl for `base_ty: Index<?0>`, we don't consider placeholder region errors (leak check) or ambiguous predicates. Those can lead to us not actually emitting any fulfillment errors on line 3131.
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

6 participants