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

Fixed triggering a debug-assertion during scan #2612

Merged
merged 6 commits into from
Nov 27, 2024

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Nov 26, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

Fixes #2611

skip-changelog because of the change in esp-hal

Testing

Change that assert from debug_assert_eq to assert_eq and just run the wifi-dhcp example

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Nov 26, 2024

Failing tests seem to be random and unrelated - will just rerun them once GitHub calms down

@bjoernQ bjoernQ marked this pull request as ready for review November 26, 2024 11:06
Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also remove the debug assert and place a warning there instead

@bugadani
Copy link
Contributor

bugadani commented Nov 26, 2024

I think we should also remove the debug assert and place a warning there instead

I disagree, making a mistake will possibly become unsound if we don't panic. That assert is verifying an unsafe precondition.

What we may do is keep the debug_assert, but warn in release, but if we do everything correctly that warning will never print and just takes up code space.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Nov 26, 2024

I think we should also remove the debug assert and place a warning there instead

I disagree, making a mistake will possibly become unsound if we don't panic. That assert is verifying an unsafe precondition.

Probably a usual assert then - debug_assert didn't help much since we almost never enable debug-assertions (which is why we never noticed it)

@bugadani
Copy link
Contributor

The standard library also uses debug asserts for this purpose, and misuse is UB in release - same as we would do. We can also enable debug assertions for release builds.

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, lets keep the debug_assert then, but can we also change this to true in hil-test and examples please

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Nov 26, 2024

The standard library also uses debug asserts for this purpose, and misuse is UB in release - same as we would do. We can also enable debug assertions for release builds.

We should at least test with debug-assertions enabled - then it's fine but an assert which we'll never see is ... not of much use

@bugadani
Copy link
Contributor

We can recommend using debug-assertions = true if we absolutely require --release, but users will ignore both of those anyway. We could do the un-rusty thing of gating asserts with an esp-config, that way we could actually force them on by default.

@bjoernQ bjoernQ added the skip-changelog No changelog modification needed label Nov 27, 2024
esp-hal/build.rs Outdated Show resolved Hide resolved
@jessebraham jessebraham added this pull request to the merge queue Nov 27, 2024
Merged via the queue into esp-rs:main with commit cfb83b1 Nov 27, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

esp-wifi: wrong size event data
4 participants