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

[Panic]: None / expected fulfillment errors #336

Open
matthiaskrgr opened this issue Dec 17, 2023 · 0 comments
Open

[Panic]: None / expected fulfillment errors #336

matthiaskrgr opened this issue Dec 17, 2023 · 0 comments
Labels
C-bug Category: Something isn't working I-panic Issue: Some part of the linter panicked unexpectedly

Comments

@matthiaskrgr
Copy link

Summary

No response

Reproducer

use std::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: FnOnce(&T, Idx) -> Idx,
{
    type Output = T::Output;

    fn index(&self, index: Idx) -> &Self::Output {
        todo!()
    }
}

fn main() {
    Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0];
    //~^ ERROR cannot index into a value of type
    // Problem here is that
    //   `f: |_, i: usize| ...`
    // should be
    //   `f: |_: &_, i: usize| ...`
}

Version

No response

Logs and Backtrace

MARKER_ERROR_TRACE=1 MARKER_LOG=info RUST_BACKTRACE=1    LD_LIBRARY_PATH='/home/matthias/o/target/debug/deps:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib'  RUSTC_WORKSPACE_WRAPPER=/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver MARKER_LINT_CRATES=marker_lints:/home/matthias/o/target/marker/lints/libmarker_lints.so   RUSTUP_TOOLCHAIN=nightly-2023-11-16    /home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver /home/matthias/vcs/github/rust_misc_stuff/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.rs
warning: unused variable: `index`
  --> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.rs:17:21
   |
17 |     fn index(&self, index: Idx) -> &Self::Output {
   |                     ^^^^^ help: if this is intentional, prefix it with an underscore: `_index`
   |
   = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at compiler/rustc_middle/src/mir/tcx.rs:93:58:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:127:5
   3: <rustc_middle::mir::tcx::PlaceTy>::projection_ty.cold.0
   4: <rustc_mir_build::build::Builder>::expr_into_dest
   5: <rustc_mir_build::build::Builder>::as_temp::{closure#0}
   6: <rustc_mir_build::build::Builder>::stmt_expr
   7: <rustc_mir_build::build::Builder>::stmt_expr
   8: <rustc_mir_build::build::Builder>::ast_block_stmts
   9: <rustc_mir_build::build::Builder>::expr_into_dest
  10: <rustc_mir_build::build::Builder>::expr_into_dest
  11: <rustc_mir_build::build::Builder>::expr_into_dest
  12: rustc_mir_build::build::mir_build::{closure#0}
  13: rustc_mir_build::build::mir_built
      [... omitted 1 frame ...]
  14: rustc_mir_transform::check_unsafety::unsafety_check_result
      [... omitted 1 frame ...]
  15: rustc_mir_transform::mir_const
      [... omitted 1 frame ...]
  16: rustc_mir_transform::mir_promoted
      [... omitted 1 frame ...]
  17: rustc_borrowck::mir_borrowck
      [... omitted 1 frame ...]
  18: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  19: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-marker/marker/issues/new?template=panic.yml

note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_53_56-1811904.txt` to your bug report

query stack during panic:
#0 [mir_built] building MIR for `main`
#1 [unsafety_check_result] unsafety-checking `main`
#2 [mir_const] preparing `main` for borrow checking
#3 [mir_promoted] promoting constants in MIR for `main`
#4 [mir_borrowck] borrow-checking `main`
#5 [analysis] running analysis passes on this crate
end of query stack
note: marker_rustc_driver 0.4.3

note: Achievement Unlocked: [Free Ice Cream]

warning: unused variable: `i`
  --> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.rs:23:36
   |
23 |     Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0];
   |                                    ^ help: if this is intentional, prefix it with an underscore: `_i`

warning: 2 warnings emitted

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/type_err_ctxt_ext.rs:215: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::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
             3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_index
             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::check::check_fn
             8: rustc_hir_typeck::typeck
             9: 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]>>
            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, false>
            11: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
            12: rustc_hir_analysis::check_crate
            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_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>
            16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
            18: 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>, rustc_driver_impl::run_compiler::{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>>
            19: <<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#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}
            20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/alloc/src/boxed.rs:2007:9
            21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/alloc/src/boxed.rs:2007:9
            22: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/std/src/sys/unix/thread.rs:108:17
            23: <unknown>
            24: <unknown>


note: we would appreciate a bug report: https://github.com/rust-marker/marker/issues/new?template=panic.yml

note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_53_56-1811904.txt` to your bug report

query stack during panic:
end of query stack
note: marker_rustc_driver 0.4.3

note: Achievement Unlocked: [Free Ice Cream]

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-marker/marker/issues/new?template=panic.yml

note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_53_56-1811904.txt` to your bug report

query stack during panic:
end of query stack
note: marker_rustc_driver 0.4.3

note: Achievement Unlocked: [Free Ice Cream]

thread caused non-unwinding panic. aborting.
[1]    1811904 IOT instruction  MARKER_ERROR_TRACE=1 MARKER_LOG=info RUST_BACKTRACE=1 LD_LIBRARY_PATH= = = =
@matthiaskrgr matthiaskrgr added C-bug Category: Something isn't working I-panic Issue: Some part of the linter panicked unexpectedly S-needs-triage Status: This issue needs triage labels Dec 17, 2023
@xFrednet xFrednet removed the S-needs-triage Status: This issue needs triage label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Something isn't working I-panic Issue: Some part of the linter panicked unexpectedly
Projects
None yet
Development

No branches or pull requests

2 participants