mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Add const_fn in generics test
This commit is contained in:
@@ -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>);
|
||||
}
|
||||
Reference in New Issue
Block a user