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

cargo fix --edition ICE with petgraph::Graph used in closure #90169

Closed
birkenfeld opened this issue Oct 22, 2021 · 4 comments
Closed

cargo fix --edition ICE with petgraph::Graph used in closure #90169

birkenfeld opened this issue Oct 22, 2021 · 4 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

@birkenfeld
Copy link
Contributor

Code

# Cargo.toml dependency: petgraph = "0.6"
fn main() {
    let mut graph: petgraph::Graph<i32, i32> = petgraph::Graph::new();
    (|| graph.add_node(0))();
}

Meta

rustc --version --verbose:

rustc 1.58.0-nightly (547a6ffee 2021-10-21)
binary: rustc
commit-hash: 547a6ffee0cf4da9929a9e3d49546dc87d607735
commit-date: 2021-10-21
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

Error output

$ cargo fix --edition
error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:534:17: type parameter `Ix/#3` (Ix/3) out of range when substituting, substs=[petgraph::graph::Edge<E, Ix>, std::alloc::Global]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/547a6ffee0cf4da9929a9e3d49546dc87d607735/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.58.0-nightly (547a6ffee 2021-10-21) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [adt_significant_drop_tys] computing when `petgraph::graph_impl::Graph` has a significant destructor
#1 [has_significant_drop_raw] computing whether `petgraph::graph_impl::Graph<i32, i32>` has a significant drop
end of query stack
error: could not compile `repro`
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::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   9: <rustc_ty_utils::needs_drop::NeedsDropTypes<F> as core::iter::traits::iterator::Iterator>::next
  10: <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  12: core::iter::adapters::process_results
  13: rustc_ty_utils::needs_drop::adt_significant_drop_tys
  14: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  15: rustc_data_structures::stack::ensure_sufficient_stack
  16: rustc_query_system::query::plumbing::try_execute_query
  17: rustc_query_system::query::plumbing::get_query
  18: rustc_ty_utils::needs_drop::has_significant_drop_raw
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::try_execute_query
  22: rustc_query_system::query::plumbing::get_query
  23: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::has_significant_drop
  24: rustc_typeck::check::upvar::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::analyze_closure
  25: <rustc_typeck::check::upvar::InferBorrowKindVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  26: rustc_hir::intravisit::walk_expr
  27: rustc_hir::intravisit::walk_stmt
  28: rustc_hir::intravisit::walk_block
  29: rustc_hir::intravisit::walk_body
  30: rustc_infer::infer::InferCtxtBuilder::enter
  31: rustc_typeck::check::typeck
  32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  33: rustc_data_structures::stack::ensure_sufficient_stack
  34: rustc_query_system::query::plumbing::try_execute_query
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  36: rustc_typeck::check::typeck
  37: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  38: rustc_data_structures::stack::ensure_sufficient_stack
  39: rustc_query_system::query::plumbing::try_execute_query
  40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  41: rustc_middle::hir::map::Map::par_body_owners
  42: rustc_typeck::check::typeck_item_bodies
  43: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  44: rustc_data_structures::stack::ensure_sufficient_stack
  45: rustc_query_system::query::plumbing::try_execute_query
  46: rustc_query_system::query::plumbing::get_query
  47: rustc_session::utils::<impl rustc_session::session::Session>::time
  48: rustc_typeck::check_crate
  49: rustc_interface::passes::analysis
  50: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  51: rustc_data_structures::stack::ensure_sufficient_stack
  52: rustc_query_system::query::plumbing::try_execute_query
  53: rustc_query_system::query::plumbing::get_query
  54: rustc_interface::passes::QueryContext::enter
  55: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  56: rustc_span::with_source_map
  57: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.58.0-nightly (547a6ffee 2021-10-21) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [adt_significant_drop_tys] computing when `petgraph::graph_impl::Graph` has a significant destructor
#1 [has_significant_drop_raw] computing whether `petgraph::graph_impl::Graph<i32, i32>` has a significant drop
#2 [typeck] type-checking `main`
#3 [typeck] type-checking `main::{closure#0}`
#4 [typeck_item_bodies] type-checking all item bodies
#5 [analysis] running analysis passes on this crate
end of query stack

@birkenfeld birkenfeld 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 22, 2021
@sezna
Copy link

sezna commented Oct 22, 2021

Happens on 1.56 stable for me on both ARM and intel, although it is with a different dependency (pest).

@wkordalski
Copy link
Contributor

Also on 1.56 stable on Intel with Seed as a dependency.

# Cargo.toml dependency: seed = "0.8"
use seed::prelude::*;

pub fn run() {
    let app = App::start("root", init, update, view);
    move || {
        app.update(Msg);
    };
}


struct Model;
struct Msg;

fn init(_url: Url, orders: &mut impl Orders<Msg>) -> Model {
    Model
}

fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
}

fn view(model: &Model) -> impl IntoNodes<Msg> {
    Node::NoChange
}
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0

@wkordalski
Copy link
Contributor

Probably a duplicate of #90024

@birkenfeld
Copy link
Contributor Author

Yeah looks like it.

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

3 participants