-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make PolyTraitRef::self_ty
return Binder<Ty>
#72508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,7 +289,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
( | ||
Some(format!( | ||
"`?` couldn't convert the error to `{}`", | ||
trait_ref.self_ty(), | ||
trait_ref.skip_binder().self_ty(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Less yay" -- this seems ok for now I guess but I wish we had a different solution than skipping the binder |
||
)), | ||
Some( | ||
"the question mark operation (`?`) implicitly performs a \ | ||
|
@@ -339,7 +339,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
if let Some(ret_span) = self.return_type_span(obligation) { | ||
err.span_label( | ||
ret_span, | ||
&format!("expected `{}` because of this", trait_ref.self_ty()), | ||
&format!( | ||
"expected `{}` because of this", | ||
trait_ref.skip_binder().self_ty() | ||
), | ||
); | ||
} | ||
} | ||
|
@@ -352,7 +355,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
"{}the trait `{}` is not implemented for `{}`", | ||
pre_message, | ||
trait_ref.print_only_trait_path(), | ||
trait_ref.self_ty(), | ||
trait_ref.skip_binder().self_ty(), | ||
) | ||
}; | ||
|
||
|
@@ -642,7 +645,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |
return; | ||
} | ||
|
||
let found_trait_ty = found_trait_ref.self_ty(); | ||
let found_trait_ty = match found_trait_ref.self_ty().no_bound_vars() { | ||
Some(ty) => ty, | ||
None => return, | ||
}; | ||
|
||
let found_did = match found_trait_ty.kind { | ||
ty::Closure(did, _) | ty::Foreign(did) | ty::FnDef(did, _) => Some(did), | ||
|
@@ -1359,11 +1365,15 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { | |
) { | ||
let get_trait_impl = |trait_def_id| { | ||
let mut trait_impl = None; | ||
self.tcx.for_each_relevant_impl(trait_def_id, trait_ref.self_ty(), |impl_def_id| { | ||
if trait_impl.is_none() { | ||
trait_impl = Some(impl_def_id); | ||
} | ||
}); | ||
self.tcx.for_each_relevant_impl( | ||
trait_def_id, | ||
trait_ref.skip_binder().self_ty(), | ||
|impl_def_id| { | ||
if trait_impl.is_none() { | ||
trait_impl = Some(impl_def_id); | ||
} | ||
}, | ||
); | ||
trait_impl | ||
}; | ||
let required_trait_path = self.tcx.def_path_str(trait_ref.def_id()); | ||
|
@@ -1434,7 +1444,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { | |
let mut err = match predicate.kind() { | ||
ty::PredicateKind::Trait(ref data, _) => { | ||
let trait_ref = data.to_poly_trait_ref(); | ||
let self_ty = trait_ref.self_ty(); | ||
let self_ty = trait_ref.skip_binder().self_ty(); | ||
debug!("self_ty {:?} {:?} trait_ref {:?}", self_ty, self_ty.kind, trait_ref); | ||
|
||
if predicate.references_error() { | ||
|
@@ -1552,7 +1562,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { | |
} | ||
ty::PredicateKind::Projection(ref data) => { | ||
let trait_ref = data.to_poly_trait_ref(self.tcx); | ||
let self_ty = trait_ref.self_ty(); | ||
let self_ty = trait_ref.skip_binder().self_ty(); | ||
let ty = data.skip_binder().ty; | ||
if predicate.references_error() { | ||
return; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay