Skip to content

ICE: compiler/rustc_trait_selection/src/traits/coherence.rs:600:13: ty_is_local invoked on unexpected type #83613

Closed
@chengniansun

Description

@chengniansun

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`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions