Skip to content

checked does nothing without #[stabby::export] #125

@matejcik

Description

@matejcik

the following code compiles with no errors:

#[stabby::stabby(checked)]
pub trait Trait {
    extern "C" fn func(&self, opt: Option<u8>) -> u8;
}

impl Trait for u8 {
    extern "C" fn func(&self, opt: Option<u8>) -> u8 {
        opt.unwrap_or(0)
    }
}

fn main() {
    let mut value = 42;
    let dynptr = <stabby::dynptr!(&'_ mut dyn Trait)>::from(&mut value);
    dynptr.func(Some(42));
}

far as I and my AI friends were able to determine, all the bounds for IStable are generated correctly, but nothing nowhere asserts the ABI stability

i tried to figure out an automated insertion point for assert_stable. and it seems to me that it can't really be done if there are any generic types involved, because you need a concrete type for assert_stable, correct? still, it may be nice to insert it if no generics are present.
in my usecase there's a root API trait that can't be generic, so that would trigger a stability check for the whole API-accessible tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions