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: Shouldn't expect a placeholder type in implied bounds (yet) When return type in trait impl is &impl Trait #118286

Closed
nikvoid opened this issue Nov 25, 2023 · 2 comments · Fixed by #118290
Assignees
Labels
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.

Comments

@nikvoid
Copy link

nikvoid commented Nov 25, 2023

Code

pub fn main() {

}

pub trait Iced {
    fn get(&self) -> &impl Sized;
}

/// Impl causes ICE
impl Iced for () {
    fn get(&self) -> &impl Sized { &() }
} 

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (37b2813a7 2023-11-24)
binary: rustc
commit-hash: 37b2813a7be580ef59048a6bd08444c79e5cc97f
commit-date: 2023-11-24
host: x86_64-pc-windows-msvc
release: 1.76.0-nightly
LLVM version: 17.0.5

Error output

thread 'rustc' panicked at compiler\rustc_trait_selection\src\traits\query\type_op\implied_outlives_bounds.rs:211:21:
not implemented: Shouldn't expect a placeholder type in implied bounds (yet)
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 attach the file at `E:\projects\rust-test\rustc-ice-2023-11-25T15_24_27-2620.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C target-cpu=native

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

query stack during panic:
#0 [implied_outlives_bounds] computing implied outlives bounds for `&^1`
#1 [collect_return_position_impl_trait_in_trait_tys] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process
#2 [type_of] computing type of `<impl at src\bin\ice.rs:10:1: 10:17>::{opaque#0}`
#3 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
Backtrace

thread 'rustc' panicked at compiler\rustc_trait_selection\src\traits\query\type_op\implied_outlives_bounds.rs:211:21:
not implemented: Shouldn't expect a placeholder type in implied bounds (yet)
stack backtrace:
   0:     0x7ffa1a14ddff - std::backtrace::Backtrace::force_capture::h3f668b79418f22f9
   1:     0x7ffa1a14dd64 - std::backtrace::Backtrace::force_capture::h3f668b79418f22f9
   2:     0x7ffa102f5949 - <tracing_subscriber[c47e476d72039508]::util::TryInitError as core[5caf4f20ff5a4def]::fmt::Display>::fmt
   3:     0x7ffa1a166903 - std::panicking::rust_panic_with_hook::h81a622fcd9e6c3bd
   4:     0x7ffa1a16676b - <std::panicking::begin_panic_handler::StaticStrPayload as core::panic::PanicPayload>::take_box::heaf78657578f08f1
   5:     0x7ffa1a163949 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h455546a8643c8c2e
   6:     0x7ffa1a1664b4 - rust_begin_unwind
   7:     0x7ffa1a1bb1e7 - core::panicking::panic_fmt::ha0f2e731394baff3
   8:     0x7ffa0fde00af - rustc_trait_selection[e2e03292c3acd521]::traits::normalize_param_env_or_error
   9:     0x7ffa0fe253da - <rustc_infer[295366c5eee344e]::traits::project::ProjectionCacheKey as rustc_trait_selection[e2e03292c3acd521]::traits::project::ProjectionCacheKeyExt>::from_poly_projection_predicate
  10:     0x7ffa0fde435c - rustc_trait_selection[e2e03292c3acd521]::traits::query::type_op::implied_outlives_bounds::compute_implied_outlives_bounds_inner
  11:     0x7ffa0fb26a44 - rustc_traits[f20ef36d848666e1]::type_op::type_op_prove_predicate
  12:     0x7ffa0fb17557 - rustc_traits[f20ef36d848666e1]::implied_outlives_bounds::implied_outlives_bounds
  13:     0x7ffa0fb64493 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  14:     0x7ffa0fb9f2ed - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  15:     0x7ffa0eea03e2 - <dyn std[6105eaff722720a9]::io::Write as nu_ansi_term[58d86d1c798192ea]::write::AnyWrite>::write_str
  16:     0x7ffa0fdfdd4b - <rustc_infer[295366c5eee344e]::infer::InferCtxt as rustc_trait_selection[e2e03292c3acd521]::traits::outlives_bounds::InferCtxtExt>::implied_outlives_bounds
  17:     0x7ffa0f5104e3 - <rustc_hir_analysis[28b5b319a1019660]::autoderef::Autoderef>::into_obligations
  18:     0x7ffa1072ad6c - rustc_hir_analysis[28b5b319a1019660]::check::compare_impl_item::collect_return_position_impl_trait_in_trait_tys
  19:     0x7ffa10e45d37 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::depth_limit_error
  20:     0x7ffa10e9deb3 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::depth_limit_error
  21:     0x7ffa0fbdb257 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  22:     0x7ffa10e28301 - <rustc_span[bb17ac722f92f365]::def_id::LocalDefId as rustc_query_impl[c8293b5f85111528]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
  23:     0x7ffa0f4ea4eb - <rustc_hir_analysis[28b5b319a1019660]::collect::resolve_bound_vars::BoundVarContext as rustc_hir[6c53a7437ef4457d]::intravisit::Visitor>::visit_lifetime
  24:     0x7ffa0f4f416c - rustc_hir_analysis[28b5b319a1019660]::collect::type_of::type_of
  25:     0x7ffa0fb6494b - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  26:     0x7ffa0fb7b6c1 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  27:     0x7ffa0fbdb257 - <rustc_query_impl[c8293b5f85111528]::plumbing::QueryCtxt as rustc_query_system[cef96664c9ada928]::query::QueryContext>::load_side_effects
  28:     0x7ffa0fb59848 - rustc_query_impl[c8293b5f85111528]::query_callbacks
  29:     0x7ffa0f54353c - rustc_hir_analysis[28b5b319a1019660]::check::wfcheck::check_well_formed
  30:     0x7ffa0f543a93 - rustc_hir_analysis[28b5b319a1019660]::check::wfcheck::check_well_formed
  31:     0x7ffa0f51f039 - rustc_hir_analysis[28b5b319a1019660]::check::wfcheck::check_well_formed
  32:     0x7ffa0ede954f - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  33:     0x7ffa0edcc76f - rustc_query_impl[c8293b5f85111528]::dynamic_queries
  34:     0x7ffa0edef001 - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  35:     0x7ffa0ee3d7d3 - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  36:     0x7ffa0eec339c - <dyn std[6105eaff722720a9]::io::Write as nu_ansi_term[58d86d1c798192ea]::write::AnyWrite>::write_str
  37:     0x7ffa0f4a38f3 - rustc_hir_analysis[28b5b319a1019660]::check_crate
  38:     0x7ffa0f27427d - rustc_interface[141774b3faf88461]::passes::analysis
  39:     0x7ffa0edeba2d - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  40:     0x7ffa0eece209 - <dyn std[6105eaff722720a9]::io::Write as nu_ansi_term[58d86d1c798192ea]::write::AnyWrite>::write_str
  41:     0x7ffa0edeec3c - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  42:     0x7ffa0ee14577 - rustc_query_impl[c8293b5f85111528]::profiling_support::alloc_self_profile_query_strings
  43:     0x7ffa0eea9d47 - <dyn std[6105eaff722720a9]::io::Write as nu_ansi_term[58d86d1c798192ea]::write::AnyWrite>::write_str
  44:     0x7ffa0c2f999d - rustc_driver_impl[7d4818c60294d5bb]::main
  45:     0x7ffa0c30c064 - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  46:     0x7ffa0c300b33 - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  47:     0x7ffa0c30865c - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  48:     0x7ffa0c301661 - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  49:     0x7ffa0c30ae5f - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  50:     0x7ffa0c30af78 - <rustc_middle[903a3d62136ee3d2]::ty::SymbolName as core[5caf4f20ff5a4def]::fmt::Debug>::fmt
  51:     0x7ffa1a178a7c - std::sys::windows::thread::Thread::new::h28d06cd1c8f6e0e9
  52:     0x7ffa75d926ad - BaseThreadInitThunk
  53:     0x7ffa7754aa68 - RtlUserThreadStart


rustc version: 1.76.0-nightly (37b2813a7 2023-11-24)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [implied_outlives_bounds] computing implied outlives bounds for `&^1`
#1 [collect_return_position_impl_trait_in_trait_tys] comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process
#2 [type_of] computing type of `<impl at src\bin\ice.rs:10:1: 10:17>::{opaque#0}`
#3 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack

@nikvoid nikvoid 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 Nov 25, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 25, 2023
@matthiaskrgr
Copy link
Member

Regression in nightly-2023-11-21
Regression in #118082
Regression in #118000 ping @compiler-errors

@compiler-errors
Copy link
Member

Shouldn't expect a placeholder type in implied bounds

Except for where I made an implied bounds explicitly take placeholders 🤦

I'll fix this, sorry!

@compiler-errors compiler-errors self-assigned this Nov 25, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 26, 2023
@bors bors closed this as completed in 2eccebb Nov 26, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 26, 2023
Rollup merge of rust-lang#118290 - compiler-errors:placeholder-implied, r=aliemjay

Don't ICE when encountering placeholders in implied bounds computation

I *could* fix this the right way, though I don't really want to think about the implications of the change. This should have minimal side-effects.

r? `@aliemjay`

Fixes rust-lang#118286
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. 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
Development

Successfully merging a pull request may close this issue.

5 participants