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: compiler/rustc_trait_selection/src/traits/coherence.rs:600:13: ty_is_local invoked on unexpected type #83613

Closed
chengniansun opened this issue Mar 28, 2021 · 0 comments · Fixed by #83954
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

@chengniansun
Copy link

Code

trait OpaqueTrait {}
impl<T> OpaqueTrait for T {}
type OpaqueType = impl OpaqueTrait;
fn mk_opaque() -> OpaqueType {
    || 0
}
trait AnotherTrait {}
impl<T: Send> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (9b0edb7fd 2021-03-27)
binary: rustc
commit-hash: 9b0edb7fddacd6a60a380c1ce59159de597ab270
commit-date: 2021-03-27
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error[E0658]: `impl Trait` in type aliases is unstable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 | type OpaqueType = impl OpaqueTrait;
  |                   ^^^^^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / trait OpaqueTrait {}
2 | | impl<T> OpaqueTrait for T {}
3 | | type OpaqueType = impl OpaqueTrait;
4 | | fn mk_opaque() -> OpaqueType {
... |
8 | | impl<T: Send> AnotherTrait for T {}
9 | | impl AnotherTrait for OpaqueType {}
  | |___________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: internal compiler error: compiler/rustc_trait_selection/src/traits/coherence.rs:600:13: ty_is_local invoked on unexpected type: [closure@perses_node_priority_with_dfs_delta_reduced_mutant.rs:5:5: 5:9]

thread 'rustc' panicked at 'Box<Any>', /rustc/9b0edb7fddacd6a60a380c1ce59159de597ab270/library/std/src/panic.rs:59:5
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.53.0-nightly (9b0edb7fd 2021-03-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `AnotherTrait`
#1 [coherent_trait] coherence checking all impls of trait `AnotherTrait`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.
Backtrace

error[E0658]: `impl Trait` in type aliases is unstable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:19
  |
3 | type OpaqueType = impl OpaqueTrait;
  |                   ^^^^^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / trait OpaqueTrait {}
2 | | impl<T> OpaqueTrait for T {}
3 | | type OpaqueType = impl OpaqueTrait;
4 | | fn mk_opaque() -> OpaqueType {
... |
8 | | impl<T: Send> AnotherTrait for T {}
9 | | impl AnotherTrait for OpaqueType {}
  | |___________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: internal compiler error: compiler/rustc_trait_selection/src/traits/coherence.rs:600:13: ty_is_local invoked on unexpected type: [closure@perses_node_priority_with_dfs_delta_reduced_mutant.rs:5:5: 5:9]

thread 'rustc' panicked at 'Box<Any>', /rustc/9b0edb7fddacd6a60a380c1ce59159de597ab270/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_trait_selection::traits::coherence::ty_is_local_constructor
   8: rustc_trait_selection::traits::coherence::contained_non_local_types
   9: rustc_trait_selection::traits::coherence::orphan_check_trait_ref::uncover_fundamental_ty
  10: rustc_trait_selection::traits::coherence::orphan_check_trait_ref
  11: rustc_trait_selection::traits::coherence::trait_ref_is_knowable
  12: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  14: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation
  15: rustc_trait_selection::traits::select::SelectionContext::evaluate_stack
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  17: rustc_trait_selection::traits::select::SelectionContext::evaluate_trait_predicate_recursively
  18: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively::{{closure}}
  19: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively
  20: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicates_recursively
  21: rustc_infer::infer::InferCtxt::probe
  22: rustc_trait_selection::traits::select::SelectionContext::evaluate_candidate
  23: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  25: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation
  26: rustc_trait_selection::traits::select::SelectionContext::evaluate_stack
  27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  28: rustc_trait_selection::traits::select::SelectionContext::evaluate_trait_predicate_recursively
  29: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively::{{closure}}
  30: rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively
  31: rustc_infer::infer::InferCtxt::probe
  32: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  33: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::try_fold
  34: rustc_trait_selection::traits::coherence::overlap_within_probe
  35: rustc_infer::infer::InferCtxtBuilder::enter
  36: rustc_trait_selection::traits::coherence::overlapping_impls
  37: <rustc_middle::traits::specialization_graph::Children as rustc_trait_selection::traits::specialize::specialization_graph::ChildrenExt>::insert
  38: <rustc_middle::traits::specialization_graph::Graph as rustc_trait_selection::traits::specialize::specialization_graph::GraphExt>::insert
  39: rustc_trait_selection::traits::specialize::specialization_graph_provider
  40: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::specialization_graph_of>::compute
  41: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  42: rustc_data_structures::stack::ensure_sufficient_stack
  43: rustc_query_system::query::plumbing::force_query_with_job
  44: rustc_query_system::query::plumbing::get_query_impl
  45: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::specialization_graph_of
  46: rustc_typeck::coherence::coherent_trait
  47: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  48: rustc_data_structures::stack::ensure_sufficient_stack
  49: rustc_query_system::query::plumbing::force_query_with_job
  50: rustc_query_system::query::plumbing::get_query_impl
  51: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::coherent_trait
  52: rustc_typeck::coherence::check_coherence
  53: rustc_typeck::check_crate
  54: rustc_interface::passes::analysis
  55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  56: rustc_data_structures::stack::ensure_sufficient_stack
  57: rustc_query_system::query::plumbing::force_query_with_job
  58: rustc_query_system::query::plumbing::get_query_impl
  59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  60: rustc_interface::passes::QueryContext::enter
  61: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  62: rustc_span::with_source_map
  63: rustc_interface::interface::create_compiler_and_run
  64: 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.53.0-nightly (9b0edb7fd 2021-03-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `AnotherTrait`
#1 [coherent_trait] coherence checking all impls of trait `AnotherTrait`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

@chengniansun chengniansun 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 Mar 28, 2021
@jonas-schievink jonas-schievink added the F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` label Mar 28, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Apr 2, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 2, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 7, 2021
Do not ICE when closure is involved in Trait Alias Impl Trait

Fix rust-lang#83613.
@bors bors closed this as completed in 18cf44b Apr 7, 2021
@lcnr lcnr assigned lcnr and unassigned lcnr Jan 28, 2022
@oli-obk oli-obk moved this from Todo to Done in type alias impl trait stabilization Sep 9, 2022
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. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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.
Development

Successfully merging a pull request may close this issue.

4 participants