mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
fix: Panic when displaying generic params with defaults
This commit is contained in:
parent
e7c8b2fd81
commit
405520150d
2 changed files with 55 additions and 1 deletions
|
@ -9416,3 +9416,53 @@ fn f<T: UnCompat$0>
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_18613() {
|
||||
check(
|
||||
r#"
|
||||
fn main() {
|
||||
struct S<T, D = bool>();
|
||||
let x$0 = S::<()>;
|
||||
}"#,
|
||||
expect![[r#"
|
||||
*x*
|
||||
|
||||
```rust
|
||||
let x: fn S<()>() -> S<()>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
size = 0, align = 1
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
r#"
|
||||
pub struct Global;
|
||||
pub struct Box<T, A = Global>(T, A);
|
||||
|
||||
impl<T> Box<T> {
|
||||
pub fn new(x: T) -> Self { loop {} }
|
||||
}
|
||||
|
||||
pub struct String;
|
||||
|
||||
fn main() {
|
||||
let box_value$0 = Box::<String>new();
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*box_value*
|
||||
|
||||
```rust
|
||||
let box_value: fn Box<String>(String, Global) -> Box<String>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
size = 0, align = 1
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue