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

Imported document about undefined behavior and safe api in LLD #127

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

pellico
Copy link

@pellico pellico commented Dec 9, 2024

No description provided.

@JoelMarcey JoelMarcey requested a review from PLeVasseur December 9, 2024 20:21
@JoelMarcey JoelMarcey added the coding guidelines Related to work in the Coding Guidelines Subcommittee label Dec 9, 2024
Copy link
Collaborator

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

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

Hi @pellico -- I gave this an initial read today, found a few suggestions. I'd like to read through it again and review.

I'd suggest posting a link to this PR into the Zulip to see if we can have further review by others as well 🙂

pellico and others added 3 commits December 11, 2024 09:04
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Pete LeVasseur <[email protected]>
…43/pellico/safety-critical-rust-consortium into rust_safety_low_level_driver
Copy link
Contributor

@vapdrs vapdrs left a comment

Choose a reason for hiding this comment

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

Interesting read. I left some comments, mostly grammar related.

Comment on lines +207 to +209
- C API are by default unsafe. Are not referring to external C
program? If the previous definition holds, they should be considered
safe.
Copy link
Contributor

Choose a reason for hiding this comment

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

My thought here would be that because as you defined for the unsafe block,

the contract necessary to call the operations inside the block has been checked by the programmer and is guaranteed to be respected

Any calls made via C API should be considered default unsafe until a programmer checks to ensure the contract of the API is fulfilled and Rust's safety guarantees will be met.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry but I don't fully understand this comment.
I am trying to explain that there is a contradiction between the statement:

Rust`s safety guarantees only cover what the program itself can do, and
not what entities outside the program can do to it.

and the fact that FFI (external word) are considered unsafe by the compiler.
Moreover the definition of unsafe block is copied from here

Are you proposing a change in the text ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was not proposing a change in the text. I just didn't understand that you were setting up a contradiction there.

I understand what you are saying now, after reading your reply. Perhaps you could consider making that section more explicit, or you could just leave it as is.

pellico and others added 9 commits December 18, 2024 16:23
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
…guidelines/rust-embedded-lld-safe-definition.md

Co-authored-by: Douglas Deslauriers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coding guidelines Related to work in the Coding Guidelines Subcommittee
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants