Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
// used for special search precedence
var TY_PRIMITIVE = itemTypes.indexOf("primitive");
var TY_KEYWORD = itemTypes.indexOf("keyword");
var TY_MACRO = itemTypes.indexOf("macro");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY_MACRO is no longer used anywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! Good catch!


onEach(document.getElementsByClassName('js-only'), function(e) {
removeClass(e, 'js-only');
Expand Down Expand Up @@ -465,10 +466,8 @@
var res = buildHrefAndPath(obj);
obj.displayPath = pathSplitter(res[0]);
obj.fullPath = obj.displayPath + obj.name;
if (obj.ty === TY_KEYWORD) {
// To be sure than it isn't considered as duplicate with items.
obj.fullPath += '|k';
}
// To be sure than it some items aren't considered as duplicate.
obj.fullPath += '|' + obj.ty;
obj.href = res[1];
out.push(obj);
if (out.length >= MAX_RESULTS) {
Expand Down
20 changes: 20 additions & 0 deletions src/test/rustdoc-js/macro-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-order

const QUERY = 'panic';

const EXPECTED = {
'others': [
{ 'path': 'std', 'name': 'panic', ty: 14 }, // 15 is for macros
{ 'path': 'std', 'name': 'panic', ty: 0 }, // 0 is for modules
],
};
2 changes: 1 addition & 1 deletion src/tools/rustdoc-js/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function main(argv) {

var arraysToLoad = ["itemTypes"];
var variablesToLoad = ["MAX_LEV_DISTANCE", "MAX_RESULTS",
"TY_PRIMITIVE", "TY_KEYWORD",
"TY_PRIMITIVE", "TY_KEYWORD", "TY_MACRO",
"levenshtein_row2"];
// execQuery first parameter is built in getQuery (which takes in the search input).
// execQuery last parameter is built in buildIndex.
Expand Down