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.rs54
1 files changed, 53 insertions, 1 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 9c53b05539..491471428f 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -423,7 +423,7 @@ fn main() {
## Captures
* `x.f1` by move
- * `(*x.f2.0.0).f` by mutable borrow
+ * `x.f2.0.0.f` by mutable borrow
"#]],
);
check(
@@ -11079,6 +11079,58 @@ impl PublicFlags for NoteDialects {
}
#[test]
+fn hover_recursive_const_fn() {
+ check(
+ r#"
+//- minicore: option
+enum Child {
+ Static { child: &'static MyEnum },
+}
+
+enum MyEnum {
+ Unit,
+ Array(Child),
+}
+
+impl MyEnum {
+ pub const fn static_array(child: &'static MyEnum) -> Self {
+ MyEnum::Array(Child::Static { child })
+ }
+}
+
+pub trait MyTrait {
+ const MY_CONST: &'static MyEnum;
+}
+
+impl<T> MyTrait for Option<T> where T: MyTrait {
+ const MY_CONST: &'static MyEnum = &MyEnum::static_array(T::MY_CONST);
+}
+
+impl MyTrait for () {
+ const MY_CONST: &'static MyEnum = &MyEnum::Unit;
+}
+
+pub struct Address;
+
+impl MyTrait for Address {
+ const MY_CONST$0: &'static MyEnum = (<Option<()> as MyTrait>::MY_CONST);
+}
+ "#,
+ expect![[r#"
+ *MY_CONST*
+
+ ```rust
+ ra_test_fixture::Address
+ ```
+
+ ```rust
+ const MY_CONST: &'static MyEnum = &Array(Static { child: &Unit })
+ ```
+ "#]],
+ );
+}
+
+#[test]
fn bounds_from_container_do_not_panic() {
check(
r#"