Visualizing Rust's Vtables: How dyn Trait Works In Memory

(sofiabelen.github.io)

71 points | by torutofu 7 hours ago

1 comments

  • ketzu 14 minutes ago
    > In Rust, that question is answered by the borrow-checker at compile time:

    (About zero sized objects being the same)

    But why does that mean the programmer never has to check? (or if they want that information from the borrow checker how would they get it?) It's not motivated as the intro above for c++ was just "In C++, we might do this to check if two pointers refer to the same object".

    So the borrow checker knows already, why does that stop the programmer from wanting to know or separate these cases?