Skip to content

ICE: has escaping bound vars, so it cannot be wrapped in a dummy binder #129983

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait T {}

struct S;

type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &T);

original:

#![feature(impl_trait_in_assoc_type, inherent_associated_types)]

extern "rust-cold" fn fu() {} //~ ERROR rust-cold is experimental

trait T {
    extern "cdedl" fn mu(); //~ ERROR cannot divide `f64` by `{integer}`
    extern "rust-cold" fn dmu(&self, t : TB) {} //~ ERROR rust-cold is experimental
}

struct S;
impl T for S {
    extern "rust-coldb" fn mu() {} //~ ERROR rust-cold is experimental
}

impl S {
     "fn free(#[a1] arg1: u8) { let lam = |#[a2] W(x), #[a3] y| (); }" fn imu() {} //~ ERROR rust-cold is experimental
}

type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &T); //~ ERROR rust-cold is experimental

extern "system" {
        pub fn timeBeginPeriod(uPeriod: c_uint) -> c_uint;
        pub fn timeEndPeriod(uPeriod: c_uint) -> c_uint;
    } //~ ERROR rust-cold is experimental

Version information

rustc 1.83.0-nightly (009e73825 2024-09-04)
binary: rustc
commit-hash: 009e73825af0e59ad4fc603562e038b3dbd6593a
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: C-cmse-nonsecure-call ABI is experimental and subject to change
 --> /tmp/icemaker_global_tempdir.QbKK6zP6Bs8A/rustc_testrunner_tmpdir_reporting.NELJf8GS6Zem/mvce.rs:5:19
  |
5 | type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &T);
  |                   ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #81391 <https://github.com/rust-lang/rust/issues/81391> for more information
  = help: add `#![feature(abi_c_cmse_nonsecure_call)]` to the crate attributes to enable
  = note: this compiler was built on 2024-09-04; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.QbKK6zP6Bs8A/rustc_testrunner_tmpdir_reporting.NELJf8GS6Zem/mvce.rs:5:55
  |
5 | type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &T);
  |                                                       ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.QbKK6zP6Bs8A/rustc_testrunner_tmpdir_reporting.NELJf8GS6Zem/mvce.rs`

warning: trait objects without an explicit `dyn` are deprecated
 --> /tmp/icemaker_global_tempdir.QbKK6zP6Bs8A/rustc_testrunner_tmpdir_reporting.NELJf8GS6Zem/mvce.rs:5:52
  |
5 | type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &T);
  |                                                    ^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
  = note: `#[warn(bare_trait_objects)]` on by default
help: if this is an object-safe trait, use `dyn`
  |
5 | type TAU = extern "C-cmse-nonsecure-call" fn(ptr: &dyn T);
  |                                                    +++

thread 'rustc' panicked at compiler/rustc_middle/src/ty/predicate.rs:527:9:
`<dyn T as std::marker::Sized>` has escaping bound vars, so it cannot be wrapped in a dummy binder.
stack backtrace:
   0:     0x733ddf5d397a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h655be452a099364c
   1:     0x733ddfe03317 - core::fmt::write::h259336a8850c9d71
   2:     0x733de1090e51 - std::io::Write::write_fmt::h3133ee0b19943aad
   3:     0x733ddf5d37d2 - std::sys::backtrace::BacktraceLock::print::h1f2aeae84e4a9898
   4:     0x733ddf5d5cf1 - std::panicking::default_hook::{{closure}}::h9baf516a3ee39bdc
   5:     0x733ddf5d5b24 - std::panicking::default_hook::h8c4880d414aec22c
   6:     0x733dde73b2af - std[95d99f9d9d4b068c]::panicking::update_hook::<alloc[706b881fb9e69861]::boxed::Box<rustc_driver_impl[35712fbc52d8a88b]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x733ddf5d6418 - std::panicking::rust_panic_with_hook::hcffea22880359560
   8:     0x733ddf5d61e7 - std::panicking::begin_panic_handler::{{closure}}::h4febe3c81181a7d7
   9:     0x733ddf5d3e29 - std::sys::backtrace::__rust_end_short_backtrace::hddc5bc819de85a55
  10:     0x733ddf5d5eb4 - rust_begin_unwind
  11:     0x733ddc49f913 - core::panicking::panic_fmt::h2027e4b590082304
  12:     0x733de033f894 - rustc_ty_utils[5d06497ea9af2358]::common_traits::is_item_raw
  13:     0x733de033ee6a - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::is_sized_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>
  14:     0x733de0218d9a - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::DefaultCache<rustc_middle[a9b3a2d49a489b2]::ty::ParamEnvAnd<rustc_middle[a9b3a2d49a489b2]::ty::Ty>, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  15:     0x733de021890e - rustc_query_impl[438421dc19ca3989]::query_impl::is_sized_raw::get_query_non_incr::__rust_end_short_backtrace
  16:     0x733de081d138 - rustc_ty_utils[5d06497ea9af2358]::layout::layout_of_uncached
  17:     0x733de0819b46 - rustc_ty_utils[5d06497ea9af2358]::layout::layout_of
  18:     0x733de0819ad1 - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 16usize]>>
  19:     0x733de0818d53 - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::DefaultCache<rustc_middle[a9b3a2d49a489b2]::ty::ParamEnvAnd<rustc_middle[a9b3a2d49a489b2]::ty::Ty>, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  20:     0x733de08189ed - rustc_query_impl[438421dc19ca3989]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  21:     0x733de0ce04ee - rustc_middle[a9b3a2d49a489b2]::query::plumbing::query_get_at::<rustc_query_system[f860fb3465d60afb]::query::caches::DefaultCache<rustc_middle[a9b3a2d49a489b2]::ty::ParamEnvAnd<rustc_middle[a9b3a2d49a489b2]::ty::Ty>, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 16usize]>>>
  22:     0x733de05a2a95 - <dyn rustc_hir_analysis[de49df145fe3b408]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  23:     0x733de05a8a4b - <dyn rustc_hir_analysis[de49df145fe3b408]::hir_ty_lowering::HirTyLowerer>::lower_ty
  24:     0x733ddd46f27c - rustc_hir_analysis[de49df145fe3b408]::collect::type_of::type_of
  25:     0x733ddfe2a0b0 - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 8usize]>>
  26:     0x733ddfe28d72 - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::DefIdCache<rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  27:     0x733ddfe28927 - rustc_query_impl[438421dc19ca3989]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  28:     0x733de033ac8f - <rustc_hir_analysis[de49df145fe3b408]::collect::CollectItemTypesVisitor as rustc_hir[b892a156f6355c9b]::intravisit::Visitor>::visit_item
  29:     0x733ddd44eac6 - rustc_hir_analysis[de49df145fe3b408]::check::wfcheck::check_well_formed
  30:     0x733de020ec27 - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>
  31:     0x733de020eeb4 - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::VecCache<rustc_hir[b892a156f6355c9b]::hir_id::OwnerId, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  32:     0x733de020ec06 - rustc_query_impl[438421dc19ca3989]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  33:     0x733de020f9d7 - rustc_hir_analysis[de49df145fe3b408]::check::wfcheck::check_mod_type_wf
  34:     0x733de020f815 - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>
  35:     0x733de092b3bb - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::DefaultCache<rustc_span[f8ed943aad6997fa]::def_id::LocalModDefId, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  36:     0x733de092b16d - rustc_query_impl[438421dc19ca3989]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  37:     0x733de061333d - rustc_hir_analysis[de49df145fe3b408]::check_crate
  38:     0x733de0846abf - rustc_interface[8676be05d717364a]::passes::run_required_analyses
  39:     0x733de083fade - rustc_interface[8676be05d717364a]::passes::analysis
  40:     0x733de083fab1 - rustc_query_impl[438421dc19ca3989]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[438421dc19ca3989]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>
  41:     0x733de0d6772e - rustc_query_system[f860fb3465d60afb]::query::plumbing::try_execute_query::<rustc_query_impl[438421dc19ca3989]::DynamicConfig<rustc_query_system[f860fb3465d60afb]::query::caches::SingleCache<rustc_middle[a9b3a2d49a489b2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[438421dc19ca3989]::plumbing::QueryCtxt, false>
  42:     0x733de0d6748f - rustc_query_impl[438421dc19ca3989]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  43:     0x733de0bbb0fa - rustc_interface[8676be05d717364a]::interface::run_compiler::<core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>, rustc_driver_impl[35712fbc52d8a88b]::run_compiler::{closure#0}>::{closure#1}
  44:     0x733de0c6a990 - std[95d99f9d9d4b068c]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8676be05d717364a]::util::run_in_thread_with_globals<rustc_interface[8676be05d717364a]::util::run_in_thread_pool_with_globals<rustc_interface[8676be05d717364a]::interface::run_compiler<core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>, rustc_driver_impl[35712fbc52d8a88b]::run_compiler::{closure#0}>::{closure#1}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>::{closure#0}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>
  45:     0x733de0c6affa - <<std[95d99f9d9d4b068c]::thread::Builder>::spawn_unchecked_<rustc_interface[8676be05d717364a]::util::run_in_thread_with_globals<rustc_interface[8676be05d717364a]::util::run_in_thread_pool_with_globals<rustc_interface[8676be05d717364a]::interface::run_compiler<core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>, rustc_driver_impl[35712fbc52d8a88b]::run_compiler::{closure#0}>::{closure#1}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>::{closure#0}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9432c172c3026e8]::result::Result<(), rustc_span[f8ed943aad6997fa]::ErrorGuaranteed>>::{closure#1} as core[9432c172c3026e8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x733de0c6b3eb - std::sys::pal::unix::thread::Thread::new::thread_start::h367e71472f434e13
  47:     0x733de23be39d - <unknown>
  48:     0x733de244349c - <unknown>
  49:                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: rustc 1.83.0-nightly (009e73825 2024-09-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [is_sized_raw] computing whether `dyn T` is `Sized`
#1 [layout_of] computing layout of `&dyn T`
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

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

@rustbot label +F-impl_trait_in_assoc_type +F-inherent_associated_types

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-abi_c_cmse_nonsecure_call`#![feature(abi_c_cmse_nonsecure_call)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions