Change:
Regression from stable 1.66 / beta 1.67 -nightly 1.68 (haven't bisected). Stable/beta correctly produce an error, nightly ICEs. I've also confirmed the behavior on the latest commit to master (, at time of writing). (nightly — ICE) (beta — error as expected) (stable — error as expected) Setting produced the same output as above. I tried to dig into this, struggled to make sense of the typechecking code. I think the following is going on: <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
cargo-bisect-rustc seems to think this is caused by of which looks like the most plausible candidate since it touched type relation code which calls without handling infer vars :thinking: cc
Ugh i'll fix it claim
WG-prioritization assigning priority (). label -I-prioritize +P-high
This is a bit weird, but I was able to come up with an alternative reduction (after hit it on - we use a pinned nightly so this is mostly a coincidence): I'm not sure why the inference variable vs generic param makes a difference like that, but I wasn't able to combine the two reductions together. Also, the ICE query stack confirms the / split between nightly versions, even in the combined example.

Discussion:
fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { self.infcx.probe(|_| { <del> if a.is_ty_infer() || b.is_ty_infer() { </del> <ins> if a.is_ty_var() || b.is_ty_var() { </ins> Ok(a) } else { self.infcx.super_combine_tys(self, a, b).or_else(|e| {

a: ty::Const<'tcx>, b: ty::Const<'tcx>, ) -> RelateResult<'tcx, ty::Const<'tcx>> { <del> if a == b { return Ok(a); } relate::super_relate_consts(self, a, b) // could do something similar here for constants! </del> <ins> self.infcx.probe(|_| { if a.is_ct_infer() || b.is_ct_infer() { Ok(a) } else { relate::super_relate_consts(self, a, b) // could do something similar here for constants! } }) </ins> } fn binders<T: Relate<'tcx>>(

<ins> struct Foo<T, const N: usize> { array: [T; N], } trait Bar<const N: usize> {} impl<T, const N: usize> Foo<T, N> { fn trigger(self) { self.unsatisfied() //~^ ERROR the trait bound `T: Bar<N>` is not satisfied } fn unsatisfied(self) where T: Bar<N>, { } } fn main() {} </ins>

<ins> error[E0277]: the trait bound `T: Bar<N>` is not satisfied --> $DIR/ct-var-in-collect_all_mismatches.rs:9:14 | LL |         self.unsatisfied() |              ^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `T` | note: required by a bound in `Foo::<T, N>::unsatisfied` --> $DIR/ct-var-in-collect_all_mismatches.rs:15:12 | LL |     fn unsatisfied(self) |        ----------- required by a bound in this LL |     where LL |         T: Bar<N>, |            ^^^^^^ required by this bound in `Foo::<T, N>::unsatisfied` help: consider restricting type parameter `T` | LL | impl<T: Bar<N>, const N: usize> Foo<T, N> { |       ++++++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>

<ins> fn main() { let x = Some(()).iter().map(|()| 1).sum::<f32>(); //~^ ERROR a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}` } </ins>

<ins> error[E0277]: a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}` --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:41 | LL |     let x = Some(()).iter().map(|()| 1).sum::<f32>(); |                                         ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>` | = help: the trait `Sum<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Sum<A>`: <f32 as Sum<&'a f32>> <f32 as Sum> note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29 | LL |     let x = Some(()).iter().map(|()| 1).sum::<f32>(); |             -------- ------ ^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here |             |        | |             |        `Iterator::Item` is `&()` here |             this expression has type `Option<()>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>