mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 03:57:37 +00:00
34 lines
459 B
Rust
34 lines
459 B
Rust
![]() |
// check-pass
|
||
|
|
||
|
#![feature(const_trait_impl)]
|
||
|
|
||
|
trait Tr {
|
||
|
fn req(&self);
|
||
|
|
||
|
fn prov(&self) {
|
||
|
println!("lul");
|
||
|
self.req();
|
||
|
}
|
||
|
|
||
|
#[default_method_body_is_const]
|
||
|
fn default() {}
|
||
|
}
|
||
|
|
||
|
impl const Tr for u8 {
|
||
|
fn req(&self) {}
|
||
|
fn prov(&self) {}
|
||
|
}
|
||
|
|
||
|
macro_rules! impl_tr {
|
||
|
($ty: ty) => {
|
||
|
impl const Tr for $ty {
|
||
|
fn req(&self) {}
|
||
|
fn prov(&self) {}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl_tr!(u64);
|
||
|
|
||
|
fn main() {}
|