8

#[target_feature(..)] In Trait Methods

 3 years ago
source link: https://github.com/rust-lang/rfcs/pull/3042
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.
neoserver,ios ssh client

Member

joshtriplett commented 7 days ago

This looks great.

One bit of feedback: I think it should be possible to omit the #[target_feature] on the trait impl, if and only if you're not actually using the #[target_feature] for that particular impl. It wouldn't be implicitly added; if you want it on your impl, you'd still have to write it.

The idea is that the #[target_feature] on the trait definition requires callers of the trait to either use unsafe or have the requisite target feature themselves. However, just because the caller meets that requirement doesn't mean the callee has to use that feature. So, the trait impl could leave off the #[target_feature] if it wants to.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK