Open
Description
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