Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c2e39c2

Browse files
committed
review
1 parent d6fe533 commit c2e39c2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,15 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
21922192
&self,
21932193
trait_predicate: Option<ty::Predicate<'tcx>>,
21942194
) -> bool {
2195+
// This function is what hacky and doesn't perfectly do what we want it to.
2196+
// It's not soundness critical and we should be able to freely improve this
2197+
// in the future.
2198+
//
2199+
// Some concrete edge cases include the fact that `goal_may_hold_opaque_types_jank`
2200+
// also fails if there are any constraints opaques which are never used as a self
2201+
// type. We also allow where-bounds which are currently ambiguous but end up
2202+
// constraining an opaque later on.
2203+
21952204
// Check whether the trait candidate would not be applicable if the
21962205
// opaque type were rigid.
21972206
if let Some(predicate) = trait_predicate {

compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,11 @@ impl<'tcx> InferCtxt<'tcx> {
8787
{
8888
// While we ignore region constraints and pending obligations,
8989
// we do return constrained opaque types to avoid unconstrained
90-
// inference variables in the response. This is still slightly
91-
// insufficient as ambiguous `Projection` obligations have the
92-
// same issue.
90+
// inference variables in the response. This is important as we want
91+
// to check that opaques in deref steps stay unconstrained.
9392
//
94-
// FIXME(-Znext-solver): We could alternatively extend the `var_values`
95-
// each time we call `make_query_response_ignoring_pending_obligations`
96-
// and equate inference variables created inside of the query this way.
97-
// This is what we do for `CanonicalState` and is probably a bit nicer.
93+
// This doesn't handle the more general case for non-opaques as
94+
// ambiguous `Projection` obligations have same the issue.
9895
let opaque_types = if self.next_trait_solver() {
9996
self.inner
10097
.borrow_mut()

0 commit comments

Comments
 (0)