Skip to content

ICE on stable 1.57.0 #91935

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
stephanemagnenat opened this issue Dec 14, 2021 · 5 comments
Closed

ICE on stable 1.57.0 #91935

stephanemagnenat opened this issue Dec 14, 2021 · 5 comments
Labels
A-incr-comp Area: Incremental compilation 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

@stephanemagnenat
Copy link

stephanemagnenat commented Dec 14, 2021

When the ICE happened, I had error messages of the type:

WARN rustc_metadata::locator no metadata found: incompatible metadata version found: '/home/steph/build/npc-engine/debug/deps/libpalette_derive-a116efebdb58b69c.so'

The code compiles with rustc 1.59.0-nightly (8f117a77d 2021-12-13).

After cleaning up the build directory, compilation succeeds with 1.57.0 as well.

However, I still report the bug as I didn't touch anything by hand in the build directory previously so there seems to be a problem with dependencies, maybe over a rustc update?

Note that my target directory is a symlink to somewhere else in my home folder (Ubuntu 20.04.3 Ryzen 5800X).

Code

I have been trying to find a minimal test case, but failed so far. The code I am working on is a complex MCTS planner and not ready to be open-sourced, but I can give a temporary copy to whoever is investigating this issue.

I have a way to enable/disable the problem in my code, so I'll try to give some excerpts in the hope it helps pinpointing the issue in the compiler:

I have a planning domain:

pub trait Domain: Sized + 'static {
    type State: std::fmt::Debug + Sized;
    type Diff: std::fmt::Debug + Default + Clone + Hash + Eq;
    // more types and methods
}

and a why to keep references to the state:

pub struct StateDiffRef<'a, D: Domain> {
    pub initial_state: &'a D::State,
    pub diff: &'a D::Diff,
}

In a user-defined domain, I have another state:

pub trait State {
    fn get_tile(&self, x: isize, y: isize) -> Option<Tile>;
    // more methods
}

and I implement the MCTS state:

struct Lumberjacks;
pub struct WorldLocalState {
    // members
}
pub struct WorldDiff {
    // members
}
impl Domain for Lumberjacks {
    type State = WorldLocalState;
    type Diff = WorldDiff;
    // more types and methods
}

When I implement this user state for my struct StateDiffRef the ICE happens:

impl State for StateDiffRef<'_, Lumberjacks> {
    // even with no code here ICE happens
}

Meta

rustc --version --verbose:

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/compiler/rustc_hir/src/definitions.rs:452:14
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
   2: core::panicking::panic
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:50:5
   3: <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id
   4: rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::LocalDefId>::recover
   5: rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node
   6: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   7: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
   9: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
  10: rustc_query_system::query::plumbing::ensure_must_run
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::coherent_trait
  12: rustc_session::session::Session::track_errors
  13: rustc_typeck::check_crate
  14: rustc_interface::passes::analysis
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  16: rustc_data_structures::stack::ensure_sufficient_stack
  17: rustc_query_system::query::plumbing::try_execute_query
  18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  19: rustc_interface::passes::QueryContext::enter
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  21: rustc_span::with_source_map
  22: scoped_tls::ScopedKey<T>::set

@stephanemagnenat stephanemagnenat 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 Dec 14, 2021
@Aaron1011
Copy link
Member

This is a known issue: see #91696 (comment)

@stephanemagnenat
Copy link
Author

Yes it looks to be that one. Sorry for not seeing it. Thank you for the fast answer! Is there a way to properly close as duplicates?

@Aaron1011
Copy link
Member

I've been leaving these kinds of issues open for now, since I'm not 100% sure that they all have the same root cause.

@BGR360
Copy link
Contributor

BGR360 commented Dec 21, 2021

@rustbot label +A-incr-comp

@rustbot rustbot added the A-incr-comp Area: Incremental compilation label Dec 21, 2021
@workingjubilee
Copy link
Member

I'm pretty sure you were right, Aaron. Closing as a duplicate.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-incr-comp Area: Incremental compilation 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

5 participants