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: Calling a non-dispatchable function with RPITIT in impl dyn Trait #102140

Closed
mattNeumayer opened this issue Sep 22, 2022 · 3 comments · Fixed by #102152
Closed

ICE: Calling a non-dispatchable function with RPITIT in impl dyn Trait #102140

mattNeumayer opened this issue Sep 22, 2022 · 3 comments · Fixed by #102152
Labels
C-bug Category: This is a bug. F-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]` glacier ICE tracked in rust-lang/glacier. 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

@mattNeumayer
Copy link

Based on @nikomatsakis 's blog posts, I was playing around with RPITIT and dyn Trait.

I fully understand that it shouldn't compile 😅. It should probably give the same error as you get when impl Marker is replaced with u32. Which would be: error[[E0277]]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied.

Code

Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=26882f1a5fa50c8fa117cc9962bed9b1

#![feature(return_position_impl_trait_in_trait)]

trait Marker {}
impl Marker for u32 {}

trait MyTrait {
    fn foo(&self) -> impl Marker
        where Self: Sized;
}

struct Outer;

impl MyTrait for Outer {
    fn foo(&self) -> impl Marker {
        42
    }
}

impl dyn MyTrait {
    fn other(&self) -> impl Marker {
        MyTrait::foo(&self)
    }
}

Details:

I started with this code ("shadowing foo" and dot-notation):

impl dyn MyTrait {
    fn foo(&self) -> impl Marker {
        self.foo()
    }
}

Which errors with multiple applicable items in scope, but recommends the ICE-ing code: disambiguate the associated function for candidate MyTrait::foo(&self).

Meta

ICE's both on nightly and beta.

rustc 1.66.0-nightly (9062b780b 2022-09-21)
binary: rustc
commit-hash: 9062b780b32d2eab060b4432863e085d9504ca5c
commit-date: 2022-09-21
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.0

Error output

Backtrace 1

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

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `AssocFn`,
 right: `Trait`', compiler/rustc_middle/src/ty/sty.rs:1137:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:556:5
   1: core::panicking::panic_fmt
             at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_hir::def::DefKind, rustc_hir::def::DefKind>
   4: <rustc_middle::ty::sty::ProjectionTy>::trait_ref
   5: rustc_trait_selection::traits::project::normalize_to_error
   6: rustc_trait_selection::traits::project::opt_normalize_projection_type
   7: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
   8: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
   9: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor, rustc_data_structures::obligation_forest::Outcome<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_infer::traits::FulfillmentErrorCode>>
  10: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  11: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  12: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  13: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  14: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  15: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  17: rustc_typeck::check::check::check_fn
  18: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  19: rustc_typeck::check::typeck
  20: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  23: <rustc_middle::ty::context::TyCtxt>::typeck_opt_const_arg
  24: rustc_mir_build::thir::cx::thir_body
  25: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, core::result::Result<(&rustc_data_structures::steal::Steal<rustc_middle::thir::Thir>, rustc_middle::thir::ExprId), rustc_errors::ErrorGuaranteed>>
  26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, core::result::Result<(&rustc_data_structures::steal::Steal<rustc_middle::thir::Thir>, rustc_middle::thir::ExprId), rustc_errors::ErrorGuaranteed>>>
  27: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::thir_body
  28: rustc_mir_build::build::mir_built
  29: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>
  30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>>
  31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_built
  32: rustc_mir_transform::check_unsafety::unsafety_check_result
  33: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  34: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>
  35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::UnsafetyCheckResult>>
  36: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result
  37: rustc_mir_transform::mir_const
  38: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>
  39: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, &rustc_data_structures::steal::Steal<rustc_middle::mir::Body>>>
  40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
  41: rustc_mir_transform::mir_promoted
  42: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, (&rustc_data_structures::steal::Steal<rustc_middle::mir::Body>, &rustc_data_structures::steal::Steal<rustc_index::vec::IndexVec<rustc_middle::mir::Promoted, rustc_middle::mir::Body>>)>
  43: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::WithOptConstParam<rustc_span::def_id::LocalDefId>, (&rustc_data_structures::steal::Steal<rustc_middle::mir::Body>, &rustc_data_structures::steal::Steal<rustc_index::vec::IndexVec<rustc_middle::mir::Promoted, rustc_middle::mir::Body>>)>>
  44: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_promoted
  45: rustc_borrowck::mir_borrowck
  46: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  47: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  48: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>>
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  50: rustc_typeck::collect::type_of::type_of
  51: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId, rustc_middle::ty::Ty>
  52: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
  53: rustc_typeck::check::check::check_item_type
  54: rustc_typeck::check::check::check_mod_item_types
  55: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
  56: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, ()>>
  57: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
  58: <rustc_middle::hir::map::Map>::for_each_module::<rustc_typeck::check_crate::{closure#6}::{closure#0}>
  59: rustc_typeck::check_crate
  60: rustc_interface::passes::analysis
  61: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  62: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  63: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  64: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  65: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  66: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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: rustc 1.66.0-nightly (9062b780b 2022-09-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `<impl at src/lib.rs:20:1: 20:17>::foo`
#1 [thir_body] building THIR for `<impl at src/lib.rs:20:1: 20:17>::foo`
#2 [mir_built] building MIR for `<impl at src/lib.rs:20:1: 20:17>::foo`
#3 [unsafety_check_result] unsafety-checking `<impl at src/lib.rs:20:1: 20:17>::foo`
#4 [mir_const] processing MIR for `<impl at src/lib.rs:20:1: 20:17>::foo`
#5 [mir_promoted] processing `<impl at src/lib.rs:20:1: 20:17>::foo`
#6 [mir_borrowck] borrow-checking `<impl at src/lib.rs:20:1: 20:17>::foo`
#7 [type_of] computing type of `<impl at src/lib.rs:20:1: 20:17>::foo::{opaque#0}`
#8 [check_mod_item_types] checking item types in top-level module
#9 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: VecMap([(OpaqueTypeKey { def_id: DefId(0:15 ~ ice_2022_09_22[569e]::{impl#2}::foo::{opaque#0}), substs: [] }, OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: src/lib.rs:21:22: 21:33 (#6), ty: _ }, origin: FnReturn(DefId(0:14 ~ ice_2022_09_22[569e]::{impl#2}::foo)) })])
  |
  = note: delayed at compiler/rustc_infer/src/infer/opaque_types/table.rs:50:26

Backtrace 2

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1530:13
stack backtrace:
   0:     0x7efe2d7b1010 - std::backtrace_rs::backtrace::libunwind::trace::hb70cd2c4f10319c4
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7efe2d7b1010 - std::backtrace_rs::backtrace::trace_unsynchronized::h6a235690bde8066a
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7efe2d7b1010 - std::sys_common::backtrace::_print_fmt::hf423a9f93de17924
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7efe2d7b1010 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h81fafbb534b53ab7
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7efe2d80be5e - core::fmt::write::h91215ed98af09b40
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/core/src/fmt/mod.rs:1202:17
   5:     0x7efe2d7a1b15 - std::io::Write::write_fmt::h9d32a42fc3233c10
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/io/mod.rs:1679:15
   6:     0x7efe2d7b3d93 - std::sys_common::backtrace::_print::hebe110643c78e1a1
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7efe2d7b3d93 - std::sys_common::backtrace::print::h544b1b31fddff6eb
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7efe2d7b3d93 - std::panicking::default_hook::{{closure}}::hf97dcba6b32ea332
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:267:22
   9:     0x7efe2d7b3a7f - std::panicking::default_hook::h3f82dc02801e0576
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:286:9
  10:     0x7efe2ffb78d1 - <rustc_driver[610c3dabcb482a3]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[c7389bc70673082e]::ops::function::FnOnce<(&core[c7389bc70673082e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7efe2d7b45cb - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1442642a89018d6d
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1954:9
  12:     0x7efe2d7b45cb - std::panicking::rust_panic_with_hook::hb8c8dca0bdad40db
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/panicking.rs:673:13
  13:     0x7efe310d47d1 - std[2c19137f19a9cec7]::panicking::begin_panic::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>::{closure#0}
  14:     0x7efe310d4536 - std[2c19137f19a9cec7]::sys_common::backtrace::__rust_end_short_backtrace::<std[2c19137f19a9cec7]::panicking::begin_panic<rustc_errors[275d4fb119ffacfb]::ExplicitBug>::{closure#0}, !>
  15:     0x7efe310d41d6 - std[2c19137f19a9cec7]::panicking::begin_panic::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>
  16:     0x7efe310d19b6 - std[2c19137f19a9cec7]::panic::panic_any::<rustc_errors[275d4fb119ffacfb]::ExplicitBug>
  17:     0x7efe2fad5c4b - <rustc_errors[275d4fb119ffacfb]::HandlerInner as core[c7389bc70673082e]::ops::drop::Drop>::drop
  18:     0x7efe2ed92778 - core[c7389bc70673082e]::ptr::drop_in_place::<rustc_session[40303a05d79b8f9]::parse::ParseSess>
  19:     0x7efe2ed506d8 - <alloc[9a4df20b0dad2694]::rc::Rc<rustc_session[40303a05d79b8f9]::session::Session> as core[c7389bc70673082e]::ops::drop::Drop>::drop
  20:     0x7efe2ed4d2ed - core[c7389bc70673082e]::ptr::drop_in_place::<rustc_interface[121647ee48321f2a]::interface::Compiler>
  21:     0x7efe2ed4b584 - rustc_interface[121647ee48321f2a]::interface::create_compiler_and_run::<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>
  22:     0x7efe2ed49072 - <scoped_tls[d2720ff23ff3c466]::ScopedKey<rustc_span[d840d66cf15b0e9]::SessionGlobals>>::set::<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>
  23:     0x7efe2ed48d5f - std[2c19137f19a9cec7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[121647ee48321f2a]::util::run_in_thread_pool_with_globals<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>
  24:     0x7efe2fe1d9d0 - <<std[2c19137f19a9cec7]::thread::Builder>::spawn_unchecked_<rustc_interface[121647ee48321f2a]::util::run_in_thread_pool_with_globals<rustc_interface[121647ee48321f2a]::interface::run_compiler<core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>, rustc_driver[610c3dabcb482a3]::run_compiler::{closure#1}>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#0}, core[c7389bc70673082e]::result::Result<(), rustc_errors[275d4fb119ffacfb]::ErrorGuaranteed>>::{closure#1} as core[c7389bc70673082e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7efe2d7be3b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he225f53d02ef001f
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1940:9
  26:     0x7efe2d7be3b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1d16365b1f15b7b7
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/alloc/src/boxed.rs:1940:9
  27:     0x7efe2d7be3b3 - std::sys::unix::thread::Thread::new::thread_start::h91bd867cccfe281f
                               at /rustc/9062b780b32d2eab060b4432863e085d9504ca5c/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7efe2d680609 - start_thread
                               at /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
  29:     0x7efe2d5a5293 - clone
                               at /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  30:                0x0 - <unknown>

note: 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: rustc 1.66.0-nightly (9062b780b 2022-09-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
thread panicked while panicking. aborting.

@mattNeumayer mattNeumayer 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 Sep 22, 2022
@mattNeumayer
Copy link
Author

This commit added the assert_eq!(tcx.def_kind(parent), DefKind::Trait); that triggers. Maybe including DefKind::AssocFn is enough to fix it?

@compiler-errors
Copy link
Member

Maybe including DefKind::AssocFn is enough to fix it?

No, that will just mask the underlying issue.

@Rageking8
Copy link
Contributor

@rustbot label +F-return_position_impl_trait_in_trait

@rustbot rustbot added the F-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]` label Sep 23, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 23, 2022
…e1-dead

Calculate `ProjectionTy::trait_def_id` for return-position `impl Trait` in trait correctly

Fixes rust-lang#102140
@bors bors closed this as completed in a842357 Sep 24, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 1, 2022
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-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]` glacier ICE tracked in rust-lang/glacier. 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
5 participants