Skip to content

Commit 3c982f3

Browse files
committed
temporary hacks
1 parent 02edcd9 commit 3c982f3

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

compiler/rustc_hir_typeck/src/method/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
494494
}
495495
}
496496

497+
// HACK: TODO
498+
let self_ty = {
499+
let infer = self.infcx.next_ty_var(span);
500+
self.demand_eqtype(span, infer, self_ty);
501+
self.select_obligations_where_possible(|_| {});
502+
self.resolve_vars_if_possible(infer)
503+
};
504+
497505
let pick = self.probe_for_name(
498506
probe::Mode::Path,
499507
method_name,

compiler/rustc_infer/src/infer/relate/generalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'tcx> InferCtxt<'tcx> {
3333
/// This is *not* expected to be used anywhere except for an implementation of
3434
/// `TypeRelation`. Do not use this, and instead please use `At::eq`, for all
3535
/// other usecases (i.e. setting the value of a type var).
36-
#[instrument(level = "debug", skip(self, relation))]
36+
#[instrument(level = "debug", skip(self, relation), fields(structurally_relate_aliases = ?relation.structurally_relate_aliases()))]
3737
pub fn instantiate_ty_var<R: PredicateEmittingRelation<InferCtxt<'tcx>>>(
3838
&self,
3939
relation: &mut R,

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ where
243243
}
244244

245245
match source {
246-
GoalSource::ImplWhereBound => PathKind::Coinductive,
246+
GoalSource::ImplWhereBound | GoalSource::AliasWellFormed => PathKind::Coinductive,
247247
_ => PathKind::Inductive,
248+
248249
}
249250
}
250251

compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ where
3434
match goal.predicate.alias.kind(cx) {
3535
ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => {
3636
let candidates = self.assemble_and_evaluate_candidates(goal);
37+
let trait_ref = goal.predicate.alias.trait_ref(cx);
3738
let (_, proven_via) =
3839
self.probe(|_| ProbeKind::ShadowedEnvProbing).enter_coinductively(|ecx| {
3940
let trait_goal: Goal<I, ty::TraitPredicate<I>> =
40-
goal.with(cx, goal.predicate.alias.trait_ref(cx));
41+
goal.with(cx, trait_ref);
4142
ecx.compute_trait_goal(trait_goal)
4243
})?;
4344
self.merge_candidates(proven_via, candidates, |ecx| {
@@ -46,6 +47,7 @@ where
4647
goal,
4748
goal.predicate.alias,
4849
);
50+
this.add_goal(GoalSource::AliasWellFormed, goal.with(cx, trait_ref));
4951
this.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
5052
})
5153
})

compiler/rustc_type_ir/src/solve/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ pub enum GoalSource {
7575
/// Predicate required for an alias projection to be well-formed.
7676
/// This is used in two places: projecting to an opaque whose hidden type
7777
/// is already registered in the opaque type storage, and for rigid projections.
78+
///
79+
/// FIXME(-Znext-solver=coinductive): Explain how and why this
80+
/// changes whether cycles are coinductive.
7881
AliasWellFormed,
7982
}
8083

0 commit comments

Comments
 (0)