Rust-GCC / Rust-GCC/gccrs

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

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

Nobody has claimed this yet.

rust-for-linux typechecking
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

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.

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.