Skip to content

Commit f4cca46

Browse files
authored
Rollup merge of #105561 - TaKO8Ki:fix-105449, r=fee1-dead
Normalize receiver substs and erase the regions Fixes #105449
2 parents d539628 + 3bc54ba commit f4cca46

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

compiler/rustc_ty_utils/src/instance.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ fn inner_resolve_instance<'tcx>(
4444

4545
let result = if let Some(trait_def_id) = tcx.trait_of_item(def.did) {
4646
debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env);
47-
resolve_associated_item(tcx, def.did, param_env, trait_def_id, substs)
47+
resolve_associated_item(
48+
tcx,
49+
def.did,
50+
param_env,
51+
trait_def_id,
52+
tcx.normalize_erasing_regions(param_env, substs),
53+
)
4854
} else {
4955
let ty = tcx.type_of(def.def_id_for_type_of());
5056
let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, ty);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// check-pass
2+
// compile-flags: -C debug_assertions=yes -Zunstable-options
3+
4+
#[allow(dead_code)]
5+
fn problematic_function<Space>()
6+
where
7+
DefaultAlloc: FinAllok<R1, Space>,
8+
{
9+
let e = Edge2dElement;
10+
let _ = Into::<Point>::into(e.map_reference_coords());
11+
}
12+
impl<N> Allocator<N, R0> for DefaultAlloc {
13+
type Buffer = MStorage;
14+
}
15+
impl<N> Allocator<N, R1> for DefaultAlloc {
16+
type Buffer = MStorage;
17+
}
18+
impl<N, D> From<VectorN<N, D>> for Point
19+
where
20+
DefaultAlloc: Allocator<N, D>,
21+
{
22+
fn from(_: VectorN<N, D>) -> Self {
23+
unimplemented!()
24+
}
25+
}
26+
impl<GeometryDim, NodalDim> FinAllok<GeometryDim, NodalDim> for DefaultAlloc
27+
where
28+
DefaultAlloc: Allocator<Ure, GeometryDim>,
29+
DefaultAlloc: Allocator<Ure, NodalDim>
30+
{
31+
}
32+
impl FiniteElement<R1> for Edge2dElement {
33+
fn map_reference_coords(&self) -> VectorN<Ure, R1> {
34+
unimplemented!()
35+
}
36+
}
37+
type VectorN<N, R> = (N, R, <DefaultAlloc as Allocator<N, R>>::Buffer);
38+
struct DefaultAlloc;
39+
struct R0;
40+
struct R1;
41+
struct MStorage;
42+
struct Point;
43+
struct Edge2dElement;
44+
struct Ure;
45+
trait Allocator<N, R> {
46+
type Buffer;
47+
}
48+
trait FinAllok<GeometryDim, NodalDim>:
49+
Allocator<Ure, GeometryDim> +
50+
Allocator<Ure, NodalDim> +
51+
{
52+
}
53+
trait FiniteElement<Rau>
54+
where
55+
DefaultAlloc: FinAllok<Rau, Rau>,
56+
{
57+
fn map_reference_coords(&self) -> VectorN<Ure, Rau>;
58+
}
59+
fn main() {}

0 commit comments

Comments
 (0)