Skip to content

Update layer_by_layer.adoc to clarify PAC limitations #4259

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

natevw
Copy link

@natevw natevw commented May 27, 2025

proposed fix for #4226, re. #4226 (comment)

@i509VCB
Copy link
Member

i509VCB commented May 27, 2025

I still think it is valuable to emphasize a pac may result in unsafe code if you program the hardware incorrectly (DMA is the primary example of this). lulf did mention this in the linked issue.

Technically I think pac crates should be 100% unsafe, but that would only result in a lot of extra unsafe {} blocks with no real benefit unless you explain every single instance of unsafe access.

@workingjubilee
Copy link

workingjubilee commented May 29, 2025

Technically I think pac crates should be 100% unsafe, but that would only result in a lot of extra unsafe {} blocks with no real benefit unless you explain every single instance of unsafe access.

Constructing a type unsafely... even a ZST that can be created anywhere... that then exposes the API of the crate using safe functions would allow you to contain the unsafe to a single invocation. The ergonomics would still take a small hit from occasionally having to will that ZST into existence using a line of code, but I think "you have to use unsafe code to cause memory corruption" is a worthwhile property to preserve in Rust programs.

Probably best to create a separate issue if we want to discuss that idea further, though.

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