forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust: experiment with
#[derive(SmartPointer)]
I am sending this RFC patch to share my experience with using the new `#[derive(SmartPointer)]` feature [1] with our custom smart pointers. The feature is being added so that the kernel can stop using the unstable dispatch_from_dyn and unsize features. In general, the feature appears to work. As can be seen in the change to `rust_minimal.rs`, it is possible to use `Arc` together with a dynamic trait object, and the trait object is object safe even though it uses the custom smart pointer as a self parameter. I did run into one nit, which is that `Arc` requires the `#[pointee]` annotation even though there's only one generic paramter. I filed an issue [2] about this. Link: https://rust-lang.github.io/rfcs/3621-derive-smart-pointer.html [1] Link: rust-lang/rust#129465 [2] Signed-off-by: Alice Ryhl <aliceryhl@google.com>
- Loading branch information
1 parent
b204bbc
commit e8b105c
Showing
4 changed files
with
26 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters