1
Fork 0

Random type checker changes

This commit is contained in:
Michael Goulet 2024-01-23 15:10:23 +00:00
parent 021861aea8
commit 5fc39e0796
13 changed files with 59 additions and 93 deletions

View file

@ -12,7 +12,9 @@ use rustc_trait_selection::traits::StructurallyNormalizeExt;
#[derive(Copy, Clone, Debug)]
pub enum AutoderefKind {
/// A true pointer type, such as `&T` and `*mut T`.
Builtin,
/// A type which must dispatch to a `Deref` implementation.
Overloaded,
}
@ -83,6 +85,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
(AutoderefKind::Builtin, ty)
}
} else if let Some(ty) = self.overloaded_deref_ty(self.state.cur_ty) {
// The overloaded deref check already normalizes the pointee type.
(AutoderefKind::Overloaded, ty)
} else {
return None;

View file

@ -254,7 +254,7 @@ fn compare_method_predicate_entailment<'tcx>(
// checks. For the comparison to be valid, we need to
// normalize the associated types in the impl/trait methods
// first. However, because function types bind regions, just
// calling `normalize_associated_types_in` would have no effect on
// calling `FnCtxt::normalize` would have no effect on
// any associated types appearing in the fn arguments or return
// type.