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

Internal compiler error: ... should have been pre-allocated but wasn't #71466

Closed
lucassardois opened this issue Apr 23, 2020 · 1 comment
Closed

Comments

@lucassardois
Copy link

lucassardois commented Apr 23, 2020

The following code:

pub struct VertexId(i64);

pub trait GraphStorable {
    fn id(&self) -> Option<&VertexId>;
}

pub trait GraphTraversable: GraphStorable {
    fn inc(&self) -> &Vec<&Self>;
}

pub trait GraphProperties: GraphTraversable {
    fn label(&self) -> &'static str;
}

struct Vertex<'a> {
    id: Option<VertexId>,
    inc: Vec<&'a Vertex<'a>>
}

impl GraphStorable for Vertex<'_> {
    fn id(&self) -> Option<&VertexId> {
        self.id.as_ref()
    }
}

impl GraphTraversable for Vertex<'_> {

    fn inc(&self) -> &Vec<&Self> {
        &self.inc
    }
}

struct PropertyVertex {
}

Trigger the following error when run with cargo test:

   Compiling rugdb v0.1.0 (/mnt/hdd/dev/rugdb)
error: internal compiler error: src/librustc/dep_graph/graph.rs:687: DepNode Hir(rugdb[ca3c]::graph_engine[0]::vertex[0]::Vertex[0]::id[0]) should have been pre-allocated but wasn't.

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:873:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/liballoc/boxed.rs:1029
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  14: std::panicking::begin_panic
  15: rustc_errors::HandlerInner::bug
  16: rustc_errors::Handler::bug
  17: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  18: rustc::ty::context::tls::with_opt::{{closure}}
  19: rustc::ty::context::tls::with_opt
  20: rustc::util::bug::opt_span_bug_fmt
  21: rustc::util::bug::bug_fmt
  22: rustc::dep_graph::graph::DepGraph::try_mark_previous_green
  23: rustc::dep_graph::graph::DepGraph::try_mark_green
  24: rustc::dep_graph::graph::DepGraph::try_mark_green_and_read
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: <rustc_typeck::outlives::implicit_infer::InferVisitor as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item
  27: rustc_hir::hir::Crate::visit_all_item_likes
  28: rustc_typeck::outlives::inferred_outlives_crate
  29: rustc::dep_graph::graph::DepGraph::with_task_impl
  30: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::force_query
  31: rustc::ty::query::plumbing::force_from_dep_node
  32: rustc::dep_graph::graph::DepGraph::try_mark_previous_green
  33: rustc::dep_graph::graph::DepGraph::try_mark_previous_green
  34: rustc::dep_graph::graph::DepGraph::try_mark_previous_green
  35: rustc::dep_graph::graph::DepGraph::try_mark_green
  36: rustc::dep_graph::graph::DepGraph::try_mark_green_and_read
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  38: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  39: rustc::hir::map::Map::visit_item_likes_in_module
  40: rustc_typeck::collect::collect_mod_item_types
  41: rustc::ty::query::__query_compute::collect_mod_item_types
  42: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  43: rustc::dep_graph::graph::DepGraph::with_task_impl
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  45: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  46: rustc_typeck::check_crate
  47: rustc_interface::passes::analysis
  48: rustc::ty::query::__query_compute::analysis
  49: rustc::dep_graph::graph::DepGraph::with_task_impl
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  51: rustc::ty::context::tls::enter_global
  52: rustc_interface::interface::run_compiler_in_existing_thread_pool
  53: scoped_tls::ScopedKey<T>::set
  54: syntax::with_globals
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0 (b8cedc004 2020-03-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [type_of] processing `graph_engine::vertex::Vertex::id`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
#2 [predicates_of] processing `QueryResult`
#3 [collect_mod_item_types] collecting item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

My system recognized as x86_64-unknown-linux-gnu is an arch linux.

@jonas-schievink
Copy link
Contributor

Duplicate of #62649

@jonas-schievink jonas-schievink marked this as a duplicate of #62649 Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants