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: Unsafe binder types: Unimplemented #137705

Closed
matthiaskrgr opened this issue Feb 27, 2025 · 0 comments · Fixed by #137770
Closed

ICE: Unsafe binder types: Unimplemented #137705

matthiaskrgr opened this issue Feb 27, 2025 · 0 comments · Fixed by #137770
Assignees
Labels
C-bug Category: This is a bug. F-unsafe_binders `#![feature(unsafe_binders)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-incomplete-features This issue requires the use of incomplete features. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

crashes on stable as well

struct A {
  b: unsafe<>()
}
impl A {
  fn c() {
    A {}
  }
}

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (00f245915 2025-02-26)
binary: rustc
commit-hash: 00f245915b0c7839d42c26f9628220c4f1b93bf6
commit-date: 2025-02-26
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

error[E0658]: unsafe binder types are experimental
 --> a.rs:2:6
  |
2 |   b: unsafe<>()
  |      ^^^^^^^^^^
  |
  = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
  = help: add `#![feature(unsafe_binders)]` to the crate attributes to enable
  = note: this compiler was built on 2025-02-26; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `a`
 --> a.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `a.rs`

error[E0063]: missing field `b` in initializer of `A`
 --> a.rs:6:5
  |
6 |     A {}
  |     ^ missing `b`

Backtrace

thread 'rustc' panicked at compiler/rustc_ty_utils/src/ty.rs:40:28:
not yet implemented
stack backtrace:
   0:     0x772c745c4ac4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf5f9bba251506256
   1:     0x772c74e166ec - core::fmt::write::h6b85c82de70b7598
   2:     0x772c75e96291 - std::io::Write::write_fmt::h2528afb58ed912d8
   3:     0x772c745c4922 - std::sys::backtrace::BacktraceLock::print::h260dc8c239dad99b
   4:     0x772c745c715e - std::panicking::default_hook::{{closure}}::h112b7744a5445b18
   5:     0x772c745c6d34 - std::panicking::default_hook::h8eba92c350f78920
   6:     0x772c73723bb7 - std[63ccf99907648090]::panicking::update_hook::<alloc[40f330a4b1dfe34e]::boxed::Box<rustc_driver_impl[44d86c3fd4736e11]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x772c745c79d3 - std::panicking::rust_panic_with_hook::hc531b406179c95b0
   8:     0x772c745c7696 - std::panicking::begin_panic_handler::{{closure}}::hcdc071f581557557
   9:     0x772c745c4f89 - std::sys::backtrace::__rust_end_short_backtrace::h0fbed5a87d7f358d
  10:     0x772c745c738d - rust_begin_unwind
  11:     0x772c71259d50 - core::panicking::panic_fmt::h459d961e1d0721af
  12:     0x772c71c07cfc - core::panicking::panic::h5c546bff560aff35
  13:     0x772c767a5832 - rustc_ty_utils[9eb7a3d45272fa1]::ty::sized_constraint_for_ty.cold
  14:     0x772c756b4aac - rustc_ty_utils[9eb7a3d45272fa1]::ty::adt_sized_constraint
  15:     0x772c756b4a09 - rustc_query_impl[14741ea0e0b48805]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[14741ea0e0b48805]::query_impl::adt_sized_constraint::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 8usize]>>
  16:     0x772c74f3ed32 - rustc_query_system[964dfde9a4346c01]::query::plumbing::try_execute_query::<rustc_query_impl[14741ea0e0b48805]::DynamicConfig<rustc_query_system[964dfde9a4346c01]::query::caches::DefIdCache<rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[14741ea0e0b48805]::plumbing::QueryCtxt, false>
  17:     0x772c757f12de - rustc_query_impl[14741ea0e0b48805]::query_impl::adt_sized_constraint::get_query_non_incr::__rust_end_short_backtrace
  18:     0x772c757f0a54 - rustc_middle[fe836999645634e1]::query::plumbing::query_get_at::<rustc_query_system[964dfde9a4346c01]::query::caches::DefIdCache<rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 8usize]>>>
  19:     0x772c75e6899a - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::assemble_candidates
  20:     0x772c74f73a47 - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}
  21:     0x772c74f6d039 - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  22:     0x772c74f6b959 - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::evaluate_predicate_recursively
  23:     0x772c74f6de6f - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  24:     0x772c74f7f0ca - <rustc_trait_selection[cd372552e19510e3]::traits::select::SelectionContext>::evaluate_root_obligation
  25:     0x772c74f7d87e - rustc_traits[af874b8370063dd9]::evaluate_obligation::evaluate_obligation
  26:     0x772c74f7d369 - rustc_query_impl[14741ea0e0b48805]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[14741ea0e0b48805]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 2usize]>>
  27:     0x772c74f7c7c8 - rustc_query_system[964dfde9a4346c01]::query::plumbing::try_execute_query::<rustc_query_impl[14741ea0e0b48805]::DynamicConfig<rustc_query_system[964dfde9a4346c01]::query::caches::DefaultCache<rustc_type_ir[82ba529ce6c8f4bf]::canonical::CanonicalQueryInput<rustc_middle[fe836999645634e1]::ty::context::TyCtxt, rustc_middle[fe836999645634e1]::ty::ParamEnvAnd<rustc_middle[fe836999645634e1]::ty::predicate::Predicate>>, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[14741ea0e0b48805]::plumbing::QueryCtxt, false>
  28:     0x772c74f7c3de - rustc_query_impl[14741ea0e0b48805]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
  29:     0x772c7529b5d4 - <rustc_infer[a87ff89fafd98458]::infer::InferCtxt as rustc_trait_selection[cd372552e19510e3]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  30:     0x772c73a467bc - <rustc_hir_typeck[97f398f206835c2f]::fn_ctxt::FnCtxt>::suggest_into
  31:     0x772c73a0439b - <rustc_hir_typeck[97f398f206835c2f]::fn_ctxt::FnCtxt>::emit_type_mismatch_suggestions
  32:     0x772c73a062e1 - <rustc_hir_typeck[97f398f206835c2f]::fn_ctxt::FnCtxt>::emit_coerce_suggestions
  33:     0x772c75cf1013 - <rustc_hir_typeck[97f398f206835c2f]::fn_ctxt::FnCtxt>::check_expr_block
  34:     0x772c75cf563c - <rustc_hir_typeck[97f398f206835c2f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:     0x772c751e9309 - rustc_hir_typeck[97f398f206835c2f]::check::check_fn
  36:     0x772c751dc46a - rustc_hir_typeck[97f398f206835c2f]::typeck_with_inspect::{closure#0}
  37:     0x772c751dba70 - rustc_query_impl[14741ea0e0b48805]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[14741ea0e0b48805]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 8usize]>>
  38:     0x772c7527d34c - rustc_query_system[964dfde9a4346c01]::query::plumbing::try_execute_query::<rustc_query_impl[14741ea0e0b48805]::DynamicConfig<rustc_data_structures[370e96b114838f77]::vec_cache::VecCache<rustc_span[d695c239c1f6fe20]::def_id::LocalDefId, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[964dfde9a4346c01]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[14741ea0e0b48805]::plumbing::QueryCtxt, false>
  39:     0x772c7527c3dc - rustc_query_impl[14741ea0e0b48805]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  40:     0x772c7527c07f - <rustc_middle[fe836999645634e1]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[5392223966627bd9]::check_crate::{closure#3}>::{closure#0}
  41:     0x772c7527b6f9 - rustc_hir_analysis[5392223966627bd9]::check_crate
  42:     0x772c7527592a - rustc_interface[e696fb279c73d43f]::passes::run_required_analyses
  43:     0x772c75e9223a - rustc_interface[e696fb279c73d43f]::passes::analysis
  44:     0x772c75e92219 - rustc_query_impl[14741ea0e0b48805]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[14741ea0e0b48805]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 0usize]>>
  45:     0x772c75ee794b - rustc_query_system[964dfde9a4346c01]::query::plumbing::try_execute_query::<rustc_query_impl[14741ea0e0b48805]::DynamicConfig<rustc_query_system[964dfde9a4346c01]::query::caches::SingleCache<rustc_middle[fe836999645634e1]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[14741ea0e0b48805]::plumbing::QueryCtxt, false>
  46:     0x772c75ee7639 - rustc_query_impl[14741ea0e0b48805]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x772c75f3777c - rustc_interface[e696fb279c73d43f]::passes::create_and_enter_global_ctxt::<core[e205c6c2c408574d]::option::Option<rustc_interface[e696fb279c73d43f]::queries::Linker>, rustc_driver_impl[44d86c3fd4736e11]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  48:     0x772c75f282e0 - rustc_interface[e696fb279c73d43f]::interface::run_compiler::<(), rustc_driver_impl[44d86c3fd4736e11]::run_compiler::{closure#0}>::{closure#1}
  49:     0x772c75daedc8 - std[63ccf99907648090]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e696fb279c73d43f]::util::run_in_thread_with_globals<rustc_interface[e696fb279c73d43f]::util::run_in_thread_pool_with_globals<rustc_interface[e696fb279c73d43f]::interface::run_compiler<(), rustc_driver_impl[44d86c3fd4736e11]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  50:     0x772c75daf574 - <<std[63ccf99907648090]::thread::Builder>::spawn_unchecked_<rustc_interface[e696fb279c73d43f]::util::run_in_thread_with_globals<rustc_interface[e696fb279c73d43f]::util::run_in_thread_pool_with_globals<rustc_interface[e696fb279c73d43f]::interface::run_compiler<(), rustc_driver_impl[44d86c3fd4736e11]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e205c6c2c408574d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x772c75db0a6f - std::sys::pal::unix::thread::Thread::new::thread_start::h8f2a48bb719a6902
  52:     0x772c6fea370a - <unknown>
  53:     0x772c6ff27aac - <unknown>
  54:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2025-02-27T07_13_07-1226708.txt` to your bug report

query stack during panic:
#0 [adt_sized_constraint] computing the `Sized` constraint for `A`
#1 [evaluate_obligation] evaluating trait selection obligation `A: core::convert::Into<()>`
... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 3 previous errors

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

@matthiaskrgr matthiaskrgr 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 Feb 27, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 27, 2025
@fmease fmease changed the title ICE: unimplemented with with unsafe struct field ICE: Unsafe binder types: Unimplemented Feb 27, 2025
@fmease fmease added P-low Low priority requires-incomplete-features This issue requires the use of incomplete features. F-unsafe_binders `#![feature(unsafe_binders)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 27, 2025
@compiler-errors compiler-errors self-assigned this Feb 27, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 28, 2025
…d-crit, r=oli-obk

Fix sized constraint for unsafe binder

Fixes rust-lang#137705
r? oli-obk
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 28, 2025
…d-crit, r=oli-obk

Fix sized constraint for unsafe binder

Fixes rust-lang#137705
r? oli-obk
@bors bors closed this as completed in 0cb9827 Mar 1, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 1, 2025
Rollup merge of rust-lang#137770 - compiler-errors:unsafe-binder-sized-crit, r=oli-obk

Fix sized constraint for unsafe binder

Fixes rust-lang#137705
r? oli-obk
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. F-unsafe_binders `#![feature(unsafe_binders)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-incomplete-features This issue requires the use of incomplete features. 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.

4 participants