mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Merge #11622
11622: show variadic args in hover function signature r=Veykril a=euclio The current behavior is to ignore the ellipsis. Co-authored-by: Andy Russell <arussell123@gmail.com>
This commit is contained in:
commit
f1f9163b27
@ -86,6 +86,11 @@ impl HirDisplay for Function {
|
||||
// The former will ignore lifetime arguments currently.
|
||||
type_ref.hir_fmt(f)?;
|
||||
}
|
||||
|
||||
if data.is_varargs() {
|
||||
write!(f, ", ...")?;
|
||||
}
|
||||
|
||||
write!(f, ")")?;
|
||||
|
||||
// `FunctionData::ret_type` will be `::core::future::Future<Output = ...>` for async fns.
|
||||
|
@ -1757,6 +1757,30 @@ fn foo() { let bar = Bar; bar.fo$0o(); }
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_variadic_function() {
|
||||
check(
|
||||
r#"
|
||||
extern "C" {
|
||||
pub fn foo(bar: i32, ...) -> i32;
|
||||
}
|
||||
|
||||
fn main() { let foo_test = unsafe { fo$0o(1, 2, 3); } }
|
||||
"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
pub unsafe fn foo(bar: i32, ...) -> i32
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_trait_has_impl_action() {
|
||||
check_actions(
|
||||
|
Loading…
Reference in New Issue
Block a user