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]: explicit index of non-indexable type #132692

Closed
1 of 4 tasks
wxie7 opened this issue Nov 6, 2024 · 6 comments
Closed
1 of 4 tasks

[ICE]: explicit index of non-indexable type #132692

wxie7 opened this issue Nov 6, 2024 · 6 comments
Labels
C-bug Category: This is a bug. F-deref_patterns `#![feature(deref_patterns)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wxie7
Copy link

wxie7 commented Nov 6, 2024

Code

#![feature(deref_patterns)]
#![allow(incomplete_features)]
fn simple_vec(deref_patterns: Vec<u32>) -> u32 {
    (|| match Vec::<u32>::new() {
        deref!([]) => 100,
        _ => 2000,
    })()
}
fn main() {}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.84.0-nightly (bc5cf99 2024-11-05)
binary: rustc
commit-hash: bc5cf99
commit-date: 2024-11-05
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Current error output

No response

Backtrace

     0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
     1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
     2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
     3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
     4: <&rustc_hir_typeck::fn_ctxt::FnCtxt as rustc_hir_typeck::expr_use_visitor::TypeInformationCtxt>::report_error::<&str>
     5: <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::cat_pattern::<<rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::maybe_read_scrutinee<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_hir::hir::Arm>, <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::walk_expr::{closure#1}>>::{closure#0}>
     6: <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::cat_pattern::<<rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::maybe_read_scrutinee<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_hir::hir::Arm>, <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::walk_expr::{closure#1}>>::{closure#0}>
     7: <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::walk_expr
     8: <rustc_hir_typeck::expr_use_visitor::ExprUseVisitor<&rustc_hir_typeck::fn_ctxt::FnCtxt, &mut rustc_hir_typeck::upvar::InferBorrowKind>>::consume_expr
     9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::analyze_closure
    10: <rustc_hir_typeck::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
    11: <rustc_hir_typeck::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
    12: rustc_hir_typeck::typeck
    13: 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]>>
    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, false>
    15: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
    16: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#4}>::{closure#0}
    17: rustc_hir_analysis::check_crate
    18: rustc_interface::passes::run_required_analyses
    19: rustc_interface::passes::analysis
    20: 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]>>
    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, false>
    22: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    23: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    24: std::sys::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>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
    25: <<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>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, 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}
    26: std::sys::pal::unix::thread::Thread::new::thread_start
    27: start_thread
               at ./nptl/pthread_create.c:442:8
    28: __GI___clone3
               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Anything else?

note: compiler flags: --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3

@wxie7 wxie7 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 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 6, 2024
@fmease fmease added requires-incomplete-features This issue requires the use of incomplete features. F-deref_patterns `#![feature(deref_patterns)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 6, 2024
@fmease
Copy link
Member

fmease commented Nov 6, 2024

Duplicate of #125059

@fmease fmease marked this as a duplicate of #125059 Nov 6, 2024
@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
@fmease
Copy link
Member

fmease commented Nov 6, 2024

Thanks for your report. In the future could you also fill out the section Current error output, not just the backtrace? With that I mean everything before the backtrace like

XXX XXX XXX XXX XXX XXX

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: XXX XXX XXX XXX XXXX

Lastly, in the future could you add the part that says note: delayed at XXX/XXX/XXX:XXX:XXX to the backtrace?

@wxie7
Copy link
Author

wxie7 commented Nov 6, 2024

Understood, I'll include that next time.

@Noratrieb
Copy link
Member

@wxie7 see https://rustc-dev-guide.rust-lang.org/fuzzing.html

Don't seed your fuzzer with inputs that are known

it looks like your fuzzer might have been deeded by files in tests/crashes. don't do this, as these files are known to crash rustc

@wxie7
Copy link
Author

wxie7 commented Nov 7, 2024

@Noratrieb By the way, does an ICE have a unified identifier (besides the ICE report)? In some standard errors, it's 'thread ‘rustc’ panicked', while in others it's 'internal compiler error'.

@Noratrieb
Copy link
Member

it's a bit of a mess, no. these two strings should be enough

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. F-deref_patterns `#![feature(deref_patterns)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants