rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.1k stars 12.55k forks source link

ICE: compiler/rustc_ty_utils/src/ty.rs:209:14: associated_item_def_ids: not impl or trait #83753

Closed chengniansun closed 3 years ago

chengniansun commented 3 years ago

Code

struct NodeRef {}
impl Handle {
  fn new_kv ( node : NodeRef <Target = >) {}
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (4fdac23f3 2021-03-31)
binary: rustc
commit-hash: 4fdac23f3171e2f8864d359a21da600dd3faafc9
commit-date: 2021-03-31
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error: missing type to the right of `=`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:39
  |
3 |   fn new_kv ( node : NodeRef <Target = >) {}
  |                                       ^
  |
help: to constrain the associated type, add a type after `=`
  |
3 |   fn new_kv ( node : NodeRef <Target = TheType>) {}
  |                                        ^^^^^^^
help: remove the `=` if `Target` is a type
  |
3 |   fn new_kv ( node : NodeRef <Target >) {}
  |                                     --

error[E0412]: cannot find type `Handle` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:6
  |
2 | impl Handle {
  |      ^^^^^^ not found in this scope

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 | / struct NodeRef {}
2 | | impl Handle {
3 | |   fn new_kv ( node : NodeRef <Target = >) {}
4 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error: internal compiler error: compiler/rustc_ty_utils/src/ty.rs:209:14: associated_item_def_ids: not impl or trait
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | struct NodeRef {}
  | ^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/4fdac23f3171e2f8864d359a21da600dd3faafc9/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 (4fdac23f3 2021-03-31) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [associated_item_def_ids] collecting associated items of `NodeRef`
#1 [associated_items] collecting associated items of NodeRef
end of query stack
error: aborting due to 4 previous errors

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

``` error: missing type to the right of `=` --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:39 | 3 | fn new_kv ( node : NodeRef ) {} | ^ | help: to constrain the associated type, add a type after `=` | 3 | fn new_kv ( node : NodeRef ) {} | ^^^^^^^ help: remove the `=` if `Target` is a type | 3 | fn new_kv ( node : NodeRef ) {} | -- error[E0412]: cannot find type `Handle` in this scope --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:6 | 2 | impl Handle { | ^^^^^^ not found in this scope 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 | / struct NodeRef {} 2 | | impl Handle { 3 | | fn new_kv ( node : NodeRef ) {} 4 | | } | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs` error: internal compiler error: compiler/rustc_ty_utils/src/ty.rs:209:14: associated_item_def_ids: not impl or trait --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1 | 1 | struct NodeRef {} | ^^^^^^^^^^^^^^^^^ thread 'rustc' panicked at 'Box', /rustc/4fdac23f3171e2f8864d359a21da600dd3faafc9/library/std/src/panic.rs:59:5 stack backtrace: 0: std::panicking::begin_panic 1: std::panic::panic_any 2: rustc_errors::HandlerInner::span_bug 3: rustc_errors::Handler::span_bug 4: rustc_middle::ty::context::tls::with_opt 5: rustc_middle::util::bug::opt_span_bug_fmt 6: rustc_middle::util::bug::span_bug_fmt 7: rustc_ty_utils::ty::associated_item_def_ids 8: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 9: rustc_data_structures::stack::ensure_sufficient_stack 10: rustc_query_system::query::plumbing::force_query_with_job 11: rustc_query_system::query::plumbing::get_query_impl 12: ::associated_item_def_ids 13: rustc_ty_utils::ty::associated_items 14: rustc_query_impl:: for rustc_query_impl::queries::associated_items>::compute 15: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 16: rustc_data_structures::stack::ensure_sufficient_stack 17: rustc_query_system::query::plumbing::force_query_with_job 18: rustc_query_system::query::plumbing::get_query_impl 19: ::associated_items 20: ::visit_path 21: ::visit_ty 22: rustc_resolve::late::lifetimes::LifetimeContext::visit_fn_like_elision 23: ::visit_fn 24: rustc_hir::intravisit::walk_impl_item 25: ::visit_impl_item 26: rustc_hir::intravisit::walk_item 27: ::visit_item 28: rustc_resolve::late::lifetimes::do_resolve 29: rustc_resolve::late::lifetimes::resolve_lifetimes 30: rustc_query_impl:: for rustc_query_impl::queries::resolve_lifetimes>::compute 31: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 32: rustc_data_structures::stack::ensure_sufficient_stack 33: rustc_query_system::query::plumbing::force_query_with_job 34: rustc_query_system::query::plumbing::get_query_impl 35: ::resolve_lifetimes 36: rustc_resolve::late::lifetimes::resolve_lifetimes_for 37: core::ops::function::FnOnce::call_once 38: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 39: rustc_query_system::query::plumbing::force_query_with_job 40: rustc_query_system::query::plumbing::get_query_impl 41: ::late_bound_vars_map 42: rustc_middle::ty::context::TyCtxt::late_bound_vars 43: ::ty_of_fn 44: rustc_typeck::collect::fn_sig 45: rustc_query_impl:: for rustc_query_impl::queries::fn_sig>::compute 46: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 47: rustc_data_structures::stack::ensure_sufficient_stack 48: rustc_query_system::query::plumbing::force_query_with_job 49: rustc_query_system::query::plumbing::get_query_impl 50: ::fn_sig 51: ::visit_impl_item 52: rustc_middle::hir::map::Map::visit_item_likes_in_module 53: rustc_typeck::collect::collect_mod_item_types 54: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 55: rustc_query_system::query::plumbing::force_query_with_job 56: rustc_query_system::query::plumbing::get_query_impl 57: ::collect_mod_item_types 58: rustc_session::session::Session::track_errors 59: rustc_typeck::check_crate 60: rustc_interface::passes::analysis 61: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 62: rustc_data_structures::stack::ensure_sufficient_stack 63: rustc_query_system::query::plumbing::force_query_with_job 64: rustc_query_system::query::plumbing::get_query_impl 65: ::analysis 66: rustc_interface::passes::QueryContext::enter 67: rustc_interface::queries::::enter 68: rustc_span::with_source_map 69: rustc_interface::interface::create_compiler_and_run 70: scoped_tls::ScopedKey::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 (4fdac23f3 2021-03-31) running on x86_64-unknown-linux-gnu query stack during panic: #0 [associated_item_def_ids] collecting associated items of `NodeRef` #1 [associated_items] collecting associated items of NodeRef #2 [resolve_lifetimes] resolving lifetimes #3 [late_bound_vars_map] looking up late bound vars #4 [fn_sig] computing function signature of `::new_kv` #5 [collect_mod_item_types] collecting item types in top-level module #6 [analysis] running analysis passes on this crate end of query stack error: aborting due to 4 previous errors Some errors have detailed explanations: E0412, E0601. For more information about an error, try `rustc --explain E0412`. ```

JohnTitor commented 3 years ago

Bisected: caused by #76814, cc @jackh726

JohnTitor commented 3 years ago

Slightly simplified (getting rid of unrelated compile errors):

struct Foo {}
impl Foo {
    fn bar(foo: Foo<Target = usize>) {}
}
fn main() {}
apiraino commented 3 years ago

Assigning priority as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@rustbot label -I-prioritize +P-medium