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

Add more doc comments to restricted kernel #4746

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

jul-sh
Copy link
Contributor

@jul-sh jul-sh commented Feb 2, 2024

This should help other teams find their way around more easily

This should help other teams find their way around more easily
Comment on lines +40 to 43
/// Simple no_std compatible equivalent of [`std::io::Read`].
///
/// [`std::io::Read`]: <https://doc.rust-lang.org/std/io/trait.Read.html>
pub trait Read {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

interestingly rust doc does not get these links by default. Perhaps related to the building docs from a crate that declares #![no_std]

Copy link
Collaborator

@conradgrobler conradgrobler left a comment

Choose a reason for hiding this comment

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

Thanks

@@ -106,6 +106,8 @@ impl EncryptionKeyProvider {
}
}

/// Exposes the ability to derive a session key from for the provided encapsulated private key,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: "from for" -> "from"

Comment on lines 38 to 49
/// #![feature(alloc_error_handler)]
///
/// extern crate alloc;
///
/// use oak_restricted_kernel_sdk::entrypoint;
///
/// #[entrypoint]
/// fn start_enclave_app() -> ! {
/// // business logic starts here
/// /* ... */
/// }
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

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

interesting bit of trivia, when running tests, cargo compiles this! and throws an error

11 | fn start_enclave_app() -> ! {
   |    -----------------      ^ expected `!`, found `()`

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was going to ask about that, because indeed it does not seem semantically correct Rust, and cargo test should reject it. Anyways you can fix that with a loop {} or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An unimplemented takes care of it. But we run into issues still since the examples declares no_std, which leads us down the rabbit hole of needing to set up the proper target to run the test with (I got that working with https://doc.rust-lang.org/cargo/reference/unstable.html#per-package-target), and then also setting up our own no_std test harness (that's where I gave up).

Unfortunately I think we have to instruct the compiler to ignore this doc test for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tracked in #4748

@jul-sh jul-sh merged commit ec4f8b9 into project-oak:main Feb 2, 2024
14 of 17 checks passed
@jul-sh jul-sh deleted the sdk-cleanup branch February 2, 2024 16:21
k-naliuka pushed a commit to k-naliuka/oak that referenced this pull request Feb 5, 2024
* Add more doc comments to restricted kernel

This should help other teams find their way around more easily

* fix typos

* ignore doctest since it fails compiling for a no_std target

* fix todo so the linter won't complain
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.

4 participants