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

Missing third layer of await after conditional triggers index out of bounds, snapshot_vec.rs #101149

Closed
tobbelobb opened this issue Aug 29, 2022 · 2 comments
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

@tobbelobb
Copy link

tobbelobb commented Aug 29, 2022

Hello Rust Maintainers!

I ran into this bug on nightly:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=2efc38c82d9d4b8ae0297447bbec9acf

Code

async fn another_async() -> bool {
    async { true }.await
}

async fn one_async() -> bool {
    another_async().await
}

#[tokio::main]
async fn main() {
    if false {
        return Err(());
    }

    one_async()
}

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (ce36e8825 2022-08-28)
binary: rustc
commit-hash: ce36e88256f09078519f8bc6b21e4dc88f88f523
commit-date: 2022-08-28
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0

Also panics with rustc 1.65.0-nightly (015a824f2 2022-08-22)

Error output

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [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: `InferCtxt` incorrectly tainted by errors

...

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
Backtrace


$ RUST_BACKTRACE=1 cargo build
   Compiling my-program v0.1.0 (/home/me/my-program)
thread 'rustc' panicked at 'index out of bounds: the len is 10 but the index is 11', /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/core/src/panicking.rs:84:5
   3: <rustc_infer::infer::ShallowResolver as rustc_middle::ty::fold::TypeFolder>::fold_ty
   4: <&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_middle::ty::fold::TypeFoldable>::try_fold_with::<rustc_infer::infer::resolve::OpportunisticVarResolver>
   5: <rustc_infer::infer::resolve::OpportunisticVarResolver as rustc_middle::ty::fold::FallibleTypeFolder>::try_fold_ty
   6: <(rustc_middle::ty::Ty, rustc_middle::ty::Ty) as rustc_middle::ty::fold::TypeFoldable>::fold_with::<rustc_infer::infer::resolve::OpportunisticVarResolver>
   7: <rustc_infer::infer::InferCtxt>::same_type_modulo_infer
   8: <rustc_infer::infer::InferCtxt>::note_type_err
   9: <rustc_infer::infer::InferCtxt>::report_and_explain_type_error
  10: <rustc_infer::infer::InferCtxt>::report_mismatched_types
  11: <rustc_typeck::check::coercion::CoerceMany<&rustc_hir::hir::Expr>>::report_return_mismatched_types
  12: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  13: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  14: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  15: rustc_typeck::check::check::check_fn
  16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
  17: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  20: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl
  22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  23: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  25: rustc_typeck::check::check::check_fn
  26: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  27: rustc_typeck::check::typeck
  28: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  31: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>
  32: rustc_typeck::check::typeck_item_bodies
  33: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
  34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
  35: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
  36: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
  37: rustc_typeck::check_crate
  38: rustc_interface::passes::analysis
  39: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  41: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  42: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  43: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  44: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  45: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  46: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.65.0-nightly (ce36e8825 2022-08-28) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [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: `InferCtxt` incorrectly tainted by errors
  |
  = note: delayed at compiler/rustc_infer/src/infer/mod.rs:1247:27

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1487:13
stack backtrace:
   0:     0x7f03ce19d9d0 - std::backtrace_rs::backtrace::libunwind::trace::h8dabf66c25adb6da
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f03ce19d9d0 - std::backtrace_rs::backtrace::trace_unsynchronized::hf4fec52173b4eaeb
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f03ce19d9d0 - std::sys_common::backtrace::_print_fmt::h08cb270fe2b8b78f
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f03ce19d9d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65daf3f5a3d534c7
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f03ce1f868e - core::fmt::write::he00ac7bf4f48a641
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f03ce18e755 - std::io::Write::write_fmt::h608354694b121848
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/io/mod.rs:1681:15
   6:     0x7f03ce1a0663 - std::sys_common::backtrace::_print::h6ebd71c1af79f2f3
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f03ce1a0663 - std::sys_common::backtrace::print::h7406d39a52be3cfe
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f03ce1a0663 - std::panicking::default_hook::{{closure}}::ha9610e4e3fec12dd
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/panicking.rs:295:22
   9:     0x7f03ce1a034f - std::panicking::default_hook::ha80af68da9514339
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/panicking.rs:314:9
  10:     0x7f03ccc0b484 - rustc_driver[ec8756eb7f4fb9df]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f03ce1a0e9d - std::panicking::rust_panic_with_hook::hc28f14d82ed14558
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/panicking.rs:702:17
  12:     0x7f03cdcc64c1 - std[5a94a8aac1801f3a]::panicking::begin_panic::<rustc_errors[b2339593479fa8a3]::ExplicitBug>::{closure#0}
  13:     0x7f03cdcc6476 - std[5a94a8aac1801f3a]::sys_common::backtrace::__rust_end_short_backtrace::<std[5a94a8aac1801f3a]::panicking::begin_panic<rustc_errors[b2339593479fa8a3]::ExplicitBug>::{closure#0}, !>
  14:     0x7f03cdcc1386 - std[5a94a8aac1801f3a]::panicking::begin_panic::<rustc_errors[b2339593479fa8a3]::ExplicitBug>
  15:     0x7f03cdcc3e96 - std[5a94a8aac1801f3a]::panic::panic_any::<rustc_errors[b2339593479fa8a3]::ExplicitBug>
  16:     0x7f03cc6c4438 - <rustc_errors[b2339593479fa8a3]::HandlerInner as core[4e066d1c9fae604e]::ops::drop::Drop>::drop
  17:     0x7f03cc4d5118 - core[4e066d1c9fae604e]::ptr::drop_in_place::<rustc_session[d6e07e692220c9bc]::parse::ParseSess>
  18:     0x7f03cc4c5248 - <alloc[b2ae589778386305]::rc::Rc<rustc_session[d6e07e692220c9bc]::session::Session> as core[4e066d1c9fae604e]::ops::drop::Drop>::drop
  19:     0x7f03cc4c45ed - core[4e066d1c9fae604e]::ptr::drop_in_place::<rustc_interface[39a42f7e5df8a426]::interface::Compiler>
  20:     0x7f03cc4c3f85 - rustc_span[66bcb089e3efbe2e]::with_source_map::<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_interface[39a42f7e5df8a426]::interface::create_compiler_and_run<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_driver[ec8756eb7f4fb9df]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f03cc4c3632 - rustc_interface[39a42f7e5df8a426]::interface::create_compiler_and_run::<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_driver[ec8756eb7f4fb9df]::run_compiler::{closure#1}>
  22:     0x7f03cc4c21d1 - <scoped_tls[e4e35c5970b1bea9]::ScopedKey<rustc_span[66bcb089e3efbe2e]::SessionGlobals>>::set::<rustc_interface[39a42f7e5df8a426]::interface::run_compiler<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_driver[ec8756eb7f4fb9df]::run_compiler::{closure#1}>::{closure#0}, core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>>
  23:     0x7f03cc4c1ebf - std[5a94a8aac1801f3a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[39a42f7e5df8a426]::util::run_in_thread_pool_with_globals<rustc_interface[39a42f7e5df8a426]::interface::run_compiler<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_driver[ec8756eb7f4fb9df]::run_compiler::{closure#1}>::{closure#0}, core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>>::{closure#0}, core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>>
  24:     0x7f03cca2b889 - <<std[5a94a8aac1801f3a]::thread::Builder>::spawn_unchecked_<rustc_interface[39a42f7e5df8a426]::util::run_in_thread_pool_with_globals<rustc_interface[39a42f7e5df8a426]::interface::run_compiler<core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>, rustc_driver[ec8756eb7f4fb9df]::run_compiler::{closure#1}>::{closure#0}, core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>>::{closure#0}, core[4e066d1c9fae604e]::result::Result<(), rustc_errors[b2339593479fa8a3]::ErrorGuaranteed>>::{closure#1} as core[4e066d1c9fae604e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f03ce1aac93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1ca34a59251d72eb
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/alloc/src/boxed.rs:1940:9
  26:     0x7f03ce1aac93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h788e93dd204862f4
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/alloc/src/boxed.rs:1940:9
  27:     0x7f03ce1aac93 - std::sys::unix::thread::Thread::new::thread_start::h498814059faae8a4
                               at /rustc/ce36e88256f09078519f8bc6b21e4dc88f88f523/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f03c9e2b6db - start_thread
                               at /build/glibc-CVJwZb/glibc-2.27/nptl/pthread_create.c:463
  29:     0x7f03c9b5461f - clone
                               at /build/glibc-CVJwZb/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  30:                0x0 - <unknown>

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.65.0-nightly (ce36e8825 2022-08-28) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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 `my-program`

Caused by:
  process didn't exit successfully: `rustc --crate-name stake_checker --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=ac2b7d9d7aff1749 -C extra-filename=-ac2b7d9d7aff1749 --out-dir /home/me/my-program/target/debug/deps -C incremental=/home/me/my-program/target/debug/incremental -L dependency=/home/me/my-program/target/debug/deps --extern clap=/home/me/my-program/target/debug/deps/libclap-9d28061781ecfdd8.rlib --extern csv=/home/me/my-program/target/debug/deps/libcsv-409e97ee4fd35f07.rlib --extern dotenv=/home/me/my-program/target/debug/deps/libdotenv-700445d3d22bfbe4.rlib --extern log=/home/me/my-program/target/debug/deps/liblog-b2eb49acbca17607.rlib --extern log4rs=/home/me/my-program/target/debug/deps/liblog4rs-099fd973b60595ab.rlib --extern reqwest=/home/me/my-program/target/debug/deps/libreqwest-94c3460b9b9670b2.rlib --extern serde=/home/me/my-program/target/debug/deps/libserde-ba6c7b1bf1922675.rlib --extern serde_json=/home/me/my-program/target/debug/deps/libserde_json-295eb70644a73947.rlib --extern util=/home/me/my-program/target/debug/deps/libutil-3e512f0feb3f4e9d.rlib --extern tokio=/home/me/my-program/target/debug/deps/libtokio-c9498eca8e7ff565.rlib` (signal: 6, SIGABRT: process abort signal)

@tobbelobb tobbelobb 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 Aug 29, 2022
@compiler-errors
Copy link
Member

This should be fixed by #99928

@compiler-errors
Copy link
Member

This is fixed.

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