Disallow implementation of UnsizedConstParamTy and ConstParamTy_ in user code
Open
Nobody has claimed this yet.
A-const-generics
F-adt_const_params
F-unsized_const_params
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Hello, when i try
#![feature(unsized_const_params)]
use std::marker::ConstParamTy_;
use std::marker::UnsizedConstParamTy;
#[derive(PartialEq, Eq)]
pub struct MyStruct;
impl UnsizedConstParamTy for MyStruct {}
impl ConstParamTy_ for MyStruct {}
// Allowed
pub struct Test<const PARAM: MyStruct> {}
It works, You should allow only allow ConstParamTy and UnsizedConstParamTy derive macro in nightly and not expose the internal trait to user code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the Rust reproducer from the issue with the unsized_const_params feature enabled and confirm that user implementations of UnsizedConstParamTy and ConstParamTy_ compile. Then trace how these internal traits are exposed, with the goal of preventing direct user implementations while retaining the intended derive-macro path. Done means the reproducer is rejected for the direct impls and supported const-parameter usage remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100