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

ICE when running cargo fix --edition: error computing signigicant drop #90141

Closed
afetisov opened this issue Oct 21, 2021 · 1 comment
Closed
Labels
A-edition-2021 Area: The 2021 edition 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

@afetisov
Copy link

Code

use std::rc::Rc;

struct S<N, T>(Rc<(N, T)>);

impl<N, T> S<N, T> {
    fn new() -> Self {
        loop {}
    }
}

pub fn test() {
    let code = S::<(), ()>::new();
    let _ = || code;
}

Error output

$> cargo fix --edition --allow-dirty --allow-staged -j1
    Checking ice v0.1.0 (/home/user/untitled)
   Migrating src/lib.rs from 2018 edition to 2021
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:534:17: type parameter `T/#1` (T/1) out of range when substituting, substs=[(N, T)]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/compiler/rustc_errors/src/lib.rs:1093:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.56.0 (09c42c458 2021-10-18) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [adt_significant_drop_tys] computing when `S` has a significant destructor
#1 [has_significant_drop_raw] computing whether `S<(), ()>` has a significant drop
end of query stack
error: could not compile `ice`
Backtrace

stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::span_bug
   3: rustc_errors::Handler::span_bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::span_bug_fmt
   7: <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
   8: rustc_middle::ty::fold::TypeFoldable::fold_with
   9: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  10: <rustc_ty_utils::needs_drop::NeedsDropTypes<F> as core::iter::traits::iterator::Iterator>::next
  11: <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next
  12: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  13: core::iter::adapters::process_results
  14: rustc_ty_utils::needs_drop::adt_significant_drop_tys
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  16: rustc_data_structures::stack::ensure_sufficient_stack
  17: rustc_query_system::query::plumbing::force_query_with_job
  18: rustc_query_system::query::plumbing::get_query_impl
  19: rustc_query_system::query::plumbing::get_query
  20: rustc_ty_utils::needs_drop::has_significant_drop_raw
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::get_query_impl
  24: rustc_query_system::query::plumbing::get_query
  25: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::has_significant_drop
  26: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure
  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_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::closure_analyze
  32: rustc_infer::infer::InferCtxtBuilder::enter
  33: rustc_typeck::check::typeck
  34: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  35: rustc_data_structures::stack::ensure_sufficient_stack
  36: rustc_query_system::query::plumbing::force_query_with_job
  37: rustc_query_system::query::plumbing::force_query_impl
  38: rustc_query_impl::query_callbacks::typeck::force_from_dep_node
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  40: rustc_query_system::query::plumbing::ensure_must_run
  41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  42: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  43: rustc_typeck::check::typeck_item_bodies
  44: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  45: rustc_query_system::query::plumbing::force_query_with_job
  46: rustc_query_system::query::plumbing::get_query_impl
  47: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  48: rustc_session::utils::<impl rustc_session::session::Session>::time
  49: rustc_typeck::check_crate
  50: rustc_interface::passes::analysis
  51: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  52: rustc_data_structures::stack::ensure_sufficient_stack
  53: rustc_query_system::query::plumbing::force_query_with_job
  54: rustc_query_system::query::plumbing::get_query_impl
  55: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  56: rustc_interface::passes::QueryContext::enter
  57: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  58: rustc_span::with_source_map
  59: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@afetisov afetisov 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, 2021
@ehuss
Copy link
Contributor

ehuss commented Oct 21, 2021

Thanks for the report, and the very nice and concise reproduction. I'm pretty certain that this is the same as #90024, so closing to keep the discussion in one place.

@ehuss ehuss closed this as completed Oct 21, 2021
@ehuss ehuss added the A-edition-2021 Area: The 2021 edition label Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2021 Area: The 2021 edition 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