Skip to content

ICE: 'is_trivially_sized' applied to unexpected type #114872

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(non_lifetime_binders)]

pub fn non_lifetime_binders()
where
    for<V> V: Sized,
{
    foo();
}

pub fn foo()
where
    for<V> V: Sized,
{
}

pub fn main() {}

Meta

rustc --version --verbose:

<version>

Error output

<output>
Backtrace

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> 8BADA2EFE1A11E43FBD02C82C65B5244C97B4D07A0AD828400AC2E5B9329F751.rs:1:12
  |
1 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2835:17: `is_trivially_sized` applied to unexpected type: V

thread 'rustc' panicked at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/compiler/rustc_errors/src/lib.rs:1635:9:
Box<dyn Any>
stack backtrace:
   0:     0x7fab9411945c - std::backtrace_rs::backtrace::libunwind::trace::h7e24895661a074cd
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fab9411945c - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ae92fabb42b15c
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fab9411945c - std::sys_common::backtrace::_print_fmt::h11ded4f8f5b0329f
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fab9411945c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc90f9f5ac29432d5
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fab9417f5ac - core::fmt::rt::Argument::fmt::h4c20a05991cc3745
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/core/src/fmt/rt.rs:138:9
   5:     0x7fab9417f5ac - core::fmt::write::h9a84aabb8cd6953f
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fab9410bdfe - std::io::Write::write_fmt::h23a1fdb70e60ca96
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/io/mod.rs:1714:15
   7:     0x7fab94119244 - std::sys_common::backtrace::_print::h93f5a4ced68361a5
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fab94119244 - std::sys_common::backtrace::print::h8c8b1e3e278d8649
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fab9411c33a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h25dd3773dffd1d00
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/panicking.rs:278:22
  10:     0x7fab9411c027 - std::panicking::panic_hook_with_disk_dump::ha01b0d9be84d4dd7
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/panicking.rs:312:9
  11:     0x7fab92f5d999 - rustc_driver_impl[3c7dc59cb046a4dd]::install_ice_hook::{closure#0}
  12:     0x7fab9411cbe0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2e0697fdfbf35585
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/alloc/src/boxed.rs:2021:9
  13:     0x7fab9411cbe0 - std::panicking::rust_panic_with_hook::h6f0de6ca2daef081
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/panicking.rs:733:13
  14:     0x7fab934d3661 - std[590ec69203f6bd62]::panicking::begin_panic::<rustc_errors[615d1ee814c5996f]::ExplicitBug>::{closure#0}
  15:     0x7fab934d1ad6 - std[590ec69203f6bd62]::sys_common::backtrace::__rust_end_short_backtrace::<std[590ec69203f6bd62]::panicking::begin_panic<rustc_errors[615d1ee814c5996f]::ExplicitBug>::{closure#0}, !>
  16:     0x7fab93442a86 - std[590ec69203f6bd62]::panicking::begin_panic::<rustc_errors[615d1ee814c5996f]::ExplicitBug>
  17:     0x7fab934b7f14 - <rustc_errors[615d1ee814c5996f]::HandlerInner>::bug::<alloc[bbc2534da1f72b7e]::string::String>
  18:     0x7fab934b7da6 - <rustc_errors[615d1ee814c5996f]::Handler>::bug::<alloc[bbc2534da1f72b7e]::string::String>
  19:     0x7fab93525a3c - rustc_middle[312d8f8c3503f059]::util::bug::opt_span_bug_fmt::<rustc_span[f7e3d02a9c43aa24]::span_encoding::Span>::{closure#0}
  20:     0x7fab9352586a - rustc_middle[312d8f8c3503f059]::ty::context::tls::with_opt::<rustc_middle[312d8f8c3503f059]::util::bug::opt_span_bug_fmt<rustc_span[f7e3d02a9c43aa24]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fab93525838 - rustc_middle[312d8f8c3503f059]::ty::context::tls::with_context_opt::<rustc_middle[312d8f8c3503f059]::ty::context::tls::with_opt<rustc_middle[312d8f8c3503f059]::util::bug::opt_span_bug_fmt<rustc_span[f7e3d02a9c43aa24]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fab91772370 - rustc_middle[312d8f8c3503f059]::util::bug::bug_fmt
  23:     0x7fab9103ce37 - <rustc_middle[312d8f8c3503f059]::ty::Ty>::is_trivially_sized
  24:     0x7fab92148e9b - <rustc_middle[312d8f8c3503f059]::ty::ParamEnvAnd<rustc_middle[312d8f8c3503f059]::traits::query::type_op::ProvePredicate> as rustc_trait_selection[1eabeee33a6be0d5]::traits::query::type_op::TypeOp>::fully_perform
  25:     0x7fab91dfd317 - <rustc_borrowck[2d1b62fc948ef02b]::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates
  26:     0x7fab91dfdfc4 - <rustc_borrowck[2d1b62fc948ef02b]::type_check::TypeVerifier as rustc_middle[312d8f8c3503f059]::mir::visit::Visitor>::visit_constant
  27:     0x7fab91de735a - <rustc_borrowck[2d1b62fc948ef02b]::type_check::TypeVerifier as rustc_middle[312d8f8c3503f059]::mir::visit::Visitor>::visit_body
  28:     0x7fab91d7a557 - rustc_borrowck[2d1b62fc948ef02b]::type_check::type_check
  29:     0x7fab91d63a3b - rustc_borrowck[2d1b62fc948ef02b]::nll::compute_regions
  30:     0x7fab91d47032 - rustc_borrowck[2d1b62fc948ef02b]::do_mir_borrowck
  31:     0x7fab91d45275 - rustc_borrowck[2d1b62fc948ef02b]::mir_borrowck
  32:     0x7fab9103bd0e - rustc_query_impl[6f335a6ac689f3cc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f335a6ac689f3cc]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[312d8f8c3503f059]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7fab9103bcde - <rustc_query_impl[6f335a6ac689f3cc]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[82106fbad00a9fec]::ops::function::FnOnce<(rustc_middle[312d8f8c3503f059]::ty::context::TyCtxt, rustc_span[f7e3d02a9c43aa24]::def_id::LocalDefId)>>::call_once
  34:     0x7fab91133b9d - rustc_query_system[c7dced7d5402288e]::query::plumbing::try_execute_query::<rustc_query_impl[6f335a6ac689f3cc]::DynamicConfig<rustc_query_system[c7dced7d5402288e]::query::caches::VecCache<rustc_span[f7e3d02a9c43aa24]::def_id::LocalDefId, rustc_middle[312d8f8c3503f059]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[6f335a6ac689f3cc]::plumbing::QueryCtxt, false>
  35:     0x7fab928d626f - rustc_query_impl[6f335a6ac689f3cc]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fab924852a6 - <rustc_session[de015b59d59f550c]::session::Session>::time::<(), rustc_interface[748212428c5afc91]::passes::analysis::{closure#1}>
  37:     0x7fab92484a3e - rustc_interface[748212428c5afc91]::passes::analysis
  38:     0x7fab9246d38a - rustc_query_impl[6f335a6ac689f3cc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f335a6ac689f3cc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[312d8f8c3503f059]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7fab9246d379 - <rustc_query_impl[6f335a6ac689f3cc]::query_impl::analysis::dynamic_query::{closure#2} as core[82106fbad00a9fec]::ops::function::FnOnce<(rustc_middle[312d8f8c3503f059]::ty::context::TyCtxt, ())>>::call_once
  40:     0x7fab9260ac68 - rustc_query_system[c7dced7d5402288e]::query::plumbing::try_execute_query::<rustc_query_impl[6f335a6ac689f3cc]::DynamicConfig<rustc_query_system[c7dced7d5402288e]::query::caches::SingleCache<rustc_middle[312d8f8c3503f059]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6f335a6ac689f3cc]::plumbing::QueryCtxt, false>
  41:     0x7fab9260a9f7 - rustc_query_impl[6f335a6ac689f3cc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7fab92260806 - <rustc_middle[312d8f8c3503f059]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[3c7dc59cb046a4dd]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>
  43:     0x7fab9225fc4d - <rustc_interface[748212428c5afc91]::interface::Compiler>::enter::<rustc_driver_impl[3c7dc59cb046a4dd]::run_compiler::{closure#1}::{closure#2}, core[82106fbad00a9fec]::result::Result<core[82106fbad00a9fec]::option::Option<rustc_interface[748212428c5afc91]::queries::Linker>, rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>
  44:     0x7fab9225cf68 - std[590ec69203f6bd62]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[748212428c5afc91]::util::run_in_thread_pool_with_globals<rustc_interface[748212428c5afc91]::interface::run_compiler<core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>, rustc_driver_impl[3c7dc59cb046a4dd]::run_compiler::{closure#1}>::{closure#0}, core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>
  45:     0x7fab927ca3f5 - <<std[590ec69203f6bd62]::thread::Builder>::spawn_unchecked_<rustc_interface[748212428c5afc91]::util::run_in_thread_pool_with_globals<rustc_interface[748212428c5afc91]::interface::run_compiler<core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>, rustc_driver_impl[3c7dc59cb046a4dd]::run_compiler::{closure#1}>::{closure#0}, core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[82106fbad00a9fec]::result::Result<(), rustc_span[f7e3d02a9c43aa24]::ErrorGuaranteed>>::{closure#1} as core[82106fbad00a9fec]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7fab941273d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h80ba6ed11f012e27
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/alloc/src/boxed.rs:2007:9
  47:     0x7fab941273d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h11cf951844702c6f
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/alloc/src/boxed.rs:2007:9
  48:     0x7fab941273d5 - std::sys::unix::thread::Thread::new::thread_start::h0b8dcfbdc24063c5
                               at /rustc/c57393e4f8b88444fbf0985a81a2d662862f2733/library/std/src/sys/unix/thread.rs:108:17
  49:     0x7fab8fa8c9eb - <unknown>
  50:     0x7fab8fb10ebc - <unknown>
  51:                0x0 - <unknown>

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 attach the file at `/tmp/f/rustc-ice-2023-08-15T22:43:39.585183257Z-3846529.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
#0 [mir_borrowck] borrow-checking `non_lifetime_binders`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-non_lifetime_binders`#![feature(non_lifetime_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions