Skip to content

rustc crash with type alias of impl trait #63677

Closed
@shootingsyh

Description

@shootingsyh

I cannot provide a simple repro yet. But what I did is mostly define a type alias of an impl trait and use it as generic parameter of another type. And here is the stack trace

error: internal compiler error: src/librustc/traits/coherence.rs:523: ty_is_local invoked on unexpected type: TimerStream

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
stack backtrace:
   0:        0x1106295e2 - std::panicking::default_hook::{{closure}}::hab1ab34f1ce96caa
   1:        0x1106292ad - std::panicking::default_hook::h64b790c24fa7fc49
   2:        0x10f34ca03 - rustc::util::common::panic_hook::h5f0c42b9b5f5c860
   3:        0x110629ea1 - std::panicking::rust_panic_with_hook::hb4f2ed402a5c2512
   4:        0x10f6fef51 - std::panicking::begin_panic::hc70c89798bac02e9
   5:        0x10f718a1e - rustc_errors::Handler::bug::h5baeb98a8a0678a0
   6:        0x10f03e62b - rustc::util::bug::opt_span_bug_fmt::{{closure}}::h6d481064c64d9070
   7:        0x10f038d46 - rustc::ty::context::tls::with_opt::{{closure}}::heed197f8ba0676ae
   8:        0x10f038514 - rustc::ty::context::tls::with_context_opt::hec55cd2ecdfd7b1e
   9:        0x10f038542 - rustc::ty::context::tls::with_opt::hcb84b0e0c6e44f43
  10:        0x10f03e548 - rustc::util::bug::opt_span_bug_fmt::h36d0f65a1fdc8719
  11:        0x10f03e49b - rustc::util::bug::bug_fmt::h82ba15a6bd0a15f1
  12:        0x10f01420a - rustc::traits::coherence::ty_is_local_constructor::h114dccfe228be3db
  13:        0x10f013f6d - rustc::traits::coherence::ty_is_local::hebc4f08163a8f32c
  14:        0x10f0139cb - rustc::traits::coherence::orphan_check_trait_ref::ha29c20ab5632e1a2
  15:        0x10f0135e2 - rustc::traits::coherence::trait_ref_is_knowable::he4651b1a389892b5
  16:        0x10f3295a7 - rustc::traits::select::SelectionContext::candidate_from_obligation_no_cache::hef619078f305ea6c
  17:        0x10ee02e33 - rustc::dep_graph::graph::DepGraph::with_anon_task::h9c7fbd897a8b74af
  18:        0x10f329039 - rustc::traits::select::SelectionContext::candidate_from_obligation::h91204ae0cd40ca57
  19:        0x10f32838d - rustc::traits::select::SelectionContext::evaluate_stack::hdccb6e4735e69c64
  20:        0x10ee02a9b - rustc::dep_graph::graph::DepGraph::with_anon_task::h1983365f787ed581
  21:        0x10f326dac - rustc::traits::select::SelectionContext::evaluate_predicate_recursively::hbbad24ee512cbcfa
  22:        0x10f3259e3 - rustc::traits::select::SelectionContext::evaluate_predicates_recursively::h6b77f200c3916542
  23:        0x10effc467 - rustc::infer::InferCtxt::probe::h46c73949432589d0
  24:        0x10f328420 - rustc::traits::select::SelectionContext::evaluate_stack::hdccb6e4735e69c64
  25:        0x10ee02a9b - rustc::dep_graph::graph::DepGraph::with_anon_task::h1983365f787ed581
  26:        0x10f326dac - rustc::traits::select::SelectionContext::evaluate_predicate_recursively::hbbad24ee512cbcfa
  27:        0x10effd017 - rustc::infer::InferCtxt::probe::h9b9c357204ffa5a5
  28:        0x10f366558 - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hc4c9d32f4ddb802a
  29:        0x10f3014b6 - <core::slice::Iter<T> as core::iter::traits::iterator::Iterator>::try_fold::h08089fe9896ed2ce
  30:        0x10f2cdc11 - <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::try_fold::h15c19b5ccfa88730
  31:        0x10f01300b - rustc::traits::coherence::overlap::hfed74e82ba05c75e
  32:        0x10e266e58 - rustc::ty::context::GlobalCtxt::enter_local::h49b342d271f1b96c
  33:        0x10e2fd172 - rustc::traits::coherence::overlapping_impls::h14e3a1cc484a2e15
  34:        0x10e149785 - <rustc_typeck::coherence::inherent_impls_overlap::InherentOverlapChecker as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::haa87c78d85f603c3
  35:        0x10e148b6b - rustc_typeck::coherence::inherent_impls_overlap::crate_inherent_impls_overlap_check::h5714823a4b6013ef
  36:        0x10e15b342 - rustc::ty::query::__query_compute::crate_inherent_impls_overlap_check::hec25e21ca4400cff
  37:        0x10e19206b - rustc::dep_graph::graph::DepGraph::with_task_impl::hdb035c1d37fe2a13
  38:        0x10e241a26 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hc5bc0d0da4f194ab
  39:        0x10e304300 - rustc_typeck::coherence::check_coherence::he7286af5c662a030
  40:        0x10e15c9ad - rustc::util::common::time::h2a7c97de8a318682
  41:        0x10e30512c - rustc_typeck::check_crate::hd110f4e4742d4bb0
  42:        0x10dcadd12 - rustc_interface::passes::analysis::h3fd78df98efc9ff0
  43:        0x10dbb4bae - rustc::ty::query::__query_compute::analysis::h353a45c1e4e47295
  44:        0x10dbc520b - rustc::dep_graph::graph::DepGraph::with_task_impl::hb88490dc2932c48f
  45:        0x10dbcf865 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h30f3db9b52216656
  46:        0x10dbeb2d7 - rustc::ty::context::tls::enter_global::h2b05f3b892a0fe2a
  47:        0x10dbd530c - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::hef054cc95c28e706
  48:        0x10dd03e5c - rustc_interface::passes::create_global_ctxt::{{closure}}::hc6fa2edd634a5176
  49:        0x10dbd61f4 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h04de03e7b31bec3d
  50:        0x10dc08664 - std::thread::local::LocalKey<T>::with::h6300b72366cd4201
  51:        0x10dc0fa82 - scoped_tls::ScopedKey<T>::set::h95306a0884a1982c
  52:        0x10dc408e5 - syntax::with_globals::ha28675c52e11d2e2
  53:        0x10dbb0e47 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf20192de0d0e5526
  54:        0x11063927f - __rust_maybe_catch_panic
  55:        0x10dbd8b67 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h520e25e0f997e8ef
  56:        0x11060d13e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8743b96d38f43bdd
  57:        0x11063808e - std::sys::unix::thread::Thread::new::thread_start::hf6abe31b14f3b029
  58:     0x7fff711f12eb - _pthread_body
  59:     0x7fff711f4249 - _pthread_start
query stack during panic:
#0 [crate_inherent_impls_overlap_check] check for overlap between inherent impls defined in this crate
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error



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.39.0-nightly (2111aed0a 2019-08-17) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-trait-systemArea: Trait systemA-type-systemArea: Type systemC-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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions