rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.37k stars 12.29k forks source link

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

Closed threadexio closed 8 months ago

threadexio commented 8 months ago

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 - ::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::>::{closure#0} 12: 0x7fcaf5d17831 - as core::ops::function::Fn>::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 - ::ty:: 20: 0x7fcaf78b340c - ::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::> 26: 0x7fcaf706ba0e - >::call_once 27: 0x7fcaf76a2480 - rustc_query_system[835e2ed124ae29cf]::query::plumbing::try_execute_query::>, 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 - ::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::> 32: 0x7fcaf83df3d9 - >::call_once 33: 0x7fcaf86c24d9 - rustc_query_system[835e2ed124ae29cf]::query::plumbing::try_execute_query::>, 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 - ::enter::> 36: 0x7fcaf808e0b1 - rustc_span[56b754c3614a230e]::set_source_map::, rustc_interface[dac25a6ec31f00eb]::interface::run_compiler, rustc_driver_impl[47b5c41fd5152b42]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 37: 0x7fcaf8088c90 - std[75110f2ce3cbb2c9]::sys_common::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::hfa37c25e0ad051b0 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9 40: 0x7fcaf5d22395 - as core::ops::function::FnOnce>::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 - ```

matthiaskrgr commented 8 months ago

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 c609da59d9fc05b1c7dc879d79700ccd8140b5fc and 39c6804b92aa202369e402525cee329556bc1db0 within last 167 days

matthiaskrgr commented 8 months ago

Oh this might be https://github.com/rust-lang/rust/pull/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];
}
apiraino commented 8 months ago

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium