Skip to content

Commit 9735864

Browse files
committed
Rollup merge of #47667 - GuillaumeGomez:fix-quoted-search, r=QuietMisdreavus
Fix quoted search r? @QuietMisdreavus
2 parents 4cc2f96 + 7cc3cb2 commit 9735864

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
var lev_distance = MAX_LEV_DISTANCE + 1;
601601
if (obj.name === val.name) {
602602
if (literalSearch === true) {
603-
if (val.generics.length !== 0) {
603+
if (val.generics && val.generics.length !== 0) {
604604
if (obj.generics && obj.length >= val.generics.length) {
605605
var elems = obj.generics.slice(0);
606606
var allFound = true;
@@ -637,7 +637,7 @@
637637
}
638638
// Names didn't match so let's check if one of the generic types could.
639639
if (literalSearch === true) {
640-
if (obj.generics.length > 0) {
640+
if (obj.generics && obj.generics.length > 0) {
641641
for (var x = 0; x < obj.generics.length; ++x) {
642642
if (obj.generics[x] === val.name) {
643643
return true;

src/test/rustdoc-js/quoted.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
const QUERY = '"error"';
12+
13+
const EXPECTED = {
14+
'others': [
15+
{ 'path': 'std', 'name': 'error' },
16+
{ 'path': 'std::fmt', 'name': 'Error' },
17+
{ 'path': 'std::io', 'name': 'Error' },
18+
],
19+
'in_args': [],
20+
'returned': [
21+
{ 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
22+
],
23+
};

0 commit comments

Comments
 (0)