Skip to content

Commit c3137d9

Browse files
committed
normalize if-eq bounds before testing
Hat-tip: aliemjay
1 parent e6b630c commit c3137d9

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
823823
) -> bool {
824824
match bound {
825825
VerifyBound::IfEq(verify_if_eq_b) => {
826+
let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
826827
match test_type_match::extract_verify_if_eq(
827828
self.tcx(),
828829
self.param_env,
829-
verify_if_eq_b,
830+
&verify_if_eq_b,
830831
generic_ty,
831832
) {
832833
Some(r) => {
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// check-pass
2+
//
3+
// Regression test from crater run for
4+
// <https://github.com/rust-lang/rust/pull/98109>.
5+
6+
7+
pub trait ElementLike {}
8+
9+
pub struct Located<T> where T: ElementLike {
10+
inner: T,
11+
}
12+
13+
pub struct BlockElement<'a>(&'a str);
14+
15+
impl ElementLike for BlockElement<'_> {}
16+
17+
18+
pub struct Page<'a> {
19+
/// Comprised of the elements within a page
20+
pub elements: Vec<Located<BlockElement<'a>>>,
21+
}
22+
23+
impl<'a, __IdxT> std::ops::Index<__IdxT> for Page<'a> where
24+
Vec<Located<BlockElement<'a>>>: std::ops::Index<__IdxT>
25+
{
26+
type Output =
27+
<Vec<Located<BlockElement<'a>>> as
28+
std::ops::Index<__IdxT>>::Output;
29+
30+
#[inline]
31+
fn index(&self, idx: __IdxT) -> &Self::Output {
32+
<Vec<Located<BlockElement<'a>>> as
33+
std::ops::Index<__IdxT>>::index(&self.elements, idx)
34+
}
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)