I understand the pointer is not actually dereferenced - my impression was that the ptr has to be valid as-if it was dereferenced.
In some OO language, a method call involves passing a
this ptr as a hidden parameter; whether the parameter must be non-null or not is a lang design decision. I’m aware of
arbitrary_self_types but I’m not sure what guarantees/restrictions it carries, such as in this case: is
*const Self allowed to be null? Your responses indicate yes. Is that mentioned/documented somewhere? Or does it merely fall out of raw ptrs being allowed to be null and therefore arbitrary self types just “inherit” that?
Also, suppose arbitrary self types were out of the picture or required that self raw ptrs are not null (for sake of argument). Are there other reasons the compiler couldn’t fabricate a vtbl ptr?
At the end of the day, it seems odd that it’s so difficult to fabricate a null ptr, generically. The compiler, in a lot of ways, is likely best positioned to provide that facility (somehow - how exactly, I guess that’s what this thread is about at this point ).