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: panicked at 'assertion failed: !substs.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:1475:9 #83693

Closed
chengniansun opened this issue Mar 30, 2021 · 1 comment · Fixed by #86438
Labels
C-bug Category: This is a bug. 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

impl F {
    fn call() {
        <Self as Fn(&TestResult)>::call
    }
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (48691ea6e 2021-03-29)
binary: rustc
commit-hash: 48691ea6e639640f110b43e33d4aba1f07e7415c
commit-date: 2021-03-29
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error[E0412]: cannot find type `F` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:6
   |
1  |   impl F {
   |        ^ help: a trait with a similar name exists: `Fn`

error[E0412]: cannot find type `TestResult` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:22
  |
3 |         <Self as Fn(&TestResult)>::call
  |                      ^^^^^^^^^^ 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 | / impl F {
2 | |     fn call() {
3 | |         <Self as Fn(&TestResult)>::call
4 | |     }
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0658]: use of unstable library feature 'fn_traits'
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:9
  |
3 |         <Self as Fn(&TestResult)>::call
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(fn_traits)]` to the crate attributes to enable

error[E0229]: associated type bindings are not allowed here
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:18
  |
3 |         <Self as Fn(&TestResult)>::call
  |                  ^^^^^^^^^^^^^^^ associated type not allowed here

thread 'rustc' panicked at 'assertion failed: !substs.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:1475:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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 (48691ea6e 2021-03-29) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1: 5:2>::call`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 5 previous errors

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

error[E0412]: cannot find type `F` in this scope
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:6
   |
1  |   impl F {
   |        ^ help: a trait with a similar name exists: `Fn`

error[E0412]: cannot find type `TestResult` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:22
  |
3 |         <Self as Fn(&TestResult)>::call
  |                      ^^^^^^^^^^ 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 | / impl F {
2 | |     fn call() {
3 | |         <Self as Fn(&TestResult)>::call
4 | |     }
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0658]: use of unstable library feature 'fn_traits'
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:9
  |
3 |         <Self as Fn(&TestResult)>::call
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(fn_traits)]` to the crate attributes to enable

error[E0229]: associated type bindings are not allowed here
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:18
  |
3 |         <Self as Fn(&TestResult)>::call
  |                  ^^^^^^^^^^^^^^^ associated type not allowed here

thread 'rustc' panicked at 'assertion failed: !substs.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:1475:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/48691ea6e639640f110b43e33d4aba1f07e7415c/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/48691ea6e639640f110b43e33d4aba1f07e7415c/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/48691ea6e639640f110b43e33d4aba1f07e7415c/library/core/src/panicking.rs:50:5
   3: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_value_path
   4: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
   5: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
   6: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
   7: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
   8: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
   9: rustc_typeck::check::check::check_fn
  10: rustc_infer::infer::InferCtxtBuilder::enter
  11: rustc_typeck::check::typeck
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  13: rustc_data_structures::stack::ensure_sufficient_stack
  14: rustc_query_system::query::plumbing::force_query_with_job
  15: rustc_query_system::query::plumbing::get_query_impl
  16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  17: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  18: rustc_typeck::check::typeck_item_bodies
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::force_query_with_job
  22: rustc_query_system::query::plumbing::get_query_impl
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  24: rustc_session::utils::<impl rustc_session::session::Session>::time
  25: rustc_typeck::check_crate
  26: rustc_interface::passes::analysis
  27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  28: rustc_data_structures::stack::ensure_sufficient_stack
  29: rustc_query_system::query::plumbing::force_query_with_job
  30: rustc_query_system::query::plumbing::get_query_impl
  31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  32: rustc_interface::passes::QueryContext::enter
  33: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  34: rustc_span::with_source_map
  35: rustc_interface::interface::create_compiler_and_run
  36: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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 (48691ea6e 2021-03-29) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1: 5:2>::call`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

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

@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 30, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 30, 2021

Slightly smaller:

#![feature(fn_traits)]
fn call() {
    <x as Fn(&usize)>::call
}
error[E0412]: cannot find type `x` in this scope
 --> src/lib.rs:3:6
  |
3 |     <x as Fn(&usize)>::call
  |      ^ not found in this scope

error[E0229]: associated type bindings are not allowed here
 --> src/lib.rs:3:11
  |
3 |     <x as Fn(&usize)>::call
  |           ^^^^^^^^^^ associated type not allowed here

thread 'rustc' panicked at 'assertion failed: !substs.has_escaping_bound_vars()', compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:1475:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants