Skip to content

TAIT ICE: failed to resolve instance for <Foo as Into<Foo>>::into #112765

Closed
@Alexendoo

Description

@Alexendoo

Code

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=489cee58a05897d1e0d167b8591622a8

#![feature(type_alias_impl_trait)]

type T = impl Sized;

struct Foo;

impl Into<T> for Foo {
    fn into(self) -> T {
        Foo
    }
}

fn main() {
    let _: T = Foo.into();
}

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/instance.rs:413:18: failed to resolve instance for <Foo as Into<Foo>>::into

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/compiler/rustc_errors/src/lib.rs:1650:9

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.72.0-nightly (3b2073f07 2023-06-17) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `playground` (bin "playground")

Backtrace

stack backtrace:
   0:     0x7f9d25204e11 - std::backtrace_rs::backtrace::libunwind::trace::hd102c46c16771587
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9d25204e11 - std::backtrace_rs::backtrace::trace_unsynchronized::h6545cf7d6ed27551
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9d25204e11 - std::sys_common::backtrace::_print_fmt::h258fac35947dded0
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9d25204e11 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf070a48cb28a24d1
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9d252664bf - core::fmt::rt::Argument::fmt::h0a093c27aabe85c6
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9d252664bf - core::fmt::write::h809e1a6b668324f6
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9d251f7877 - std::io::Write::write_fmt::h2ed31d529426c73c
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/io/mod.rs:1713:15
   7:     0x7f9d25204c25 - std::sys_common::backtrace::_print::h72058f630d074235
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9d25204c25 - std::sys_common::backtrace::print::h71140e0244457266
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9d252079d3 - std::panicking::default_hook::{{closure}}::h4cc812472591f5d0
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/panicking.rs:269:22
  10:     0x7f9d25207764 - std::panicking::default_hook::h63cd13622fb98d85
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/panicking.rs:288:9
  11:     0x7f9d2844a52b - <rustc_driver_impl[2635ae639440f84d]::install_ice_hook::{closure#0} as core[179bd5bdb7674514]::ops::function::FnOnce<(&core[179bd5bdb7674514]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f9d252081fe - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2ecbaa31401232a8
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/alloc/src/boxed.rs:2007:9
  13:     0x7f9d252081fe - std::panicking::rust_panic_with_hook::h521173c88e8eb80d
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/panicking.rs:709:13
  14:     0x7f9d2894f2e1 - std[a820ec68793a1c54]::panicking::begin_panic::<rustc_errors[b597254c8f098bdb]::ExplicitBug>::{closure#0}
  15:     0x7f9d2894df36 - std[a820ec68793a1c54]::sys_common::backtrace::__rust_end_short_backtrace::<std[a820ec68793a1c54]::panicking::begin_panic<rustc_errors[b597254c8f098bdb]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9d289e46f6 - std[a820ec68793a1c54]::panicking::begin_panic::<rustc_errors[b597254c8f098bdb]::ExplicitBug>
  17:     0x7f9d2894ae74 - <rustc_errors[b597254c8f098bdb]::HandlerInner>::bug::<alloc[94daa9e91581ecb7]::string::String>
  18:     0x7f9d2894acf6 - <rustc_errors[b597254c8f098bdb]::Handler>::bug::<alloc[94daa9e91581ecb7]::string::String>
  19:     0x7f9d2899e46c - rustc_middle[2d6135a6a55a92f4]::util::bug::opt_span_bug_fmt::<rustc_span[9ec16770641762ee]::span_encoding::Span>::{closure#0}
  20:     0x7f9d2899b30a - rustc_middle[2d6135a6a55a92f4]::ty::context::tls::with_opt::<rustc_middle[2d6135a6a55a92f4]::util::bug::opt_span_bug_fmt<rustc_span[9ec16770641762ee]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9d2899b2da - rustc_middle[2d6135a6a55a92f4]::ty::context::tls::with_context_opt::<rustc_middle[2d6135a6a55a92f4]::ty::context::tls::with_opt<rustc_middle[2d6135a6a55a92f4]::util::bug::opt_span_bug_fmt<rustc_span[9ec16770641762ee]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9d26781aed - rustc_middle[2d6135a6a55a92f4]::util::bug::bug_fmt
  23:     0x7f9d27096d0c - rustc_monomorphize[5f07e8aed176c674]::collector::collect_used_items
  24:     0x7f9d27086be0 - rustc_monomorphize[5f07e8aed176c674]::collector::collect_items_rec
  25:     0x7f9d27728b93 - rustc_data_structures[3f82928326e7f17b]::sync::par_for_each_in::<alloc[94daa9e91581ecb7]::vec::Vec<rustc_middle[2d6135a6a55a92f4]::mir::mono::MonoItem>, rustc_monomorphize[5f07e8aed176c674]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  26:     0x7f9d277284b0 - <rustc_session[dc274bc86de11b2]::session::Session>::time::<(), rustc_monomorphize[5f07e8aed176c674]::collector::collect_crate_mono_items::{closure#1}>
  27:     0x7f9d277280f8 - rustc_monomorphize[5f07e8aed176c674]::collector::collect_crate_mono_items
  28:     0x7f9d27726687 - rustc_monomorphize[5f07e8aed176c674]::partitioning::collect_and_partition_mono_items
  29:     0x7f9d27a381e9 - rustc_query_impl[56d56e55f89dc108]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[56d56e55f89dc108]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2d6135a6a55a92f4]::query::erase::Erased<[u8; 24usize]>>
  30:     0x7f9d27a381bb - <rustc_query_impl[56d56e55f89dc108]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[179bd5bdb7674514]::ops::function::FnOnce<(rustc_middle[2d6135a6a55a92f4]::ty::context::TyCtxt, ())>>::call_once
  31:     0x7f9d27b32fcc - rustc_query_system[820ba01abcedc11e]::query::plumbing::try_execute_query::<rustc_query_impl[56d56e55f89dc108]::DynamicConfig<rustc_query_system[820ba01abcedc11e]::query::caches::SingleCache<rustc_middle[2d6135a6a55a92f4]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[56d56e55f89dc108]::plumbing::QueryCtxt, false>
  32:     0x7f9d27dbf60a - rustc_query_impl[56d56e55f89dc108]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f9d270aaa29 - rustc_codegen_ssa[48a71250af989085]::base::codegen_crate::<rustc_codegen_llvm[9635be2417e1ae72]::LlvmCodegenBackend>
  34:     0x7f9d270aa7ff - <rustc_codegen_llvm[9635be2417e1ae72]::LlvmCodegenBackend as rustc_codegen_ssa[48a71250af989085]::traits::backend::CodegenBackend>::codegen_crate
  35:     0x7f9d27974652 - <rustc_session[dc274bc86de11b2]::session::Session>::time::<alloc[94daa9e91581ecb7]::boxed::Box<dyn core[179bd5bdb7674514]::any::Any>, rustc_interface[b727bedca2f0eb3b]::passes::start_codegen::{closure#0}>
  36:     0x7f9d279741cb - rustc_interface[b727bedca2f0eb3b]::passes::start_codegen
  37:     0x7f9d2796ef2d - <rustc_middle[2d6135a6a55a92f4]::ty::context::GlobalCtxt>::enter::<<rustc_interface[b727bedca2f0eb3b]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[179bd5bdb7674514]::result::Result<alloc[94daa9e91581ecb7]::boxed::Box<dyn core[179bd5bdb7674514]::any::Any>, rustc_span[9ec16770641762ee]::ErrorGuaranteed>>
  38:     0x7f9d2796e15d - <rustc_interface[b727bedca2f0eb3b]::queries::Queries>::ongoing_codegen
  39:     0x7f9d2796d280 - <rustc_interface[b727bedca2f0eb3b]::interface::Compiler>::enter::<rustc_driver_impl[2635ae639440f84d]::run_compiler::{closure#1}::{closure#2}, core[179bd5bdb7674514]::result::Result<core[179bd5bdb7674514]::option::Option<rustc_interface[b727bedca2f0eb3b]::queries::Linker>, rustc_span[9ec16770641762ee]::ErrorGuaranteed>>
  40:     0x7f9d2796a8b1 - std[a820ec68793a1c54]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b727bedca2f0eb3b]::util::run_in_thread_pool_with_globals<rustc_interface[b727bedca2f0eb3b]::interface::run_compiler<core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>, rustc_driver_impl[2635ae639440f84d]::run_compiler::{closure#1}>::{closure#0}, core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>>
  41:     0x7f9d2796a035 - <<std[a820ec68793a1c54]::thread::Builder>::spawn_unchecked_<rustc_interface[b727bedca2f0eb3b]::util::run_in_thread_pool_with_globals<rustc_interface[b727bedca2f0eb3b]::interface::run_compiler<core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>, rustc_driver_impl[2635ae639440f84d]::run_compiler::{closure#1}>::{closure#0}, core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[179bd5bdb7674514]::result::Result<(), rustc_span[9ec16770641762ee]::ErrorGuaranteed>>::{closure#1} as core[179bd5bdb7674514]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f9d25212685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7557df74034f0cd4
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/alloc/src/boxed.rs:1993:9
  43:     0x7f9d25212685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha799d8f85cbbc72f
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/alloc/src/boxed.rs:1993:9
  44:     0x7f9d25212685 - std::sys::unix::thread::Thread::new::thread_start::h88ab86e849d99fd7
                               at /rustc/3b2073f0762cff4d3d625bb10017e0ce4e7abe50/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7f9d250de609 - start_thread
  46:     0x7f9d25001133 - clone
  47:                0x0 - <unknown>

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions