diff options
| author | Gary Guo <gary@garyguo.net> | 2021-10-11 18:20:20 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2021-10-11 18:20:20 +0100 |
| commit | 0a03f8c78bff3adf164ad2fefd6ea767de25ec9e (patch) | |
| tree | 5e3c10c7a0e2023e534fc306ecbbbc1e937d6ba5 /src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs | |
| parent | de940fc72553065cdf213a55c2d8bc7059e414ff (diff) | |
| download | rust-0a03f8c78bff3adf164ad2fefd6ea767de25ec9e.tar.gz rust-0a03f8c78bff3adf164ad2fefd6ea767de25ec9e.zip | |
Split impl-with-default-fn test into a pass test and a fail test
Diffstat (limited to 'src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs')
| -rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs new file mode 100644 index 00000000000..ba3fec0882b --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs @@ -0,0 +1,34 @@ +// check-pass + +#![feature(const_trait_impl)] +#![feature(const_fn_trait_bound)] + +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() {} |
