Skip to content

need to check privacy for constants with adt_const_params and mgce #57

Open
@lcnr

Description

@lcnr

What is this

This is a design document for const generics. Any discussions about its content should be on zulip. The conclusions of these discussions should then be edited back into this issue. Please do not post any comments directly in this issue.

Content

trait Trait<T> {}

mod private {
    use crate::Trait;
    struct Private;
    impl Trait<Private> for () {}
}

fn fetch<T: Trait<U>, U>() -> U {
    todo!()
}

fn main() {
    let x = fetch::<(), _>();  //~ ERROR type `Private` is private
}

we have to make sure we also consider constants violate our privacy rules, most notably:

  • with mgce we could infer a constant to be a private generic const item
  • with adt_const_params we need to handle the type of const params, even if these could be checked eagerly as part of the function definition

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-design-docsCategory: This is part of our design documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions