Skip to content
Browse files

rustc: add docs to FnAbi::{of_fn_ptr,of_instance} and InstanceDef::Vi…

  • Loading branch information
eddyb committed Nov 27, 2019
1 parent 9da14a8 commit c2f4c57296f0d929618baed0b0d6eb594abf01eb
Showing with 16 additions and 1 deletion.
  1. +5 −1 src/librustc/ty/
  2. +11 −0 src/librustc/ty/
@@ -42,7 +42,11 @@ pub enum InstanceDef<'tcx> {
/// `DefId` is `FnTrait::call_*`.
FnPtrShim(DefId, Ty<'tcx>),

/// `<dyn Trait as Trait>::fn`
/// `<dyn Trait as Trait>::fn`, "direct calls" of which are implicitly
/// codegen'd as virtual calls.
/// NB: if this is reified to a `fn` pointer, a `ReifyShim` is used
/// (see `ReifyShim` above for more details on that).
Virtual(DefId, usize),

/// `<[mut closure] as FnOnce>::call_once`
@@ -2417,8 +2417,19 @@ where
+ HasTyCtxt<'tcx>
+ HasParamEnv<'tcx>,
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
/// NB: this doesn't handle virtual calls - those should use `FnAbi::of_instance`
/// instead, where the instance is a `InstanceDef::Virtual`.
fn of_fn_ptr(cx: &C, sig: ty::PolyFnSig<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;

/// Compute a `FnAbi` suitable for declaring/defining an `fn` instance, and for
/// direct calls to an `fn`.
/// NB: that includes virtual calls, which are represented by "direct calls"
/// to a `InstanceDef::Virtual` instance (of `<dyn Trait as Trait>::fn`).
fn of_instance(cx: &C, instance: ty::Instance<'tcx>, extra_args: &[Ty<'tcx>]) -> Self;

fn new_internal(
cx: &C,
sig: ty::PolyFnSig<'tcx>,

0 comments on commit c2f4c57

Please sign in to comment.
You can’t perform that action at this time.