Skip to content

ICE when running cargo +nightly fix --edition on tokio #86753

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

Closed
rylev opened this issue Jun 30, 2021 · 3 comments · Fixed by #86866
Closed

ICE when running cargo +nightly fix --edition on tokio #86753

rylev opened this issue Jun 30, 2021 · 3 comments · Fixed by #86866
Assignees
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

@rylev
Copy link
Member

rylev commented Jun 30, 2021

When running cargo +nightly fix --edition on tokio, I get the ICE seen below. This seems to happen when compiling benchmarks.

I have been unable so far to reproduce this with a plain cargo or rustc invocation. For example, cargo +nightly c --bench fs works fine.

This also seems to happen in reqwest.

Meta

rustc +nightly --version --verbose:

rustc 1.55.0-nightly (6d820866a 2021-06-29)
binary: rustc
commit-hash: 6d820866a27b1949e237be79b9c8c0145fe728b7
commit-date: 2021-06-29
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
Backtrace

$ RUST_BACKTRACE=1 cargo +nightly fix --edition
    Checking tests-build v0.1.0 (/home/rylevick/crater/tokio/tests-build)
    Checking tokio-macros v1.2.0 (/home/rylevick/crater/tokio/tokio-macros)
    Checking benches v0.0.0 (/home/rylevick/crater/tokio/benches)
   Migrating tests-build/src/lib.rs from 2018 edition to 2021
    Checking tokio-test v0.4.2 (/home/rylevick/crater/tokio/tokio-test)
   Migrating tokio-macros/src/lib.rs from 2018 edition to 2021
   Migrating benches/sync_rwlock.rs from 2018 edition to 2021
   Migrating benches/signal.rs from 2018 edition to 2021
   Migrating benches/sync_semaphore.rs from 2018 edition to 2021
   Migrating tokio-test/src/lib.rs from 2018 edition to 2021
   Migrating benches/spawn.rs from 2018 edition to 2021
   Migrating benches/rt_multi_threaded.rs from 2018 edition to 2021
    Checking stress-test v0.1.0 (/home/rylevick/crater/tokio/stress-test)
   Migrating stress-test/examples/simple_echo_tcp.rs from 2018 edition to 2021
   Migrating benches/fs.rs from 2018 edition to 2021
   Migrating benches/sync_mpsc.rs from 2018 edition to 2021
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 59', /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/core/src/panicking.rs:69:5
   3: rustc_infer::infer::InferCtxt::shallow_resolve_ty
   4: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
   5: rustc_middle::ty::fold::TypeFoldable::fold_with
   6: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   7: rustc_middle::ty::fold::TypeFoldable::fold_with
   8: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   9: rustc_middle::ty::fold::TypeFoldable::fold_with
  10: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  11: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
  12: rustc_middle::ty::fold::TypeFoldable::fold_with
  13: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  14: rustc_infer::infer::InferCtxtBuilder::enter
  15: core::ops::function::FnOnce::call_once
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::get_query_impl
  19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::normalize_generic_arg_after_erasing_regions
  20: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
  21: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_regions
  22: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::has_significant_drop
  23: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure
  24: rustc_hir::intravisit::walk_expr
  25: rustc_hir::intravisit::walk_expr
  26: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  27: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  28: rustc_hir::intravisit::walk_stmt
  29: rustc_hir::intravisit::walk_expr
  30: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  31: rustc_hir::intravisit::walk_expr
  32: rustc_hir::intravisit::walk_expr
  33: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  34: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  35: rustc_hir::intravisit::walk_expr
  36: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  37: rustc_hir::intravisit::walk_expr
  38: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  39: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::closure_analyze
  40: rustc_infer::infer::InferCtxtBuilder::enter
  41: rustc_typeck::check::typeck
  42: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  43: rustc_data_structures::stack::ensure_sufficient_stack
  44: rustc_query_system::query::plumbing::force_query_with_job
  45: rustc_query_system::query::plumbing::get_query_impl
  46: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  47: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  48: rustc_typeck::check::typeck_item_bodies
  49: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  50: rustc_data_structures::stack::ensure_sufficient_stack
  51: rustc_query_system::query::plumbing::force_query_with_job
  52: rustc_query_system::query::plumbing::get_query_impl
  53: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  54: rustc_session::utils::<impl rustc_session::session::Session>::time
  55: rustc_typeck::check_crate
  56: rustc_interface::passes::analysis
  57: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  58: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  59: rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task
  60: rustc_data_structures::stack::ensure_sufficient_stack
  61: rustc_query_system::query::plumbing::force_query_with_job
  62: rustc_query_system::query::plumbing::get_query_impl
  63: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  64: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  65: rustc_span::with_source_map
  66: rustc_interface::interface::create_compiler_and_run
  67: scoped_tls::ScopedKey<T>::set
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.55.0-nightly (6d820866a 2021-06-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -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 [normalize_generic_arg_after_erasing_regions] normalizing `(tokio::future::maybe_done::MaybeDone<impl std::future::Future>, tokio::future::maybe_done::MaybeDone<tokio::task::JoinHandle<()>>, tokio::future::maybe_done::MaybeDone<tokio::task::JoinHandle<()>>, tokio::future::maybe_done::MaybeDone<tokio::task::JoinHandle<()>>, tokio::future::maybe_done::MaybeDone<tokio::task::JoinHandle<()>>, tokio::future::maybe_done::MaybeDone<tokio::task::JoinHandle<()>>)`
#1 [typeck] type-checking `read_concurrent_contended_multi`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `benches`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 69', /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/6d820866a27b1949e237be79b9c8c0145fe728b7/library/core/src/panicking.rs:69:5
   3: rustc_infer::infer::InferCtxt::shallow_resolve_ty
   4: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
   5: rustc_middle::ty::fold::TypeFoldable::fold_with
   6: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   7: rustc_middle::ty::fold::TypeFoldable::fold_with
   8: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   9: rustc_middle::ty::util::fold_list
  10: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  11: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
  12: rustc_middle::ty::fold::TypeFoldable::fold_with
  13: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  14: rustc_infer::infer::InferCtxtBuilder::enter
  15: core::ops::function::FnOnce::call_once
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::get_query_impl
  19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::normalize_generic_arg_after_erasing_regions
  20: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
  21: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_regions
  22: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::has_significant_drop
  23: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure
  24: rustc_hir::intravisit::walk_expr
  25: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  26: rustc_hir::intravisit::walk_expr
  27: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  28: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::closure_analyze
  29: rustc_infer::infer::InferCtxtBuilder::enter
  30: rustc_typeck::check::typeck
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::force_query_with_job
  34: rustc_query_system::query::plumbing::get_query_impl
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  36: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  37: rustc_typeck::check::typeck_item_bodies
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_data_structures::stack::ensure_sufficient_stack
  40: rustc_query_system::query::plumbing::force_query_with_job
  41: rustc_query_system::query::plumbing::get_query_impl
  42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  43: rustc_session::utils::<impl rustc_session::session::Session>::time
  44: rustc_typeck::check_crate
  45: rustc_interface::passes::analysis
  46: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  47: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  48: rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task
  49: rustc_data_structures::stack::ensure_sufficient_stack
  50: rustc_query_system::query::plumbing::force_query_with_job
  51: rustc_query_system::query::plumbing::get_query_impl
  52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  53: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  54: rustc_span::with_source_map
  55: rustc_interface::interface::create_compiler_and_run
  56: scoped_tls::ScopedKey<T>::set
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.55.0-nightly (6d820866a 2021-06-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -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 [normalize_generic_arg_after_erasing_regions] normalizing `[closure@benches/fs.rs:66:16: 77:6]`
#1 [typeck] type-checking `async_read_std_file`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: build failed

This issue has been assigned to @arora-aman via this comment.

@rylev rylev 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. C-bug Category: This is a bug. labels Jun 30, 2021
@rylev
Copy link
Member Author

rylev commented Jun 30, 2021

This looks to be related to #86743.

@nikomatsakis
Copy link
Contributor

@rustbot assign @arora-aman

I'm hoping this is the same as #86743!

@rustbot rustbot self-assigned this Jul 1, 2021
@lqd
Copy link
Member

lqd commented Jul 2, 2021

Reduced the one happening in reqwest

use std::future::Future;
struct Runtime;
impl Runtime {
    pub fn block_on<F: Future>(&self, _future: F) -> F::Output {
        unimplemented!()
    }
}
pub fn http<F, Fut>(_func: F)
where
    F: Fn() -> Fut,
    Fut: Future<Output = ()>,
{
    let rt = Runtime {};
    let srv = rt.block_on(async move { serve(move || async move { unimplemented!() }) });
    let _ = || rt.block_on(async { srv });
}
pub struct Server<S> {
    _marker: std::marker::PhantomData<S>,
}
pub fn serve<S>(_new_service: S) -> Server<S> {
    unimplemented!()
}

rustc +nightly --edition=2018 --crate-type=lib --cap-lints=warn --force-warns rust-2021-compatibility -Zunstable-options main.rs will ICE:

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 21', /cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.55.0-nightly (7100b311d 2021-07-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options --crate-type lib

query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `Server<[[email protected]:14:46: 14:85]>`
#1 [typeck] type-checking `http`
end of query stack

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

Successfully merging a pull request may close this issue.

4 participants