Skip to content

Disallow implementation of UnsizedConstParamTy and ConstParamTy_ in user code #150963

@HackingRepo

Description

@HackingRepo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)F-adt_const_params`#![feature(adt_const_params)]`F-unsized_const_params`#![feature(unsized_const_params)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions