Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc-search: fix a race condition in search index loading #118961

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Dec 15, 2023

var declare it in the global scope, and const does not. It needs to be declared in global scope.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const

const declarations do not create properties on globalThis when declared at the top level of a script.

Fixes a regression introduced by #118910

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 15, 2023
`var` declare it in the global scope, and `const` does not.
It needs to be declared in global scope.
@GuillaumeGomez
Copy link
Member

Can you send a regression test in a follow-up PR please?

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Dec 15, 2023

📌 Commit 09c8fd3 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2023
@bors
Copy link
Contributor

bors commented Dec 15, 2023

⌛ Testing commit 09c8fd3 with merge 96df494...

@bors
Copy link
Contributor

bors commented Dec 15, 2023

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 96df494 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 15, 2023
@bors bors merged commit 96df494 into rust-lang:master Dec 15, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 15, 2023
@notriddle notriddle deleted the notriddle/varconst branch December 15, 2023 14:25
@notriddle
Copy link
Contributor Author

Is there any way to force search.js to finish loading after search-index.js does in browser-ui-test? I couldn’t find one (the existing test cases already break on my machine).

@GuillaumeGomez
Copy link
Member

You can't, however there is an easy way to prevent the bug: having a counter and when it reaches two, then calling the search. I can send a fix if you want?

@notriddle
Copy link
Contributor Author

That sounds good, sure.

@GuillaumeGomez
Copy link
Member

Still need a regression test though. ;)

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (96df494): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
-5.4% [-5.4%, -5.4%] 1
All ❌✅ (primary) 0.1% [-0.5%, 0.6%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 2

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 672.135s -> 671.047s (-0.16%)
Artifact size: 312.47 MiB -> 312.39 MiB (-0.03%)

notriddle added a commit to notriddle/rust that referenced this pull request Dec 15, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 15, 2023
…illaumeGomez

rustdoc: add regression test for JS data file loading

Follow up for rust-lang#118961
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 15, 2023
…illaumeGomez

rustdoc: add regression test for JS data file loading

Follow up for rust-lang#118961
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2023
Rollup merge of rust-lang#118988 - notriddle:notriddle/varconst, r=GuillaumeGomez

rustdoc: add regression test for JS data file loading

Follow up for rust-lang#118961
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants