-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The #[pointee]
attribute is required even if there is only one generic parameter
#129465
Labels
C-bug
Category: This is a bug.
F-derive_coerce_pointee
Feature: RFC 3621's oft-renamed implementation
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
rustbot
added
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
F-derive_coerce_pointee
Feature: RFC 3621's oft-renamed implementation
labels
Aug 23, 2024
Darksonn
added a commit
to Darksonn/linux
that referenced
this issue
Aug 23, 2024
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>
Darksonn
added a commit
to Darksonn/linux
that referenced
this issue
Aug 23, 2024
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>
Darksonn
added a commit
to Darksonn/linux
that referenced
this issue
Aug 23, 2024
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>
Darksonn
added a commit
to Darksonn/linux
that referenced
this issue
Aug 23, 2024
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>
89 tasks
@rustbot claim |
Oh, also, the error message says "At least one generic" but it's not valid to have several pointees. |
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this issue
Aug 26, 2024
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>
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Aug 28, 2024
…ax-pointee, r=compiler-errors derive(SmartPointer): assume pointee from the single generic and better error messages Fix rust-lang#129465 Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say. cc `@Darksonn` r? `@compiler-errors`
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Aug 29, 2024
…ax-pointee, r=compiler-errors derive(SmartPointer): assume pointee from the single generic and better error messages Fix rust-lang#129465 Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say. cc ``@Darksonn`` r? ``@compiler-errors``
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Aug 29, 2024
Rollup merge of rust-lang#129467 - dingxiangfei2009:smart-pointer-relax-pointee, r=compiler-errors derive(SmartPointer): assume pointee from the single generic and better error messages Fix rust-lang#129465 Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say. cc ```@Darksonn``` r? ```@compiler-errors```
saethlin
added
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
C-bug
Category: This is a bug.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Aug 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
F-derive_coerce_pointee
Feature: RFC 3621's oft-renamed implementation
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Currently, the following code triggers a compilation failure.
However, the RFC says that specifying
#[pointee]
when the struct has only one type parameter is allowed, but not required.See also this patch on the LKML.
Tracking issue: #123430
cc @dingxiangfei2009
The text was updated successfully, but these errors were encountered: