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

'rustc' panicked at 'index out of bounds: the len is 385 but the index is 386' #103343

Closed
kaweston opened this issue Oct 21, 2022 · 3 comments
Closed
Labels
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.

Comments

@kaweston
Copy link

Code

I don't have an example yet; I'm pretty new to Rust. Given the output indicates that the entry_points::apigateway::create_token_set function is being type checked hopefully the following code snippets will be of assistance.

I do have another code base that I largely borrowed from where the signature is nearly the same other than the parameter being passed as &dyn (&dyn StorageService) now has an implementation that contains a Box (see code below).

use lambda_http::{http::StatusCode, IntoResponse, Request, RequestExt, Response};
use crate::clients::function::StorageService;

type E = Box<dyn std::error::Error + Send + Sync + 'static>;

pub async fn create_token_set(storage_service_client: &dyn StorageService,
                              request: Request) -> Result<impl IntoResponse, E> {
...
}

#[async_trait]
pub trait StorageService: Send + Sync {

    async fn store(&self, data: &PreAuthData) -> Result<TokenResult, Error>;

}
// is implemented by
pub struct StorageServiceClient {
    http_client: Client,
    service_discovery_client: Box<dyn ServiceDiscovery>
}


#[async_trait]
pub trait ServiceDiscovery: Send + Sync {
    async fn instances(&self, service_name: &str) -> Result<ServiceInstances, Error>;
}
// is implemented by
pub struct CloudMapClient {
    pub client: Client,
    pub namespace: String,
}


#[derive(Debug, Serialize)]
pub struct PreAuthData {
    #[serde(rename="ttlSeconds")]
    pub ttl_seconds: u64,
    pub data: HashMap<String, String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct TokenResult {
    pub token: String,
}

Meta

rustc --version --verbose:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6

Error output

RUST_BACKTRACE=full	 cargo lambda build --release --target aarch64-unknown-linux-gnu
   Compiling synchronizer-service v0.1.0 (/Users/kweston/Development/Work/passion_project/synchronizer-service)
thread 'rustc' panicked at 'index out of bounds: the len is 385 but the index is 386', /Users/runner/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
Backtrace

stack backtrace:
   0:        0x10e28f5c4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7d80e14dd19335c9
   1:        0x10e2e768b - core::fmt::write::h1709d0255080e28a
   2:        0x10e281fe8 - std::io::Write::write_fmt::hecc56b5639d319e7
   3:        0x10e29289d - std::panicking::default_hook::{{closure}}::had4d1cd22a173020
   4:        0x10e2925ee - std::panicking::default_hook::h42aa124509888735
   5:        0x11acdb73a - rustc_driver[b232a614d5c482d6]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x10e292f0b - std::panicking::rust_panic_with_hook::h2b231e816574a23a
   7:        0x10e292d83 - std::panicking::begin_panic_handler::{{closure}}::h9da8d88b7a4c9d5e
   8:        0x10e28fa47 - std::sys_common::backtrace::__rust_end_short_backtrace::h10dbf1377dfaf877
   9:        0x10e292a5a - _rust_begin_unwind
  10:        0x10e312943 - core::panicking::panic_fmt::hde1544b10dc8b4d3
  11:        0x10e312896 - core::panicking::panic_bounds_check::h094d1d5f121a5074
  12:        0x11f11a7dd - <rustc_infer[daf5aaa74dbe2ea7]::infer::type_variable::TypeVariableTable>::probe
  13:        0x11f09223c - <rustc_infer[daf5aaa74dbe2ea7]::infer::ShallowResolver as rustc_middle[77b05d97adc105c3]::ty::fold::TypeFolder>::fold_ty
  14:        0x11f14275f - <rustc_middle[77b05d97adc105c3]::ty::Ty as rustc_middle[77b05d97adc105c3]::ty::fold::TypeSuperFoldable>::super_fold_with::<rustc_infer[daf5aaa74dbe2ea7]::infer::resolve::OpportunisticVarResolver>
  15:        0x11f08abbb - <rustc_infer[daf5aaa74dbe2ea7]::infer::InferCtxt>::same_type_modulo_infer
  16:        0x11f09567a - <rustc_infer[daf5aaa74dbe2ea7]::infer::InferCtxt>::note_type_err
  17:        0x11f086eba - <rustc_infer[daf5aaa74dbe2ea7]::infer::InferCtxt>::report_and_explain_type_error
  18:        0x11d748b7e - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::report_arg_errors
  19:        0x11d744d3e - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_argument_types
  20:        0x11d720195 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  21:        0x11d71d72f - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_call
  22:        0x11d78233b - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  23:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:        0x11d77c1ed - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_match
  25:        0x11d782300 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  26:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:        0x11d74b0e8 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  28:        0x11d782764 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  29:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:        0x11d781c1c - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  31:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:        0x11d74b0e8 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  33:        0x11d782764 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  34:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:        0x11d735027 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_return_expr
  36:        0x11d802eb0 - rustc_typeck[bd9bb7cc16f9c2e5]::check::check::check_fn
  37:        0x11d77ee85 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_closure
  38:        0x11d781a30 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  39:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40:        0x11d743fb5 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_argument_types
  41:        0x11d720195 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  42:        0x11d71d72f - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_call
  43:        0x11d78233b - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_kind
  44:        0x11d733ead - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  45:        0x11d735027 - <rustc_typeck[bd9bb7cc16f9c2e5]::check::fn_ctxt::FnCtxt>::check_return_expr
  46:        0x11d802eb0 - rustc_typeck[bd9bb7cc16f9c2e5]::check::check::check_fn
  47:        0x11d9411da - <rustc_infer[daf5aaa74dbe2ea7]::infer::InferCtxtBuilder>::enter::<&rustc_middle[77b05d97adc105c3]::ty::context::TypeckResults, <rustc_typeck[bd9bb7cc16f9c2e5]::check::inherited::InheritedBuilder>::enter<rustc_typeck[bd9bb7cc16f9c2e5]::check::typeck_with_fallback<rustc_typeck[bd9bb7cc16f9c2e5]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[77b05d97adc105c3]::ty::context::TypeckResults>::{closure#0}>
  48:        0x11d8dfec6 - rustc_typeck[bd9bb7cc16f9c2e5]::check::typeck
  49:        0x11e3254d5 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_span[dadb10719d06531]::def_id::LocalDefId, &rustc_middle[77b05d97adc105c3]::ty::context::TypeckResults>>
  50:        0x11e41d23e - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::typeck, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  51:        0x11f212849 - <rustc_middle[77b05d97adc105c3]::ty::context::TyCtxt>::typeck_opt_const_arg
  52:        0x11dc87e79 - rustc_mir_build[56ad5059c19cf785]::build::mir_built
  53:        0x11e304518 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_middle[77b05d97adc105c3]::ty::WithOptConstParam<rustc_span[dadb10719d06531]::def_id::LocalDefId>, &rustc_data_structures[9d9aca487cd3f5bb]::steal::Steal<rustc_middle[77b05d97adc105c3]::mir::Body>>>
  54:        0x11e41fa0e - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::mir_built, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  55:        0x11e6c3e07 - <rustc_query_impl[1fb0f992e528a50]::Queries as rustc_middle[77b05d97adc105c3]::ty::query::QueryEngine>::mir_built
  56:        0x11d4ce982 - rustc_mir_transform[ff588deea2a29d33]::check_unsafety::unsafety_check_result
  57:        0x11d4c9933 - <rustc_mir_transform[ff588deea2a29d33]::check_unsafety::provide::{closure#0} as core[ccfd6f2964525339]::ops::function::FnOnce<(rustc_middle[77b05d97adc105c3]::ty::context::TyCtxt, rustc_span[dadb10719d06531]::def_id::LocalDefId)>>::call_once
  58:        0x11e327255 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_span[dadb10719d06531]::def_id::LocalDefId, &rustc_middle[77b05d97adc105c3]::mir::query::UnsafetyCheckResult>>
  59:        0x11e402d0e - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::unsafety_check_result, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  60:        0x11d3ab51c - rustc_mir_transform[ff588deea2a29d33]::mir_const
  61:        0x11e304518 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_middle[77b05d97adc105c3]::ty::WithOptConstParam<rustc_span[dadb10719d06531]::def_id::LocalDefId>, &rustc_data_structures[9d9aca487cd3f5bb]::steal::Steal<rustc_middle[77b05d97adc105c3]::mir::Body>>>
  62:        0x11e41fb4b - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::mir_const, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  63:        0x11e6c3e37 - <rustc_query_impl[1fb0f992e528a50]::Queries as rustc_middle[77b05d97adc105c3]::ty::query::QueryEngine>::mir_const
  64:        0x11d3ac072 - rustc_mir_transform[ff588deea2a29d33]::mir_promoted
  65:        0x11e3e5734 - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::mir_promoted, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  66:        0x11e6c3fb7 - <rustc_query_impl[1fb0f992e528a50]::Queries as rustc_middle[77b05d97adc105c3]::ty::query::QueryEngine>::mir_promoted
  67:        0x11dee43ac - rustc_borrowck[2325aa70b5af3c05]::mir_borrowck
  68:        0x11deb9893 - <rustc_borrowck[2325aa70b5af3c05]::provide::{closure#0} as core[ccfd6f2964525339]::ops::function::FnOnce<(rustc_middle[77b05d97adc105c3]::ty::context::TyCtxt, rustc_span[dadb10719d06531]::def_id::LocalDefId)>>::call_once
  69:        0x11e326395 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_span[dadb10719d06531]::def_id::LocalDefId, &rustc_middle[77b05d97adc105c3]::mir::query::BorrowCheckResult>>
  70:        0x11e3e50b3 - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::mir_borrowck, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  71:        0x11d98ba02 - rustc_typeck[bd9bb7cc16f9c2e5]::collect::type_of::find_opaque_ty_constraints_for_rpit
  72:        0x11d98ac3c - rustc_typeck[bd9bb7cc16f9c2e5]::collect::type_of::type_of
  73:        0x11e33ed83 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_span[dadb10719d06531]::def_id::DefId, rustc_middle[77b05d97adc105c3]::ty::Ty>>
  74:        0x11e41d500 - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::type_of, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  75:        0x11d7eda7f - rustc_typeck[bd9bb7cc16f9c2e5]::check::check::check_opaque
  76:        0x11d7ef8cf - rustc_typeck[bd9bb7cc16f9c2e5]::check::check::check_item_type
  77:        0x11d7f7d7e - rustc_typeck[bd9bb7cc16f9c2e5]::check::check::check_mod_item_types
  78:        0x11e328f9e - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<rustc_span[dadb10719d06531]::def_id::LocalDefId, ()>>
  79:        0x11e3fc74b - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::check_mod_item_types, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  80:        0x11d99a6a9 - <rustc_session[3f62dfdbb5354e46]::session::Session>::time::<(), rustc_typeck[bd9bb7cc16f9c2e5]::check_crate::{closure#6}>
  81:        0x11d93030d - rustc_typeck[bd9bb7cc16f9c2e5]::check_crate
  82:        0x11ad838ea - rustc_interface[f8b8cf4f770498c1]::passes::analysis
  83:        0x11e376809 - rustc_query_system[923812efe1d06df6]::query::plumbing::try_execute_query::<rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt, rustc_query_system[923812efe1d06df6]::query::caches::DefaultCache<(), core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>>
  84:        0x11e41d61f - rustc_query_system[923812efe1d06df6]::query::plumbing::get_query::<rustc_query_impl[1fb0f992e528a50]::queries::analysis, rustc_query_impl[1fb0f992e528a50]::plumbing::QueryCtxt>
  85:        0x11ac8ca22 - <rustc_interface[f8b8cf4f770498c1]::passes::QueryContext>::enter::<rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  86:        0x11ac6c3e3 - <rustc_interface[f8b8cf4f770498c1]::interface::Compiler>::enter::<rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}::{closure#2}, core[ccfd6f2964525339]::result::Result<core[ccfd6f2964525339]::option::Option<rustc_interface[f8b8cf4f770498c1]::queries::Linker>, rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  87:        0x11acc1398 - rustc_span[dadb10719d06531]::with_source_map::<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_interface[f8b8cf4f770498c1]::interface::create_compiler_and_run<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#1}>
  88:        0x11ac6d039 - <scoped_tls[48db78d854efead3]::ScopedKey<rustc_span[dadb10719d06531]::SessionGlobals>>::set::<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  89:        0x11ac8fb99 - std[2c17b0a3fe477be8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f8b8cf4f770498c1]::util::run_in_thread_pool_with_globals<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  90:        0x11ac903c1 - <<std[2c17b0a3fe477be8]::thread::Builder>::spawn_unchecked_<rustc_interface[f8b8cf4f770498c1]::util::run_in_thread_pool_with_globals<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#1} as core[ccfd6f2964525339]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  91:        0x10e29c457 - std::sys::unix::thread::Thread::new::thread_start::h76e6c1c658a39a87
  92:     0x7ff8071614e1 - __pthread_start

error: internal compiler error: unexpected panic

note: 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.64.0 (a55dd71d5 2022-09-19) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C linker=/Users/kweston/Library/Caches/cargo-zigbuild/0.11.3/zigcc-aarch64-unknown-linux-gnu.sh -C strip=symbols -C target-cpu=neoverse-n1

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

query stack during panic:
#0 [typeck] type-checking `entry_points::apigateway::create_token_set`
#1 [mir_built] building MIR for `entry_points::apigateway::create_token_set`
#2 [unsafety_check_result] unsafety-checking `entry_points::apigateway::create_token_set`
#3 [mir_const] processing MIR for `entry_points::apigateway::create_token_set`
#4 [mir_promoted] processing `entry_points::apigateway::create_token_set`
#5 [mir_borrowck] borrow-checking `entry_points::apigateway::create_token_set`
#6 [type_of] computing type of `entry_points::apigateway::create_token_set::{opaque#0}`
#7 [check_mod_item_types] checking item types in module `entry_points::apigateway`
#8 [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: VecMap([(OpaqueTypeKey { def_id: DefId(0:426 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set::{opaque#0}), substs: [ReFree(DefId(0:425 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set), BrNamed(DefId(0:3670 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set::'_#3), '_))] }, OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/entry_points/apigateway/mod.rs:16:52: 16:80 (#2939), ty: _ }, origin: AsyncFn(DefId(0:425 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set)) }), (OpaqueTypeKey { def_id: DefId(0:427 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set::{opaque#0}::{opaque#0}), substs: [] }, OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/entry_points/apigateway/mod.rs:16:81: 37:2 (#0), ty: _ }, origin: FnReturn(DefId(0:425 ~ synchronizer_service[f58d]::entry_points::apigateway::create_token_set)) })])
  |
  = note: delayed at compiler/rustc_infer/src/infer/opaque_types/table.rs:50:26

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1426:13
stack backtrace:
   0:        0x10e28f5c4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7d80e14dd19335c9
   1:        0x10e2e768b - core::fmt::write::h1709d0255080e28a
   2:        0x10e281fe8 - std::io::Write::write_fmt::hecc56b5639d319e7
   3:        0x10e29289d - std::panicking::default_hook::{{closure}}::had4d1cd22a173020
   4:        0x10e2925ee - std::panicking::default_hook::h42aa124509888735
   5:        0x11acdb73a - rustc_driver[b232a614d5c482d6]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x10e292f0b - std::panicking::rust_panic_with_hook::h2b231e816574a23a
   7:        0x11f4a7687 - std[2c17b0a3fe477be8]::panicking::begin_panic::<rustc_errors[7d8f39c483a9ccdf]::ExplicitBug>::{closure#0}
   8:        0x11f4a7439 - std[2c17b0a3fe477be8]::sys_common::backtrace::__rust_end_short_backtrace::<std[2c17b0a3fe477be8]::panicking::begin_panic<rustc_errors[7d8f39c483a9ccdf]::ExplicitBug>::{closure#0}, !>
   9:        0x11f8472c9 - std[2c17b0a3fe477be8]::panicking::begin_panic::<rustc_errors[7d8f39c483a9ccdf]::ExplicitBug>
  10:        0x11f4dbf49 - std[2c17b0a3fe477be8]::panic::panic_any::<rustc_errors[7d8f39c483a9ccdf]::ExplicitBug>
  11:        0x11f4e0c4a - <rustc_errors[7d8f39c483a9ccdf]::HandlerInner as core[ccfd6f2964525339]::ops::drop::Drop>::drop
  12:        0x11ac5da5a - core[ccfd6f2964525339]::ptr::drop_in_place::<rustc_session[3f62dfdbb5354e46]::parse::ParseSess>
  13:        0x11ac64e9a - <alloc[a79849253dbb7549]::rc::Rc<rustc_session[3f62dfdbb5354e46]::session::Session> as core[ccfd6f2964525339]::ops::drop::Drop>::drop
  14:        0x11acc3e72 - core[ccfd6f2964525339]::ptr::drop_in_place::<rustc_interface[f8b8cf4f770498c1]::interface::Compiler>
  15:        0x11acc1a23 - rustc_span[dadb10719d06531]::with_source_map::<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_interface[f8b8cf4f770498c1]::interface::create_compiler_and_run<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#1}>
  16:        0x11ac6d039 - <scoped_tls[48db78d854efead3]::ScopedKey<rustc_span[dadb10719d06531]::SessionGlobals>>::set::<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  17:        0x11ac8fb99 - std[2c17b0a3fe477be8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f8b8cf4f770498c1]::util::run_in_thread_pool_with_globals<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>
  18:        0x11ac903c1 - <<std[2c17b0a3fe477be8]::thread::Builder>::spawn_unchecked_<rustc_interface[f8b8cf4f770498c1]::util::run_in_thread_pool_with_globals<rustc_interface[f8b8cf4f770498c1]::interface::run_compiler<core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>, rustc_driver[b232a614d5c482d6]::run_compiler::{closure#1}>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#0}, core[ccfd6f2964525339]::result::Result<(), rustc_errors[7d8f39c483a9ccdf]::ErrorGuaranteed>>::{closure#1} as core[ccfd6f2964525339]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  19:        0x10e29c457 - std::sys::unix::thread::Thread::new::thread_start::h76e6c1c658a39a87
  20:     0x7ff8071614e1 - __pthread_start

note: 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.64.0 (a55dd71d5 2022-09-19) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C linker=/Users/kweston/Library/Caches/cargo-zigbuild/0.11.3/zigcc-aarch64-unknown-linux-gnu.sh -C strip=symbols -C target-cpu=neoverse-n1

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

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `synchronizer-service`

Caused by:
  process didn't exit successfully: `rustc --crate-name synchronizer_service --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=f6c620fc4a9708bc -C extra-filename=-f6c620fc4a9708bc --out-dir /Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps --target aarch64-unknown-linux-gnu -C linker=/Users/kweston/Library/Caches/cargo-zigbuild/0.11.3/zigcc-aarch64-unknown-linux-gnu.sh -L dependency=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps -L dependency=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/release/deps --extern async_trait=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/release/deps/libasync_trait-b895c7d2fe4a607e.dylib --extern aws_config=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_config-518bdd19ff5c6473.rmeta --extern aws_sdk_apigatewaymanagement=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_sdk_apigatewaymanagement-fbe55848f9e17b64.rmeta --extern aws_sdk_dynamodb=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_sdk_dynamodb-468941c6fb61a8a6.rmeta --extern aws_sdk_lambda=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_sdk_lambda-ae71efe6221a9f83.rmeta --extern aws_sdk_servicediscovery=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_sdk_servicediscovery-f8e657becbb38f44.rmeta --extern aws_smithy_http=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_smithy_http-d9a5156069b130c7.rmeta --extern aws_types=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_types-37016b094efdcc35.rmeta --extern aws_lambda_events=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libaws_lambda_events-c6e8272a1e2048c5.rmeta --extern base64=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libbase64-e51bbf2d3f46b6b7.rmeta --extern chrono=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libchrono-75a6f14fc9e1bb43.rmeta --extern jsonwebtoken=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libjsonwebtoken-209720fc8b32e636.rmeta --extern lambda_http=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/liblambda_http-f0fb82304ca744cb.rmeta --extern lambda_runtime=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/liblambda_runtime-3e7ff303d0ee6596.rmeta --extern reqwest=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libreqwest-413e196d8132d4ac.rmeta --extern serde=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libserde-ac851e84548674de.rmeta --extern serde_json=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libserde_json-3b863ff80b633bca.rmeta --extern tokio=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libtokio-7bfa8d96576b4aeb.rmeta --extern tracing=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libtracing-5ddd1f4fd8a3b438.rmeta --extern tracing_subscriber=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/libtracing_subscriber-0137eaf45d5e75a0.rmeta --extern url=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/deps/liburl-2c67357d03468464.rmeta -C strip=symbols -C target-cpu=neoverse-n1 -L native=/Users/kweston/Development/Work/passion_project/synchronizer-service/target/aarch64-unknown-linux-gnu/release/build/ring-282b8a5e6ab5bd6b/out` (signal: 6, SIGABRT: process abort signal)

@kaweston kaweston 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 Oct 21, 2022
@kaweston
Copy link
Author

kaweston commented Oct 21, 2022

Found code problems triggering the compiler issue. Below is the before and after snippets of the last code block of the create_token_set function. Note the changes on line 1 where there was a missing .await?, Line 2 now requiring the turbofish, and line 4 where the return value needed to be wrapped in Ok().

I note that the Intellij editor wasn't flagging these as errors/warnings even with the Clippy linter turned on. Actually the need for the turbofish was highlighted after fixing line 1.

let token_set = service::core::create_token_set(storage_service_client, session_id);
match serde_json::to_string(token_set) {
    Ok(token_set) => Ok(response(StatusCode::OK, token_set)),
    Err(_) => error_response(&InternalError(ConstMsg("Problem serializing response")))
}


let token_set = service::core::create_token_set(storage_service_client, session_id).await?;
match serde_json::to_string::<TokenSet>(&token_set) {
    Ok(token_set) => Ok(response(StatusCode::OK, token_set)),
    Err(error) => Ok(error_response(&InternalError(FormattedMsg(format!("Problem serializing response: {}", error)))))
}

@compiler-errors
Copy link
Member

This is a bug that will get fixed with the next release of rustc, I think!

@compiler-errors
Copy link
Member

I'm gonna close this since it's fixed (by #99928) which is now on stable.

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) ❄️ 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

2 participants