check(
r#"const foo$0: u32 = 123;"#,
expect![[r#"
- *foo*
+ *foo*
- ```rust
- test
- ```
+ ```rust
+ test
+ ```
- ```rust
- const foo: u32
- ```
- "#]],
+ ```rust
+ const foo: u32 = 123
+ ```
+ "#]],
+ );
+ check(
+ r#"
+const foo$0: u32 = {
+ let x = foo();
+ x + 100
+};"#,
+ expect![[r#"
+ *foo*
+
+ ```rust
+ test
+ ```
+
+ ```rust
+ const foo: u32 = {
+ let x = foo();
+ x + 100
+ }
+ ```
+ "#]],
);
+
check(
r#"static foo$0: u32 = 456;"#,
expect![[r#"
}
"#,
expect![[r#"
- *C*
+ *C*
- ```rust
- test
- ```
+ ```rust
+ test
+ ```
- ```rust
- const C: u32
- ```
- "#]],
+ ```rust
+ const C: u32 = 1
+ ```
+ "#]],
)
}
file_id: FileId(
1,
),
- full_range: 254..436,
- focus_range: 293..299,
+ full_range: 276..458,
+ focus_range: 315..321,
name: "Future",
kind: Trait,
description: "pub trait Future",
}
"#,
expect![[r#"
- *FOO*
+ *FOO*
- ```rust
- test
- ```
+ ```rust
+ test
+ ```
- ```rust
- const FOO: usize
- ```
+ ```rust
+ const FOO: usize = 3
+ ```
- ---
+ ---
- This is a doc
- "#]],
+ This is a doc
+ "#]],
);
}
fn hover_attribute_in_macro() {
check(
r#"
+//- minicore:derive
macro_rules! identity {
($struct:item) => {
$struct
fn hover_derive_input() {
check(
r#"
+//- minicore:derive
#[rustc_builtin_macro]
pub macro Copy {}
#[derive(Copy$0)]
);
check(
r#"
+//- minicore:derive
mod foo {
#[rustc_builtin_macro]
pub macro Copy {}
);
"#,
expect![[r#"
- *[`Foo`]*
+ *[`Foo`]*
- ```rust
- test
- ```
+ ```rust
+ test
+ ```
- ```rust
- pub struct Foo
- ```
+ ```rust
+ pub struct Foo
+ ```
- ---
+ ---
- Doc comment for [`Foo`](https://docs.rs/test/*/test/struct.Foo.html)
- "#]],
+ Doc comment for [`Foo`](https://doc.rust-lang.org/nightly/test/struct.Foo.html)
+ "#]],
);
}
pub struct Foo;
"#,
expect![[r#"
- *[`Foo`]*
+ *[`Foo`]*
- ```rust
- test
- ```
+ ```rust
+ test
+ ```
- ```rust
- pub struct Foo
- ```
+ ```rust
+ pub struct Foo
+ ```
- ---
+ ---
- Doc comment for [`Foo`](https://docs.rs/test/*/test/struct.Foo.html)
- "#]],
+ Doc comment for [`Foo`](https://doc.rust-lang.org/nightly/test/struct.Foo.html)
+ "#]],
);
}