Skip to content

Commit f2bc09e

Browse files
Fix invalid deduplication
1 parent 8fab482 commit f2bc09e

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

src/librustdoc/html/static/main.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@
462462
if (isType !== true || obj.type) {
463463
var res = buildHrefAndPath(obj);
464464
obj.displayPath = pathSplitter(res[0]);
465-
obj.fullPath = obj.displayPath + obj.n;
465+
obj.fullPath = obj.displayPath + obj.name;
466466
obj.href = res[1];
467467
out.push(obj);
468468
if (out.length >= MAX_RESULTS) {
@@ -1259,17 +1259,10 @@
12591259
var length = 0;
12601260
if (array.length > 0) {
12611261
output = '<table class="search-results"' + extraStyle + '>';
1262-
var shown = [];
12631262

12641263
array.forEach(function(item) {
12651264
var name, type;
12661265

1267-
var id_ty = item.ty + item.path + item.name;
1268-
if (shown.indexOf(id_ty) !== -1) {
1269-
return;
1270-
}
1271-
1272-
shown.push(id_ty);
12731266
name = item.name;
12741267
type = itemTypes[item.ty];
12751268

src/test/rustdoc-js/deduplication.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
// ignore-order
12+
13+
const QUERY = 'is_nan';
14+
15+
const EXPECTED = {
16+
'others': [
17+
{ 'path': 'std::f32', 'name': 'is_nan' },
18+
{ 'path': 'std::f64', 'name': 'is_nan' },
19+
{ 'path': 'std::option::Option', 'name': 'is_none' },
20+
],
21+
};

src/tools/rustdoc-js/tester.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ function main(argv) {
160160
// execQuery first parameter is built in getQuery (which takes in the search input).
161161
// execQuery last parameter is built in buildIndex.
162162
// buildIndex requires the hashmap from search-index.
163-
var functionsToLoad = ["levenshtein", "validateResult", "getQuery", "buildIndex", "execQuery",
164-
"execSearch"];
163+
var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult",
164+
"getQuery", "buildIndex", "execQuery", "execSearch"];
165165

166166
finalJS += 'window = { "currentCrate": "std" };\n';
167+
finalJS += 'var rootPath = "../";\n';
167168
finalJS += ALIASES;
168169
finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs);
169170
finalJS += loadThings(variablesToLoad, 'variable', extractVariable, mainJs);

0 commit comments

Comments
 (0)