@@ -373,11 +373,13 @@ pub(crate) fn runnable_impl(
373
373
let adt_name = ty. as_adt ( ) ?. name ( sema. db ) ;
374
374
let mut ty_args = ty. type_arguments ( ) . peekable ( ) ;
375
375
let params = if ty_args. peek ( ) . is_some ( ) {
376
- format ! ( "<{}>" , ty_args. format_with( ", " , |ty, cb| cb( & ty. display( sema. db) ) ) )
376
+ format ! ( "<{}>" , ty_args. format_with( "," , |ty, cb| cb( & ty. display( sema. db) ) ) )
377
377
} else {
378
378
String :: new ( )
379
379
} ;
380
- let test_id = TestId :: Path ( format ! ( "{}{}" , adt_name, params) ) ;
380
+ let mut test_id = format ! ( "{}{}" , adt_name, params) ;
381
+ test_id. retain ( |c| c != ' ' ) ;
382
+ let test_id = TestId :: Path ( test_id) ;
381
383
382
384
Some ( Runnable { use_name_in_title : false , nav, kind : RunnableKind :: DocTest { test_id } , cfg } )
383
385
}
@@ -441,10 +443,11 @@ fn module_def_doctest(db: &RootDatabase, def: Definition) -> Option<Runnable> {
441
443
format_to ! (
442
444
path,
443
445
"<{}>" ,
444
- ty_args. format_with( ", " , |ty, cb| cb( & ty. display( db) ) )
446
+ ty_args. format_with( "," , |ty, cb| cb( & ty. display( db) ) )
445
447
) ;
446
448
}
447
449
format_to ! ( path, "::{}" , def_name) ;
450
+ path. retain ( |c| c != ' ' ) ;
448
451
return Some ( path) ;
449
452
}
450
453
}
@@ -2067,13 +2070,23 @@ mod tests {
2067
2070
$0
2068
2071
struct Foo<T, U>;
2069
2072
2073
+ /// ```
2074
+ /// ```
2070
2075
impl<T, U> Foo<T, U> {
2071
2076
/// ```rust
2072
2077
/// ````
2073
2078
fn t() {}
2074
2079
}
2080
+
2081
+ /// ```
2082
+ /// ```
2083
+ impl Foo<Foo<(), ()>, ()> {
2084
+ /// ```
2085
+ /// ```
2086
+ fn t() {}
2087
+ }
2075
2088
"# ,
2076
- & [ DocTest ] ,
2089
+ & [ DocTest , DocTest , DocTest , DocTest ] ,
2077
2090
expect ! [ [ r#"
2078
2091
[
2079
2092
Runnable {
@@ -2082,12 +2095,64 @@ impl<T, U> Foo<T, U> {
2082
2095
file_id: FileId(
2083
2096
0,
2084
2097
),
2085
- full_range: 47..85,
2098
+ full_range: 20..103,
2099
+ focus_range: 47..56,
2100
+ name: "impl",
2101
+ kind: Impl,
2102
+ },
2103
+ kind: DocTest {
2104
+ test_id: Path(
2105
+ "Foo<T,U>",
2106
+ ),
2107
+ },
2108
+ cfg: None,
2109
+ },
2110
+ Runnable {
2111
+ use_name_in_title: false,
2112
+ nav: NavigationTarget {
2113
+ file_id: FileId(
2114
+ 0,
2115
+ ),
2116
+ full_range: 63..101,
2117
+ name: "t",
2118
+ },
2119
+ kind: DocTest {
2120
+ test_id: Path(
2121
+ "Foo<T,U>::t",
2122
+ ),
2123
+ },
2124
+ cfg: None,
2125
+ },
2126
+ Runnable {
2127
+ use_name_in_title: false,
2128
+ nav: NavigationTarget {
2129
+ file_id: FileId(
2130
+ 0,
2131
+ ),
2132
+ full_range: 105..188,
2133
+ focus_range: 126..146,
2134
+ name: "impl",
2135
+ kind: Impl,
2136
+ },
2137
+ kind: DocTest {
2138
+ test_id: Path(
2139
+ "Foo<Foo<(),()>,()>",
2140
+ ),
2141
+ },
2142
+ cfg: None,
2143
+ },
2144
+ Runnable {
2145
+ use_name_in_title: false,
2146
+ nav: NavigationTarget {
2147
+ file_id: FileId(
2148
+ 0,
2149
+ ),
2150
+ full_range: 153..186,
2086
2151
name: "t",
2087
2152
},
2088
2153
kind: DocTest {
2089
2154
test_id: Path(
2090
- "Foo<T, U >::t",
2155
+ "Foo<Foo<(),()>,() >::t",
2091
2156
),
2092
2157
},
2093
2158
cfg: None,
0 commit comments