Skip to content

Removed all usages of lazy_static and replaced them with once_cell #865

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

Merged
merged 1 commit into from
Jul 3, 2020

Conversation

Kixiron
Copy link
Member

@Kixiron Kixiron commented Jun 29, 2020

  • Replaced lazy_static with once_cell (using the parking_lot feature for smaller, faster and non-poisoning locks)
  • Tweaked load_rustc_resource_suffix, it now substitutes a dummy rustc version for tests when one isn't found. This fixed a lot of intermittent (and essentially false) test failures for me, I can remove it if it's uneeded

@pietroalbini
Copy link
Member

This fixed a lot of intermittent (and essentially false) test failures for me, I can remove it if it's uneeded

Those are not test failures: when that function fails the error message is logged with log::error!(), and the execution proceeds as normal. If you disable output capturing you'll see that message in every test using the frontend. It's just that the test is having another error, so you also see the log.

@Kixiron
Copy link
Member Author

Kixiron commented Jun 29, 2020

It was causing a lot of errors for me (as opposed to being silent), 29 of them to be exact. Without the patch I made I get lots of this, whereas after all tests pass

---- web::rustdoc::test::test_no_trailing_slash stdout ----
[2020-06-29T19:14:51Z ERROR cratesfyi::web::page::templates] Failed to load rustc resource suffix: ErrorMessage { msg: "missing rustc version" }
thread 'web::rustdoc::test::test_no_trailing_slash' panicked at '/crate/dummy/0.1.0/target-redirect/x86_64-apple-darwin: expected redirect to /dummy/0.1.0/dummy/, got 500 Internal Server Error', src\test\mod.rs:79:13

---- web::source::tests::cargo_ok_not_skipped stdout ----
[2020-06-29T19:14:51Z ERROR cratesfyi::web::page::templates] Failed to load rustc resource suffix: ErrorMessage { msg: "missing rustc version" }
thread 'web::source::tests::cargo_ok_not_skipped' panicked at 'failed to GET /crate/fake/0.1.0/source/: 500 Internal Server Error', src\test\mod.rs:44:5

---- web::rustdoc::test::yanked_release_shows_warning_in_nav stdout ----
[2020-06-29T19:14:51Z ERROR cratesfyi::web::page::templates] Failed to load rustc resource suffix: ErrorMessage { msg: "missing rustc version" }
thread 'web::rustdoc::test::yanked_release_shows_warning_in_nav' panicked at 'failed to GET /dummy/0.1.0/dummy/: 500 Internal Server Error', src\test\mod.rs:44:5

---- web::test::test_index_returns_success stdout ----
[2020-06-29T19:14:55Z ERROR cratesfyi::web::page::templates] Failed to load rustc resource suffix: ErrorMessage { msg: "missing rustc version" }
thread 'web::test::test_index_returns_success' panicked at 'assertion failed: web.get("/").send()?.status().is_success()', src\web\mod.rs:637:13

---- web::test::test_show_clipboard_for_crate_pages stdout ----
[2020-06-29T19:14:55Z ERROR cratesfyi::web::page::templates] Failed to load rustc resource suffix: ErrorMessage { msg: "missing rustc version" }
thread 'web::test::test_show_clipboard_for_crate_pages' panicked at 'assertion failed: clipboard_is_present_for_path("/crate/fake_crate/0.0.1", web)', src\web\mod.rs:653:13

@Kixiron
Copy link
Member Author

Kixiron commented Jun 29, 2020

And the docker failure here is due to #864, it's fixed in #849

@pietroalbini
Copy link
Member

@Kixiron hmm? The tests you mention correctly pass for me on master.

@pietroalbini
Copy link
Member

Those tests also work on this PR with the #[cfg(test)] removed.

@Kixiron
Copy link
Member Author

Kixiron commented Jun 30, 2020

I removed the cfg

@Kixiron Kixiron requested a review from pietroalbini June 30, 2020 18:54
@Kixiron Kixiron force-pushed the unlazy branch 2 times, most recently from b22a540 to 027327a Compare July 2, 2020 16:25
@jyn514 jyn514 merged commit c239bcf into rust-lang:master Jul 3, 2020
@Kixiron Kixiron deleted the unlazy branch July 3, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants