Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide/src/signature_help.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs
index edcf0dc22b..dbecbafdd7 100644
--- a/crates/ide/src/signature_help.rs
+++ b/crates/ide/src/signature_help.rs
@@ -174,6 +174,9 @@ fn signature_help_for_call(
match callable.kind() {
hir::CallableKind::Function(func) => {
res.doc = func.docs(db).map(Documentation::into_owned);
+ if func.is_const(db) {
+ format_to!(res.signature, "const ");
+ }
if func.is_async(db) {
format_to!(res.signature, "async ");
}
@@ -2664,4 +2667,22 @@ fn main() {
"#]],
);
}
+
+ #[test]
+ fn test_const_function() {
+ check(
+ r#"
+//- minicore: sized, fn
+pub const fn foo(x: u32, y: u32) -> u32 { x + y }
+
+fn main() {
+ foo($0)
+}
+ "#,
+ expect![[r#"
+ const fn foo(x: u32, y: u32) -> u32
+ ^^^^^^ ------
+ "#]],
+ );
+ }
}