diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-09-22 11:55:03 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-09-24 09:04:26 +0200 |
| commit | 3f9015b22d774dd2af0c3c95dbfb0270d5e0bf7e (patch) | |
| tree | 13fc13260e5448b5fb0d16ddc1919c7e40792402 /src | |
| parent | b8402d6a6e6cadd3d877c952a2c5bbd694afbc2d (diff) | |
visit impl self ty + trait
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/const-generics/const_evaluatable_checked/impl-bounds.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/impl-bounds.rs b/src/test/ui/const-generics/const_evaluatable_checked/impl-bounds.rs new file mode 100644 index 00000000000..193a365f9b6 --- /dev/null +++ b/src/test/ui/const-generics/const_evaluatable_checked/impl-bounds.rs @@ -0,0 +1,25 @@ +// check-pass +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] + +use std::mem::size_of; + +struct Foo<T, const N: usize>(T); + +impl<T> Foo<T, { size_of::<T>() }> { + fn test() { + let _: [u8; std::mem::size_of::<T>()]; + } +} + +trait Bar<const N: usize> { + fn test_me(); +} + +impl<T> Bar<{ size_of::<T>() }> for Foo<T, 3> { + fn test_me() { + let _: [u8; std::mem::size_of::<T>()]; + } +} + +fn main() {} |
