diff options
| author | Ellen <supbscripter@gmail.com> | 2021-08-25 10:21:39 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2021-08-30 11:00:21 +0200 |
| commit | fcc2badf9b1e6d63c5221d206628ab1aaf3b5bdc (patch) | |
| tree | 22cb7d48f1b3958d1edd0a15f3f4cba23907f93e /src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs | |
| parent | dbb0fe9d803f7fa8688b33306266a6b054c2c3f4 (diff) | |
| download | rust-fcc2badf9b1e6d63c5221d206628ab1aaf3b5bdc.tar.gz rust-fcc2badf9b1e6d63c5221d206628ab1aaf3b5bdc.zip | |
rename const_evaluatable_checked to generic_const_exprs
:sparkles:
Diffstat (limited to 'src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs')
| -rw-r--r-- | src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs b/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs new file mode 100644 index 00000000000..d3f140755f7 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs @@ -0,0 +1,25 @@ +// check-pass +#![feature(const_generics, generic_const_exprs)] +#![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() {} |
