This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +62
-26
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 3 files changed +62
-26
lines changed Original file line number Diff line number Diff line change @@ -512,18 +512,15 @@ function initSearch(rawSearchIndex) {
512512 bindingName,
513513 } ;
514514 }
515+ const quadcolon = / : : \s * : : / . exec ( path ) ;
515516 if ( path . startsWith ( "::" ) ) {
516517 throw [ "Paths cannot start with " , "::" ] ;
517518 } else if ( path . endsWith ( "::" ) ) {
518519 throw [ "Paths cannot end with " , "::" ] ;
519- } else if ( path . includes ( "::::" ) ) {
520- throw [ "Unexpected " , "::::" ] ;
521- } else if ( path . includes ( " ::" ) ) {
522- throw [ "Unexpected " , " ::" ] ;
523- } else if ( path . includes ( ":: " ) ) {
524- throw [ "Unexpected " , ":: " ] ;
525- }
526- const pathSegments = path . split ( / : : | \s + / ) ;
520+ } else if ( quadcolon !== null ) {
521+ throw [ "Unexpected " , quadcolon [ 0 ] ] ;
522+ }
523+ const pathSegments = path . split ( / (?: : : \s * ) | (?: \s + (?: : : \s * ) ? ) / ) ;
527524 // In case we only have something like `<p>`, there is no name.
528525 if ( pathSegments . length === 0 || ( pathSegments . length === 1 && pathSegments [ 0 ] === "" ) ) {
529526 if ( generics . length > 0 || prevIs ( parserState , ">" ) ) {
Original file line number Diff line number Diff line change @@ -143,6 +143,15 @@ const PARSED = [
143143 userQuery : "a::::b" ,
144144 error : "Unexpected `::::`" ,
145145 } ,
146+ {
147+ query : "a:: ::b" ,
148+ elems : [ ] ,
149+ foundElems : 0 ,
150+ original : "a:: ::b" ,
151+ returned : [ ] ,
152+ userQuery : "a:: ::b" ,
153+ error : "Unexpected `:: ::`" ,
154+ } ,
146155 {
147156 query : "a::b::" ,
148157 elems : [ ] ,
@@ -314,24 +323,6 @@ const PARSED = [
314323 userQuery : 'a<->' ,
315324 error : 'Unexpected `-` after `<`' ,
316325 } ,
317- {
318- query : "a:: a" ,
319- elems : [ ] ,
320- foundElems : 0 ,
321- original : 'a:: a' ,
322- returned : [ ] ,
323- userQuery : 'a:: a' ,
324- error : 'Unexpected `:: `' ,
325- } ,
326- {
327- query : "a ::a" ,
328- elems : [ ] ,
329- foundElems : 0 ,
330- original : 'a ::a' ,
331- returned : [ ] ,
332- userQuery : 'a ::a' ,
333- error : 'Unexpected ` ::`' ,
334- } ,
335326 {
336327 query : "a<a>:" ,
337328 elems : [ ] ,
Original file line number Diff line number Diff line change @@ -15,6 +15,54 @@ const PARSED = [
1515 userQuery : "a::b" ,
1616 error : null ,
1717 } ,
18+ {
19+ query : "a:: a" ,
20+ elems : [ {
21+ name : "a:: a" ,
22+ fullPath : [ "a" , "a" ] ,
23+ pathWithoutLast : [ "a" ] ,
24+ pathLast : "a" ,
25+ generics : [ ] ,
26+ typeFilter : - 1 ,
27+ } ] ,
28+ foundElems : 1 ,
29+ original : 'a:: a' ,
30+ returned : [ ] ,
31+ userQuery : 'a:: a' ,
32+ error : null ,
33+ } ,
34+ {
35+ query : "a ::a" ,
36+ elems : [ {
37+ name : "a ::a" ,
38+ fullPath : [ "a" , "a" ] ,
39+ pathWithoutLast : [ "a" ] ,
40+ pathLast : "a" ,
41+ generics : [ ] ,
42+ typeFilter : - 1 ,
43+ } ] ,
44+ foundElems : 1 ,
45+ original : 'a ::a' ,
46+ returned : [ ] ,
47+ userQuery : 'a ::a' ,
48+ error : null ,
49+ } ,
50+ {
51+ query : "a :: a" ,
52+ elems : [ {
53+ name : "a :: a" ,
54+ fullPath : [ "a" , "a" ] ,
55+ pathWithoutLast : [ "a" ] ,
56+ pathLast : "a" ,
57+ generics : [ ] ,
58+ typeFilter : - 1 ,
59+ } ] ,
60+ foundElems : 1 ,
61+ original : 'a :: a' ,
62+ returned : [ ] ,
63+ userQuery : 'a :: a' ,
64+ error : null ,
65+ } ,
1866 {
1967 query : 'A::B,C' ,
2068 elems : [
You can’t perform that action at this time.
0 commit comments