Skip to content

Type-based search does not work for primitives since March #74780

Closed
@jyn514

Description

@jyn514

searched nightlies: from nightly-2019-05-02 to nightly-2020-07-17
regressed nightly: nightly-2020-03-20
searched commits: from f509b26 to f4c675c
regressed commit: f4c675c

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --script ./search_works.sh --start 2019-05-02 --preserve 

search_works.sh:

#!/bin/sh
set -eu
rustdoc search_function_type.rs
node ~/rustc/src/tools/rustdoc-js/tester.js --doc-folder doc --crate-name search_function_type --test-file ~/rustc/src/test/rustdoc-js/tmp/search-function-type.js

search_function_type.rs:

/// f
pub fn f(u: usize) -> usize {
    u
}

search-function-type.js:

const QUERY = 'usize -> usize';

const EXPECTED = {
    'in_args': [
        { 'path': 'search_function_type', 'name': 'f' },
    ],
};

This requires a git clone of rustc as well as the following modification to tester.js:

diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js
index 139e6f73f42..8a3ab056f80 100644
--- a/src/tools/rustdoc-js/tester.js
+++ b/src/tools/rustdoc-js/tester.js
@@ -182,7 +182,7 @@ function loadThings(thingsToLoad, kindOfLoad, funcToCall, fileContent) {
         var tmp = funcToCall(fileContent, thingsToLoad[i]);
         if (tmp === null) {
             console.log('unable to find ' + kindOfLoad + ' "' + thingsToLoad[i] + '"');
-            process.exit(1);
+            continue;
         }
         content += tmp;
         content += 'exports.' + thingsToLoad[i] + ' = ' + thingsToLoad[i] + ';';

Originally reported in #60485 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-based-searchArea: Searching rustdoc pages using type signaturesC-bugCategory: This is a bug.P-highHigh priorityT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions