fn generate_concrete_vtable_shims(
methods: &[TraitMethod],
type_ident: &Ident,
trait_name: &Ident,
trait_path: &Path,
concrete_type: &Type,
) -> TokenStreamExpand description
Generate concrete vtable shims for a generic trait impl.
For generic traits (e.g., RExtend<T>), shims and the vtable builder function
cannot be generated at the trait definition site because where clauses like
Vec<T>: TryFromSexp cause recursive trait resolution overflow. Instead, we
generate fully monomorphized shims at the impl site where T is known (e.g., T = i32).
Each instance method gets a concrete unsafe extern "C" shim named
__vtshim_{Type}__{Trait}__{method} that:
- Checks argument arity
- Wraps everything in
with_r_unwind_protect - Extracts SEXP arguments to concrete Rust types
- Calls the method via fully-qualified syntax
<Type as Trait>::method() - Converts the result back to SEXP
Static methods are skipped (not part of the vtable).