Skip to content

Commit

Permalink
Add const_fn in generics test
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKnodt committed Oct 27, 2020
1 parent 1cd97ca commit 23c4a46
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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>);
}

0 comments on commit 23c4a46

Please sign in to comment.