normalize if-eq bounds before testing

Hat-tip: aliemjay
This commit is contained in:
Niko Matsakis 2022-06-23 16:53:44 -04:00
parent e6b630c5b1
commit c3137d9e8c
2 changed files with 39 additions and 1 deletions

View File

@ -823,10 +823,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
) -> bool {
match bound {
VerifyBound::IfEq(verify_if_eq_b) => {
let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
match test_type_match::extract_verify_if_eq(
self.tcx(),
self.param_env,
verify_if_eq_b,
&verify_if_eq_b,
generic_ty,
) {
Some(r) => {

View File

@ -0,0 +1,37 @@
// check-pass
//
// Regression test from crater run for
// <https://github.com/rust-lang/rust/pull/98109>.
pub trait ElementLike {}
pub struct Located<T> where T: ElementLike {
inner: T,
}
pub struct BlockElement<'a>(&'a str);
impl ElementLike for BlockElement<'_> {}
pub struct Page<'a> {
/// Comprised of the elements within a page
pub elements: Vec<Located<BlockElement<'a>>>,
}
impl<'a, __IdxT> std::ops::Index<__IdxT> for Page<'a> where
Vec<Located<BlockElement<'a>>>: std::ops::Index<__IdxT>
{
type Output =
<Vec<Located<BlockElement<'a>>> as
std::ops::Index<__IdxT>>::Output;
#[inline]
fn index(&self, idx: __IdxT) -> &Self::Output {
<Vec<Located<BlockElement<'a>>> as
std::ops::Index<__IdxT>>::index(&self.elements, idx)
}
}
fn main() {}