Change:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: no host param id for call in const yet no errors reported', 'error: internal compiler error: no host param id for call in const yet no errors reported' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: --
Regression in nightly-2023-08-09

Discussion:
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID}; use rustc_hir::PredicateOrigin; use rustc_index::{Idx, IndexSlice, IndexVec}; <ins> use rustc_middle::span_bug; </ins> use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::symbol::{kw, sym, Ident};

// This is used to track which lifetimes have already been defined, // and which need to be replicated when lowering an async fn. <del> match parent_hir.node().expect_item().kind { </del> <ins> let generics = match parent_hir.node().expect_item().kind { </ins> hir::ItemKind::Impl(impl_) => { self.is_in_trait_impl = impl_.of_trait.is_some(); <ins> &impl_.generics </ins> } <del> hir::ItemKind::Trait(_, _, generics, _, _) if self.tcx.features().effects => { self.host_param_id = generics .params .iter() .find(|param| { matches!( param.kind, hir::GenericParamKind::Const { is_host_effect: true, .. } ) }) .map(|param| param.def_id); </del> <ins> hir::ItemKind::Trait(_, _, generics, _, _) => generics, kind => { span_bug!(item.span, "assoc item has unexpected kind of parent: {}", kind.descr()) </ins> } <del> _ => {} </del> <ins> }; if self.tcx.features().effects { self.host_param_id = generics .params .iter() .find(|param| { matches!(param.kind, hir::GenericParamKind::Const { is_host_effect: true, .. }) }) .map(|param| param.def_id); </ins> } match ctxt {

<del> error[E0277]: can't compare `impl PartialEq + Destruct + Copy` with `impl PartialEq + Destruct + Copy` --> $DIR/const-impl-trait.rs:28:17 </del> <ins> error[E0277]: can't compare `()` with `()` --> $DIR/const-impl-trait.rs:35:17 </ins> | <del> LL |     fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `impl PartialEq + Destruct + Copy == impl PartialEq + Destruct + Copy` </del> <ins> LL |     assert!(cmp(&())); |             --- ^^^ no implementation for `() == ()` |             | |             required by a bound introduced by this call </ins> | <del> = help: the trait `~const PartialEq` is not implemented for `impl PartialEq + Destruct + Copy` note: required by a bound in `Foo::{opaque#0}` --> $DIR/const-impl-trait.rs:24:22 </del> <ins> = help: the trait `const PartialEq` is not implemented for `()` = help: the trait `PartialEq` is implemented for `()` note: required by a bound in `cmp` --> $DIR/const-impl-trait.rs:12:23 </ins> | <del> LL |     fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; |                      ^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}` </del> <ins> LL | const fn cmp(a: &impl ~const PartialEq) -> bool { |                       ^^^^^^^^^^^^^^^^ required by this bound in `cmp` </ins> <del> error[E0277]: can't drop `impl PartialEq + Destruct + Copy` --> $DIR/const-impl-trait.rs:28:17 </del> <ins> error[E0277]: can't compare `&impl ~const PartialEq` with `&impl ~const PartialEq` --> $DIR/const-impl-trait.rs:13:7 </ins> | <del> LL |     fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `impl PartialEq + Destruct + Copy` </del> <ins> LL |     a == a |       ^^ no implementation for `&impl ~const PartialEq == &impl ~const PartialEq` </ins> | <del> note: required by a bound in `Foo::{opaque#0}` --> $DIR/const-impl-trait.rs:24:41 </del> <ins> = help: the trait `~const PartialEq<&impl ~const PartialEq>` is not implemented for `&impl ~const PartialEq` help: consider dereferencing both sides of the expression </ins> | <del> LL |     fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; |                                         ^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}` </del> <ins> LL |     *a == *a |     +     + </ins> error: aborting due to 2 previous errors

<ins> // Regression test for issue #119700. // check-pass #![feature(const_trait_impl, effects)] #[const_trait] trait Main { fn compute<T: ~const Aux>() -> u32; } impl const Main for () { fn compute<T: ~const Aux>() -> u32 { T::generate() } } #[const_trait] trait Aux { fn generate() -> u32; } impl const Aux for () { fn generate() -> u32 { 1024 } } fn main() { const _: u32 = <()>::compute::<()>(); let _ = <()>::compute::<()>(); } </ins>

<ins> // check-pass #![feature(const_trait_impl, effects)] #[const_trait] trait Foo { fn foo(&self) {} } struct Bar<T>(T); impl<T> Bar<T> { const fn foo(&self) where T: ~const Foo { self.0.foo() } } fn main() {} </ins>

<del> // check-pass #![feature(const_trait_impl, effects)] #[const_trait] trait Foo { fn foo(&self) {} } struct Bar<T>(T); impl<T> Bar<T> { const fn foo(&self) where T: ~const Foo { self.0.foo() } } fn main() {} </del>