Skip to content

[rustc panic:ed] associated constant  #48081

Closed
@niklasad1

Description

@niklasad1

Summary

I tried the following snippet:

                self.dest.map_or_else(
                    || {
                        debug!("Called write_block() with no data");
                        false
                    },
                    |dest| {
                        let index = self.write_index.get();
                        let more = index + AES128::BLOCK_SIZE <= self.stop_index.get();
                        if !more {
                            return false;
                        }
                        let regs: &mut AesRegisters = unsafe { mem::transmute(self.registers) };
                        for i in 0..4 {
                            let mut v = dest[index + (i * 4) + 0] as usize;
                            v |= (dest[index + (i * 4) + 1] as usize) << 8;
                            v |= (dest[index + (i * 4) + 2] as usize) << 16;
                            v |= (dest[index + (i * 4) + 3] as usize) << 24;
                            regs.idata.set(v as u32);
                        }
                        self.write_index.set(index + AES128::BLOCK_SIZE);

                        let more =
                            self.write_index.get() + AES128::BLOCK_SIZE <= self.stop_index.get();
                        more
                    },
                )

Expected

Not a compiler crash

Outcome

error[E0283]: type annotations required: cannot resolve `_: kernel::hil::symmetric_encryption::AES128<'_>`
   --> /home/niklasad1/tock/chips/sam4l/src/aes.rs:211:44
    |
211 |                         let more = index + AES128::BLOCK_SIZE <= self.stop_index.get();
    |                                            ^^^^^^^^^^^^^^^^^^
    |
    = note: required by `kernel::hil::symmetric_encryption::AES128::BLOCK_SIZE`

error: internal compiler error: /checkout/src/librustc/traits/trans/mod.rs:62: Encountered ambiguity selecting `Binder(<[type error] as kernel::hil::symmetric_encryption::AES128>)` during trans, presuming due to overflow

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.24.0-nightly (8e7a609e6 2018-01-04) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:504:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Backtrace

stack backtrace:
   0:     0x7fa41ef5bbfb - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h91d1666c6327d52b
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7fa41ef6a7be - std::sys_common::backtrace::print::h66e8f3310af6a54c
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
   2:     0x7fa41ef47680 - std::panicking::default_hook::{{closure}}::h7a402dd600c5b3cc
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7fa41ef47143 - std::panicking::default_hook::hc7cfa94336f822ac
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7fa41ef47acb - std::panicking::rust_panic_with_hook::h7bb2af2582fdefca
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7fa4198f0d47 - std::panicking::begin_panic::h050149da9cc7f772
   6:     0x7fa41990b681 - rustc_errors::Handler::bug::hfa625afa9f723db3
   7:     0x7fa41acd9eff - <std::thread::local::LocalKey<T>>::with::h543ce26cfb6f50bf
   8:     0x7fa41b0c864e - rustc::ty::context::tls::with_opt::h6878b003f8522a9e
   9:     0x7fa41ac0abd7 - rustc::session::opt_span_bug_fmt::hc8994976b9fd9c44
  10:     0x7fa41ac0aae6 - rustc::session::bug_fmt::ha9ee1b22a61f2e60
  11:     0x7fa41ace3ff4 - <std::thread::local::LocalKey<T>>::with::hc56362f2e196171c
  12:     0x7fa41aacf9f8 - rustc::ty::context::GlobalCtxt::enter_local::ha46ec5fc488a532a
  13:     0x7fa41b0711d7 - rustc::traits::trans::trans_fulfill_obligation::h36d04a4b73b138da
  14:     0x7fa41af73551 - rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fulfill_obligation<'tcx>>::compute_result::h3a5709afd05411f6
  15:     0x7fa41aeaa80b - rustc::dep_graph::graph::DepGraph::with_task_impl::h3594064c92f10ee3
  16:     0x7fa41ab94e1f - rustc_errors::Handler::track_diagnostics::h212e44cb9f6613a7
  17:     0x7fa41aab7a40 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hdb86a4c730046d0c
  18:     0x7fa41af735f4 - rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fulfill_obligation<'tcx>>::force::h280621a9d1094134
  19:     0x7fa41af74178 - rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fulfill_obligation<'tcx>>::try_get::h36d73c6793bed8fd
  20:     0x7fa41ad78d88 - rustc::ty::maps::TyCtxtAt::trans_fulfill_obligation::h3b01c51eba8ba696
  21:     0x7fa41af1456f - rustc::ty::instance::Instance::resolve::ha42785737c9d07b1
  22:     0x7fa41b8a0bf5 - rustc_const_eval::eval::lookup_const_by_id::h235481ee0dad229a
  23:     0x7fa41be46fae - rustc_mir::interpret::const_eval::const_eval_provider::he61ff6eb78749b4c
  24:     0x7fa41af52911 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::compute_result::hd372dc799ddc81ba
  25:     0x7fa41aebdedb - rustc::dep_graph::graph::DepGraph::with_task_impl::h7d18d69d2b29c6ea
  26:     0x7fa41abaf2cf - rustc_errors::Handler::track_diagnostics::ha705e0db47c7e786
  27:     0x7fa41aabe750 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hf369de754f658497
  28:     0x7fa41af529ab - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::force::hfe662e34cd1da2c1
  29:     0x7fa41af534c5 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get::h6b701d0550a2baf8
  30:     0x7fa41ad77858 - rustc::ty::maps::TyCtxtAt::const_eval::h55d029a49f1964dd
  31:     0x7fa41b8a209b - rustc_const_eval::eval::eval_const_expr_partial::hba9bae625532d936
  32:     0x7fa41b8a0c9b - rustc_const_eval::eval::ConstContext::eval::h88555953a4be0435
  33:     0x7fa41be4725d - rustc_mir::interpret::const_eval::const_eval_provider::he61ff6eb78749b4c
  34:     0x7fa41af52911 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::compute_result::hd372dc799ddc81ba
  35:     0x7fa41aebdedb - rustc::dep_graph::graph::DepGraph::with_task_impl::h7d18d69d2b29c6ea
  36:     0x7fa41abaf2cf - rustc_errors::Handler::track_diagnostics::ha705e0db47c7e786
  37:     0x7fa41aabe750 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hf369de754f658497
  38:     0x7fa41af529ab - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::force::hfe662e34cd1da2c1
  39:     0x7fa41af534c5 - rustc::ty::maps::<impl rustc::ty::maps::queries::const_eval<'tcx>>::try_get::h6b701d0550a2baf8
  40:     0x7fa41ad77858 - rustc::ty::maps::TyCtxtAt::const_eval::h55d029a49f1964dd
  41:     0x7fa41af016f2 - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_const::h367c7dcc2822faf4
  42:     0x7fa41ac35469 - rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with::hbbcbd16bc6f9410d
  43:     0x7fa41af00d79 - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty::he448e45aef860a24
  44:     0x7fa41d55af9f - rustc::traits::project::normalize::h1a189fdb64aef9cc
  45:     0x7fa41d468e2c - rustc::infer::InferCtxt::partially_normalize_associated_types_in::h66d802a5e340389e
  46:     0x7fa41d4b8f5a - <std::thread::local::LocalKey<T>>::with::h15b2117ec1c7d041
  47:     0x7fa41d45df74 - rustc::infer::InferCtxtBuilder::enter::hd970daac5fcaeb5c
  48:     0x7fa41d4d633c - rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor::check_item_type::h7c821f3c0df87f83
  49:     0x7fa41d4d7fec - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_item::h9ec08c5b3cd06f28
  50:     0x7fa41d5aa6bc - rustc::hir::Crate::visit_all_item_likes::h2ee6e7a157d04a3b
  51:     0x7fa41d5327e7 - rustc::session::Session::track_errors::h1f6a33d2e50a3c3c
  52:     0x7fa41d5803b5 - rustc_typeck::check_crate::hb09122b4ee79ea95
  53:     0x7fa41f389717 - <std::thread::local::LocalKey<T>>::with::hc6fb6087df81e9d2
  54:     0x7fa41f3871d6 - <std::thread::local::LocalKey<T>>::with::h836036c2a71f0071
  55:     0x7fa41f3de607 - rustc::ty::context::TyCtxt::create_and_enter::hb73d12258cf88a3c
  56:     0x7fa41f33ef3a - rustc_driver::driver::compile_input::h9deb377f84422e28
  57:     0x7fa41f3b4500 - rustc_driver::run_compiler::h7957e266f41bd133
  58:     0x7fa41f2f9af1 - std::sys_common::backtrace::__rust_begin_short_backtrace::hca871f110f764e5c
  59:     0x7fa41ef933ae - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  60:     0x7fa41f2d8972 - <F as alloc::boxed::FnBox<A>>::call_box::h21ccf4de9d93f71f
  61:     0x7fa41ef6d087 - std::sys_common::thread::start_thread::h95c8df0df264c758
                               at /checkout/src/liballoc/boxed.rs:827
                               at /checkout/src/libstd/sys_common/thread.rs:24
  62:     0x7fa41ef71498 - std::sys::unix::thread::Thread::new::thread_start::hc1ac9245a2c79957
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  63:     0x7fa418e357fb - start_thread
  64:     0x7fa41ec31b5e - clone
  65:                0x0 - <unknown>

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions