1

CFI: Strip auto traits off Virtual calls by maurer · Pull Request #122879 · rust...

 1 month ago
source link: https://github.com/rust-lang/rust/pull/122879
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Contributor

We already use Instance at declaration sites when available to glean additional information about possible abstractions of the type in use. This does the same when possible at callsites as well.

The primary purpose of this change is to allow CFI to alter how it generates type information for indirect calls through Virtual instances.

This is needed for the "separate machinery" version of my approach to the vtable issues (#122573), because we need to respond differently to a Virtual call to the same type as a non-virtual call, specifically stripping auto traits off the receiver's Self because there isn't a separate vtable for Foo vs Foo + Send.

This would also make a more general underlying mechanism that could be used by rcvalle's proposed drop detection / encoding if we end up using his approach, as we could condition out on the def_id in the CFI code rather than requiring the generating code to explicitly note whether it was calling drop.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK