Skip to content

Commit 63c2199

Browse files
committed
only instantiate opaques with rigid types
1 parent 35392dd commit 63c2199

File tree

1 file changed

+14
-0
lines changed
  • compiler/rustc_trait_selection/src/solve/project_goals

1 file changed

+14
-0
lines changed

compiler/rustc_trait_selection/src/solve/project_goals/opaques.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
5353
return self.flounder(&matches);
5454
}
5555
}
56+
57+
let expected = match self.try_normalize_ty(goal.param_env, expected) {
58+
Some(ty) => if ty.is_ty_var() {
59+
return self.evaluate_added_goals_and_make_canonical_response(
60+
Certainty::AMBIGUOUS,
61+
)
62+
} else {
63+
ty
64+
},
65+
None => return self.evaluate_added_goals_and_make_canonical_response(
66+
Certainty::OVERFLOW,
67+
),
68+
};
69+
5670
// Otherwise, define a new opaque type
5771
self.insert_hidden_type(opaque_type_key, goal.param_env, expected)?;
5872
self.add_item_bounds_for_hidden_type(

0 commit comments

Comments
 (0)