Skip to content

Commit

Permalink
De-tuple two vtable_trait_first_method_offset args.
Browse files Browse the repository at this point in the history
Thus eliminating a `FIXME` comment.
  • Loading branch information
nnethercote committed May 9, 2024
1 parent 24445d3 commit df6f713
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

let vtable_base = vtable_trait_first_method_offset(
tcx,
(unnormalized_upcast_trait_ref, ty::Binder::dummy(object_trait_ref)),
unnormalized_upcast_trait_ref,
ty::Binder::dummy(object_trait_ref),
);

Ok(ImplSource::Builtin(BuiltinImplSource::Object { vtable_base: vtable_base }, nested))
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_trait_selection/src/traits/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,11 @@ fn vtable_entries<'tcx>(
}

/// Find slot base for trait methods within vtable entries of another trait
// FIXME(@lcnr): This isn't a query, so why does it take a tuple as its argument.
pub(super) fn vtable_trait_first_method_offset<'tcx>(
tcx: TyCtxt<'tcx>,
key: (
ty::PolyTraitRef<'tcx>, // trait_to_be_found
ty::PolyTraitRef<'tcx>, // trait_owning_vtable
),
trait_to_be_found: ty::PolyTraitRef<'tcx>,
trait_owning_vtable: ty::PolyTraitRef<'tcx>,
) -> usize {
let (trait_to_be_found, trait_owning_vtable) = key;

// #90177
let trait_to_be_found_erased = tcx.erase_regions(trait_to_be_found);

Expand Down

0 comments on commit df6f713

Please sign in to comment.