Skip to content
/ rust Public
forked from rust-lang/rust

Commit fb9030d

Browse files
Structurally normalize weak and inherent too
1 parent 2aae331 commit fb9030d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

compiler/rustc_hir_analysis/src/autoderef.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
7474
// we have some type like `&<Ty as Trait>::Assoc`, since users of
7575
// autoderef expect this type to have been structurally normalized.
7676
if self.infcx.next_trait_solver()
77-
&& let ty::Alias(ty::Projection, _) = ty.kind()
77+
&& let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _) = ty.kind()
7878
{
7979
let (normalized_ty, obligations) = self.structurally_normalize(ty)?;
8080
self.state.obligations.extend(obligations);

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14741474
let ty = self.resolve_vars_with_obligations(ty);
14751475

14761476
if self.next_trait_solver()
1477-
&& let ty::Alias(ty::Projection, _) = ty.kind()
1477+
&& let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _) = ty.kind()
14781478
{
14791479
match self
14801480
.at(&self.misc(sp), self.param_env)

compiler/rustc_trait_selection/src/traits/structural_normalize.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ impl<'tcx> StructurallyNormalizeExt<'tcx> for At<'_, 'tcx> {
2222
assert!(!ty.is_ty_var(), "should have resolved vars before calling");
2323

2424
if self.infcx.next_trait_solver() {
25-
while let ty::Alias(ty::Projection, projection_ty) = *ty.kind() {
25+
while let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, projection_ty) =
26+
*ty.kind()
27+
{
2628
let new_infer_ty = self.infcx.next_ty_var(TypeVariableOrigin {
2729
kind: TypeVariableOriginKind::NormalizeProjectionType,
2830
span: self.cause.span,

0 commit comments

Comments
 (0)