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

Don't fail builds #5

Merged
merged 8 commits into from
May 17, 2023
Merged

Don't fail builds #5

merged 8 commits into from
May 17, 2023

Conversation

parker-codes
Copy link
Owner

One comment in particular on Reddit really hit me:

RIP reproducible builds

This has changed my perspective of a hard fail, even if they could just bump the date. There's also #1 to think about and solve, so making these not block the dependency tree goes hand in hand with making it a warning instead.

The first step here is just adding #[cfg(test)] to the compile_error!() call. That "solves" the build problem pretty cleanly, in fact. As expected, when building a project I am not blocked. The editor still shows the compiler error when I hover over, which is nice. Tests with todo_by!() calls that have expired will fail. So the tests are still not completely solved because my dependencies could have todo_by!() calls that cause my tests to fail even though I didn't change anything. Not good.

Screenshot 2023-05-14 at 5 37 10 PM Screenshot 2023-05-14 at 5 37 33 PM

Since Macro Diagnostics are still not ready for Stable Rust, @Emilgardis showcased a workaround we can pull from where we pass the error message through a "deprecated" warning.

I'm going to attempt to keep the compiler error in the editor (that's a nice visual reminder), but never have it run, even in tests. I'd rather just show the warnings, and even then I hope to be able to scope it to the current project and not show warnings from dependencies - that hopefully happens out of the box with deprecation warnings!

@parker-codes
Copy link
Owner Author

parker-codes commented May 16, 2023

Switching to #[must_use = #message] is a better DX than #[deprecated(note = #message)]! It is less clutter in the code, doesn't cause a strikethrough, and actually doesn't show up as an error at all, which is funny and nice. The end result is that we see the error message in the editor, it doesn't block builds, and there's no confusing "use of deprecated constant 'main::_::TODO'" in there..

I still need to figure out how to show the editor error/warning, but not actually fail builds and tests.


Highlights errors in editor.

Screenshot 2023-05-16 at 4 27 11 PM

Doesn't block dev. Unfortunately still blocks tests.

Screenshot 2023-05-16 at 4 28 10 PM

@parker-codes parker-codes merged commit 3712365 into main May 17, 2023
@parker-codes parker-codes deleted the chore/dont-fail-builds branch May 17, 2023 14:31
@parker-codes parker-codes changed the title Draft: Don't fail builds Don't fail builds May 17, 2023
@parker-codes parker-codes mentioned this pull request Sep 30, 2024
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.

1 participant