rust/tests/ui/const-generics/generic_const_exprs/issue-105257.rs

11 lines
457 B
Rust

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
trait Trait<T> {
fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~^ ERROR: mismatched types
fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
}
fn main() {}