Make sure to detect trait upcasting coercion even after normalization
This commit is contained in:
parent
7e66c0b7ed
commit
24eefd08e2
4 changed files with 20 additions and 29 deletions
|
@ -315,7 +315,13 @@ fn rematch_object<'tcx>(
|
|||
// If we're upcasting, get the offset of the vtable pointer, otherwise get
|
||||
// the base of the vtable.
|
||||
Ok(Some(if is_upcasting {
|
||||
ImplSource::TraitUpcasting(ImplSourceTraitUpcastingData { vtable_vptr_slot, nested })
|
||||
// If source and target trait def ids are identical,
|
||||
// then we are simply removing auto traits.
|
||||
if source_trait_ref.def_id() == target_trait_ref.def_id() {
|
||||
ImplSource::Builtin(nested)
|
||||
} else {
|
||||
ImplSource::TraitUpcasting(ImplSourceTraitUpcastingData { vtable_vptr_slot, nested })
|
||||
}
|
||||
} else {
|
||||
ImplSource::Object(ImplSourceObjectData { vtable_base, nested })
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue