Handle `derive_coerce_pointee` feature and associated `derive(CoercePointee)`

Open
#4,839 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, rust
Domain
compilers

Research direction

Start by searching the gccrs source for derive_coerce_pointee and CoercePointee, then read the linked Rust documentation for the expected derive behavior. Compare the implementation requirements with the kernel usages in rust/kernel/list/arc.rs, rust/kernel/alloc/kbox.rs, and rust/kernel/sync/arc.rs. Done means gccrs handles the feature and associated derive consistently with those examples.

Written by the indexing model from the issue text.

Description

rust-for-linux typechecking

This is used in multiple places in the kernel, grep for CoercePointee:

../rust-for-linux/rust/kernel/list/arc.rs
163:#[derive(core::marker::CoercePointee)]
164-pub struct ListArc<T, const ID: u64 = 0>

../rust-for-linux/rust/kernel/alloc/kbox.rs
103:#[derive(core::marker::CoercePointee)]
104-pub struct Box<#[pointee] T: ?Sized, A: Allocator>(NonNull<T>, PhantomData<A>);

../rust-for-linux/rust/kernel/sync/arc.rs
131:#[derive(core::marker::CoercePointee)]
132-pub struct Arc<T: ?Sized> {
--
541:#[derive(core::marker::CoercePointee)]
542-pub struct ArcBorrow<'a, T: ?Sized + 'a> {

https://doc.rust-lang.org/nightly/core/marker/derive.CoercePointee.html

This is probably going to be hard to implement and exclusively touches typechecking as far as I can tell.

Dominant language
C++
Stars
3k
Forks
238
Avg merge
4d 8h
Merged PRs (30d)
31

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rust-GCC/gccrs

All issues in Rust-GCC/gccrs

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.