Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/hover/tests.rs')
-rw-r--r--crates/ide/src/hover/tests.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 62404afc4b..3580c45702 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -4080,6 +4080,37 @@ const FOO$0: f64 = 1.0f64;
}
#[test]
+fn hover_const_eval_in_generic_trait() {
+ // Doesn't compile, but we shouldn't crash.
+ check(
+ r#"
+trait Trait<T> {
+ const FOO: bool = false;
+}
+struct S<T>(T);
+impl<T> Trait<T> for S<T> {
+ const FOO: bool = true;
+}
+
+fn test() {
+ S::FOO$0;
+}
+"#,
+ expect![[r#"
+ *FOO*
+
+ ```rust
+ test
+ ```
+
+ ```rust
+ const FOO: bool = true
+ ```
+ "#]],
+ );
+}
+
+#[test]
fn hover_const_pat() {
check(
r#"