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

internal error: relating different kinds: jni::objects::JObject<'?14> '?1 #125832

Closed
koutheir opened this issue May 31, 2024 · 3 comments
Closed
Labels
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.

Comments

@koutheir
Copy link
Contributor

koutheir commented May 31, 2024

Code

Compiling the following function causes an internal compiler error:

fn empty_string_array(env: jni::JNIEnv) {
    env.new_object_array(
        0,
        jni::objects::JObject::null(),
        jni::objects::JObject::null()
    );
}

Notice that the code above does not make sense as is, but it is a minimal example that still causes the compiler error.

Meta

rustc --version --verbose:

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

Error output

error: internal compiler error: compiler/rustc_infer/src/infer/at.rs:400:21: relating different kinds: jni::objects::JObject<'?14> '?1
Backtrace

error: internal compiler error: compiler/rustc_infer/src/infer/at.rs:400:21: relating different kinds: jni::objects::JObject<'?14> '?1

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::generic_args::GenericArg as rustc_infer::infer::at::ToTrace>::to_trace
   7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::generic_args::GenericArg>
   8: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_similar_impl_candidates
   9: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::try_to_add_help_message
  10: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
  11: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  12: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_method_argument_types
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19: rustc_hir_typeck::check::check_fn
  20: rustc_hir_typeck::typeck
      [... omitted 1 frame ...]
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  23: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
   Compiling toml v0.8.12
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.78.0 (9b00956e5 2024-04-29) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=17 -C debuginfo=2 -C incremental=[REDACTED] -C linker-plugin-lto -C linker=clang-18 -C link-arg=-fuse-ld=lld-18

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

query stack during panic:
#0 [typeck] type-checking `empty_string_array`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: `proc-macro-support` (lib) generated 2 warnings (run `cargo fix --lib -p proc-macro-support` to apply 2 suggestions)
error: could not compile `proc-macro-support` (lib); 2 warnings emitted

@koutheir koutheir 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 May 31, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 31, 2024
@lqd
Copy link
Member

lqd commented May 31, 2024

Is that using duchess, jni-rs or another jni crate? Do you have a complete example we could look at?

@matthiaskrgr
Copy link
Member

#121134 has a reproducer

@workingjubilee
Copy link
Member

closing as duplicate.

@workingjubilee workingjubilee closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 1, 2024
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. 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

No branches or pull requests

6 participants