diff options
| author | kadmin <julianknodt@gmail.com> | 2020-10-26 08:19:05 +0000 |
|---|---|---|
| committer | kadmin <julianknodt@gmail.com> | 2020-10-27 19:22:13 +0000 |
| commit | 23c4a46efffebec56648d1b87204466acf1eb15f (patch) | |
| tree | cc16f847795a67abcb9c03f67543a38e5e30eec8 | |
| parent | 1cd97cad6e5f85bed455f505f330ead1d5cd8432 (diff) | |
| download | rust-23c4a46efffebec56648d1b87204466acf1eb15f.tar.gz rust-23c4a46efffebec56648d1b87204466acf1eb15f.zip | |
Add const_fn in generics test
| -rw-r--r-- | src/test/ui/const-generics/min_const_generics/const_fn_in_generics.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/const_fn_in_generics.rs b/src/test/ui/const-generics/min_const_generics/const_fn_in_generics.rs new file mode 100644 index 00000000000..3370666cc5c --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/const_fn_in_generics.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(min_const_generics)] + +const fn identity<const T: u32>() -> u32 { T } + +#[derive(Eq, PartialEq, Debug)] +pub struct ConstU32<const U: u32>; + +pub fn new() -> ConstU32<{ identity::<3>() }> { + ConstU32::<{ identity::<3>() }> +} + +fn main() { + let v = new(); + assert_eq!(v, ConstU32::<3>); +} |
