Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/simple.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/simple.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/simple.rs b/crates/hir-ty/src/tests/simple.rs index 3ece40486d..fb0aa2faf1 100644 --- a/crates/hir-ty/src/tests/simple.rs +++ b/crates/hir-ty/src/tests/simple.rs @@ -1829,6 +1829,38 @@ impl Foo for u8 { } #[test] +fn const_eval_in_function_signature() { + check_types( + r#" +const fn foo() -> usize { + 5 +} + +fn f() -> [u8; foo()] { + loop {} +} + +fn main() { + let t = f(); + //^ [u8; 5] +}"#, + ); + check_types( + r#" +//- minicore: default, builtin_impls +fn f() -> [u8; Default::default()] { + loop {} +} + +fn main() { + let t = f(); + //^ [u8; 0] +} + "#, + ); +} + +#[test] fn shadowing_primitive_with_inner_items() { check_types( r#" |