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

thread 'rustc' panicked at 'index out of bounds: the len is 681 but the index is 682' #102605

Closed
earthengine opened this issue Oct 2, 2022 · 7 comments · Fixed by #102648
Closed
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

@earthengine
Copy link

earthengine commented Oct 2, 2022

Code

Still working out how to get rid of this and find a minimal replicating code example.

The backtrace however, contains some useful information like "index out of bounds", for those who knows the implementation of the compiler. I guess it should be a good clue to find out what makes it wrong.

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-pc-windows-msvc
release: 1.64.0
LLVM version: 14.0.6

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 681 but the index is 682', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\ena-0.14.0\src\snapshot_vec.rs:199:10
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 681 but the index is 682', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\ena-0.14.0\src\snapshot_vec.rs:199:10
stack backtrace:
   0:     0x7fff5f3b9fbf - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf958371dc84a30d1
   1:     0x7fff5f3f4b5a - core::fmt::write::h8bc5f8dfcde4777f
   2:     0x7fff5f3ac749 - <std::io::IoSlice as core::fmt::Debug>::fmt::hab1bb118c5bfde47
   3:     0x7fff5f3bd8bb - std::panicking::default_hook::hcfea80c086f9466a
   4:     0x7fff5f3bd535 - std::panicking::default_hook::hcfea80c086f9466a
   5:     0x7fff2a2fc404 - rustc_driver[a0a607043376aa59]::pretty::print_after_hir_lowering
   6:     0x7fff5f3be062 - std::panicking::rust_panic_with_hook::h43b18a7cf7089063
   7:     0x7fff5f3bddfd - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h51b3df288982544c
   8:     0x7fff5f3babf7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf958371dc84a30d1
   9:     0x7fff5f3bdad9 - rust_begin_unwind
  10:     0x7fff5f42ae95 - core::panicking::panic_fmt::h8a30ca8e1c32c5a5
  11:     0x7fff5f42adb7 - core::panicking::panic_bounds_check::h71fa2a0d9f8dc526
  12:     0x7fff2a09c966 - <rustc_infer[9921ae7fd9eefb8a]::infer::ShallowResolver as rustc_middle[345e23a01d15c30c]::ty::fold::TypeFolder>::fold_ty
  13:     0x7fff2a0bd168 - <rustc_infer[9921ae7fd9eefb8a]::infer::resolve::FullTypeResolver as rustc_middle[345e23a01d15c30c]::ty::fold::FallibleTypeFolder>::try_fold_const
  14:     0x7fff2a0b25c4 - <rustc_infer[9921ae7fd9eefb8a]::infer::opaque_types::table::OpaqueTypeStorage>::take_opaque_types
  15:     0x7fff2c473988 - <rustc_infer[9921ae7fd9eefb8a]::infer::lexical_region_resolve::RegionResolutionError as core[f4e460384c48c425]::fmt::Debug>::fmt
  16:     0x7fff2c40a2f1 - <rustc_infer[9921ae7fd9eefb8a]::infer::InferCtxt>::same_type_modulo_infer
  17:     0x7fff2c40f6f9 - <rustc_infer[9921ae7fd9eefb8a]::infer::InferCtxt>::note_type_err
  18:     0x7fff2c405ad0 - <rustc_infer[9921ae7fd9eefb8a]::infer::InferCtxt>::report_and_explain_type_error
  19:     0x7fff2b866e6c - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::get_fn_decl
  20:     0x7fff2975111b - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::structurally_resolved_type     
  21:     0x7fff2972837a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_call
  22:     0x7fff2976d7f3 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  23:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  24:     0x7fff2974f2a4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::structurally_resolved_type     
  25:     0x7fff2972837a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_call
  26:     0x7fff2976d7f3 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  27:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  28:     0x7fff29768d18 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_match
  29:     0x7fff2976ef44 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  30:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  31:     0x7fff29754f54 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_struct_path
  32:     0x7fff29755fab - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  33:     0x7fff297567f4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  34:     0x7fff2976d844 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  35:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  36:     0x7fff2976f45a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  37:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  38:     0x7fff29754f54 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_struct_path
  39:     0x7fff29755fab - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  40:     0x7fff297567f4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  41:     0x7fff2976d844 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  42:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  43:     0x7fff2976f45a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  44:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  45:     0x7fff29770c9c - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  46:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  47:     0x7fff2975684a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  48:     0x7fff2976d844 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  49:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  50:     0x7fff2976904b - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_match
  51:     0x7fff2976ef44 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  52:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  53:     0x7fff297560a1 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  54:     0x7fff297567f4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  55:     0x7fff2976d844 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  56:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  57:     0x7fff2976f7b4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  58:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  59:     0x7fff2975684a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_stmt
  60:     0x7fff2976d844 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  61:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  62:     0x7fff296e551b - <rustc_typeck[d2a199ddac7b0ad4]::bounds::Bounds>::predicates
  63:     0x7fff2976b7c7 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  64:     0x7fff29770c2b - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  65:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  66:     0x7fff2974f2a4 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::structurally_resolved_type     
  67:     0x7fff2972837a - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_call
  68:     0x7fff2976d7f3 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::check_expr_closure
  69:     0x7fff2973d4b6 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::demand_coerce
  70:     0x7fff296e551b - <rustc_typeck[d2a199ddac7b0ad4]::bounds::Bounds>::predicates
  71:     0x7fff297f9a9b - <rustc_infer[9921ae7fd9eefb8a]::infer::outlives::env::OutlivesEnvironment as rustc_typeck[d2a199ddac7b0ad4]::check::regionck::OutlivesEnvironmentExt>::add_implied_bounds
  72:     0x7fff297b89a5 - <rustc_typeck[d2a199ddac7b0ad4]::check::UnsafetyState>::recurse
  73:     0x7fff286fee88 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings
  74:     0x7fff28845081 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
  75:     0x7fff29cc9adc - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
  76:     0x7fff29c0cbd2 - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
  77:     0x7fff2a17c948 - <rustc_middle[345e23a01d15c30c]::ty::context::TyCtxt>::typeck_opt_const_arg
  78:     0x7fff2995c74f - <rustc_mir_build[7930c7710dadfc91]::build::expr::as_place::PlaceBuilder as core[f4e460384c48c425]::convert::From<rustc_middle[345e23a01d15c30c]::mir::Local>>::from
  79:     0x7fff286fd672 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
  80:     0x7fff28836ea1 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
  81:     0x7fff29cb131a - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
  82:     0x7fff29c0af22 - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
  83:     0x7fff2959a0ef - <rustc_mir_transform[dfe13de59bbb3f3b]::check_unsafety::UnsafetyChecker as rustc_middle[345e23a01d15c30c]::mir::visit::Visitor>::visit_place
  84:     0x7fff2958e29f - <rustc_mir_transform[dfe13de59bbb3f3b]::simplify_try::SimplifyBranchSame as rustc_middle[345e23a01d15c30c]::mir::MirPass>::run_pass
  85:     0x7fff286fee88 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
  86:     0x7fff28841561 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
  87:     0x7fff29cccefc - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
  88:     0x7fff29c0c752 - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
  89:     0x7fff29563a6f - <rustc_mir_transform[dfe13de59bbb3f3b]::simplify_branches::SimplifyConstCondition as rustc_middle[345e23a01d15c30c]::mir::MirPass>::run_pass
  90:     0x7fff286fd672 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
  91:     0x7fff28836ea1 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
  92:     0x7fff29cb131a - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
  93:     0x7fff29c0b089 - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
  94:     0x7fff29566694 - <rustc_mir_transform[dfe13de59bbb3f3b]::simplify_branches::SimplifyConstCondition as rustc_middle[345e23a01d15c30c]::mir::MirPass>::run_pass
  95:     0x7fff286fd7e2 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
  96:     0x7fff288375d7 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
  97:     0x7fff29cb3095 - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
  98:     0x7fff29c0b6ae - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
  99:     0x7fff299b5157 - <rustc_middle[345e23a01d15c30c]::ty::adjustment::AutoBorrowMutability as rustc_mir_build[7930c7710dadfc91]::thir::cx::expr::ToBorrowKind>::to_borrow_kind
 100:     0x7fff299b4a9f - <rustc_middle[345e23a01d15c30c]::ty::adjustment::AutoBorrowMutability as rustc_mir_build[7930c7710dadfc91]::thir::cx::expr::ToBorrowKind>::to_borrow_kind
 101:     0x7fff286fee88 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
 102:     0x7fff28841561 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 103:     0x7fff29ccb482 - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
 104:     0x7fff29c0ce83 - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
 105:     0x7fff297d84d5 - <rustc_typeck[d2a199ddac7b0ad4]::check::upvar::InferBorrowKindVisitor as rustc_hir[94f5a242fc3ad22c]::intravisit::Visitor>::visit_expr
 106:     0x7fff29d58e13 - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
 107:     0x7fff29c0933b - <rustc_query_impl[eb123e80d0f4deec]::Queries as rustc_middle[345e23a01d15c30c]::ty::query::QueryEngine>::as_any
 108:     0x7fff296db1f9 - <rustc_typeck[d2a199ddac7b0ad4]::expr_use_visitor::ExprUseVisitor>::walk_expr
 109:     0x7fff286fdd88 - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
 110:     0x7fff2884577f - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 111:     0x7fff29cd02e4 - <rustc_span[7d253b2ad3f54c9a]::def_id::DefId as rustc_serialize[f7496f00b61bd66d]::serialize::Encodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheEncoder>>::encode
 112:     0x7fff2881b476 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 113:     0x7fff284ef789 - <rustc_typeck[d2a199ddac7b0ad4]::check::fn_ctxt::FnCtxt>::write_user_type_annotation     
 114:     0x7fff2849e608 - rustc_typeck[d2a199ddac7b0ad4]::check_crate
 115:     0x7fff27d05e45 - rustc_interface[e31b1d572a2c621e]::passes::analysis
 116:     0x7fff287005de - rustc_query_impl[eb123e80d0f4deec]::profiling_support::alloc_self_profile_query_strings  
 117:     0x7fff2885ffd6 - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 118:     0x7fff287ca65f - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 119:     0x7fff2883189d - <&[rustc_span[7d253b2ad3f54c9a]::def_id::DefId] as rustc_serialize[f7496f00b61bd66d]::serialize::Decodable<rustc_query_impl[eb123e80d0f4deec]::on_disk_cache::CacheDecoder>>::decode
 120:     0x7fff27cc7cb4 - <unknown>
 121:     0x7fff27cabd8b - <unknown>
 122:     0x7fff27ca3110 - <unknown>
 123:     0x7fff27cacdf0 - <unknown>
 124:     0x7fff27cd8cb9 - rustc_driver[a0a607043376aa59]::args::arg_expand_all
 125:     0x7fff27cc83bd - <unknown>
 126:     0x7fff5f3cebdc - std::sys::windows::thread::Thread::new::hdf946fbfa5577747
 127:     0x7ff815dd54e0 - BaseThreadInitThunk
 128:     0x7ff817e0485b - RtlUserThreadStart

error: internal compiler error: unexpected panic

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

@earthengine earthengine 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 2, 2022
@compiler-errors
Copy link
Member

Can you check if this is fixed on nightly?

@earthengine
Copy link
Author

@compiler-errors
Running the nightly channel on the same code reports a type error that linked to a change I made in the code that making a function returning Result<T, E> to an async fn but forgot to change the calling site to use .await.

@earthengine
Copy link
Author

earthengine commented Oct 3, 2022

Ok, according the clue above I found a minimal code example

async fn foo() -> Result<(), String> {
    Ok(())
}

fn convert_result<T, E>(r: Result<T, E>) -> Option<T> {
    None
}

fn main() -> Option<()> {
    convert_result(foo())
}

Playground

The above code should not compile; but instead of reporting errors it crashes the compiler.

Seems only affects the stable channel; beta and nightly are working properly.

(The example code can be rewritten as foo().ok() or something like that and it will report the error correctly; however the real code was converting to ControlFlow instead of Option so it does not help)

@compiler-errors
Copy link
Member

So this is fixed by #99928 -- unfortunately that's going to land in the next release cycle (1.65) and this isn't a critical enough ICE to warrant a patch release for 1.64

@estebank
Copy link
Contributor

estebank commented Oct 3, 2022

@compiler-errors can we add the repro to the test suite and close the ticket then?

@estebank estebank added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Oct 3, 2022
@compiler-errors compiler-errors added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 3, 2022
@Rageking8
Copy link
Contributor

@rustbot claim
To add the test if it's not already done.

@compiler-errors
Copy link
Member

Please do!

bors added a commit to rust-lang-ci/rust that referenced this issue Oct 4, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#102241 (Package `rust-docs-json` into nightly components (take 3))
 - rust-lang#102488 (Check generic argument compatibility when projecting assoc ty)
 - rust-lang#102647 (Only allow ~const bounds for traits with #[const_trait])
 - rust-lang#102648 (Add test for rust-lang#102605)
 - rust-lang#102651 (It's not about types or consts, but the lack of regions)
 - rust-lang#102653 (resolve instance: missing value to `delay_span_bug`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 08253f3 Oct 4, 2022
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. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

Successfully merging a pull request may close this issue.

4 participants