Rollup merge of #149332 - asukaminato0721:149324, r=GuillaumeGomez
fix rustdoc search says “Consider searching for "null" instead.” #149324 fix rust-lang/rust#149324 Now builds the “generic parameter” correction banner from discrete sentence fragments and appends the “Consider searching …” clause only when query.proposeCorrectionTo is non-null, so the UI no longer renders null as the suggested type. Adds a PARSED section with two queries: one typo (Result<SomeTraiz>) that still produces a concrete suggestion and one fully unknown type (Result<NoSuchTrait>) that leaves proposeCorrectionTo null.
This commit is contained in:
commit
5d8529467a
2 changed files with 26 additions and 3 deletions
|
|
@ -5050,9 +5050,11 @@ ${obj.displayPath}<span class="${type}">${name}</span>\
|
|||
if (query.proposeCorrectionFrom !== null && isTypeSearch) {
|
||||
const orig = query.proposeCorrectionFrom;
|
||||
const targ = query.proposeCorrectionTo;
|
||||
correctionOutput = "<h3 class=\"search-corrections\">" +
|
||||
`Type "${orig}" not found and used as generic parameter. ` +
|
||||
`Consider searching for "${targ}" instead.</h3>`;
|
||||
let message = `Type "${orig}" not found and used as generic parameter.`;
|
||||
if (targ !== null) {
|
||||
message += ` Consider searching for "${targ}" instead.`;
|
||||
}
|
||||
correctionOutput = `<h3 class="search-corrections">${message}</h3>`;
|
||||
}
|
||||
if (firstResult.value) {
|
||||
if (correctionOutput !== "") {
|
||||
|
|
|
|||
|
|
@ -95,3 +95,24 @@ const EXPECTED = [
|
|||
],
|
||||
},
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
'query': 'Result<SomeTraiz>',
|
||||
'userQuery': 'Result<SomeTraiz>',
|
||||
'foundElems': 1,
|
||||
'returned': [],
|
||||
'error': null,
|
||||
'proposeCorrectionFrom': 'SomeTraiz',
|
||||
'proposeCorrectionTo': 'SomeTrait',
|
||||
},
|
||||
{
|
||||
'query': 'Result<NoSuchTrait>',
|
||||
'userQuery': 'Result<NoSuchTrait>',
|
||||
'foundElems': 1,
|
||||
'returned': [],
|
||||
'error': null,
|
||||
'proposeCorrectionFrom': 'NoSuchTrait',
|
||||
'proposeCorrectionTo': null,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue