Skip to content

rust: kernel: clean rustdoc warnings #412

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

Merged
merged 1 commit into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/kernel/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use core::{mem::ManuallyDrop, ops::Deref};
///
/// # Invariants
///
/// The pointer [`File::ptr`] is non-null and valid. Its reference count is also non-zero.
/// The pointer `File::ptr` is non-null and valid. Its reference count is also non-zero.
Copy link
Member

Choose a reason for hiding this comment

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

I think you can use File.ptr as link.

Copy link
Member Author

Choose a reason for hiding this comment

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

That works, but the link appears still as "[File.ptr]" i.e. it is still broken because it points to a private field. :-(

Copy link
Member Author

Choose a reason for hiding this comment

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

The other day we were discussing whether the invariants should be public or hide them, or whether we wanted to have private fields shown. Not sure what we will do.

Copy link
Member

Choose a reason for hiding this comment

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

Of course. It is private. Maybe say "The inner pointer" as you can't see the ptr field in the docs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that is another option, definitely.

Copy link

Choose a reason for hiding this comment

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

Of course. It is private. Maybe say "The inner pointer" as you can't see the ptr field in the docs?

That is sort of I what I did for rbtrees: https://github.com/Rust-for-Linux/linux/pull/400/files#diff-0cb585b4b0d3d30535d603fd0ae07753fcd5a180b13d8f9f06164093c4551722R40

pub struct File {
pub(crate) ptr: *mut bindings::file,
}
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/file_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
///
/// # Invariants
///
/// The pointer [`PollTable::ptr`] is null or valid.
/// The pointer `PollTable::ptr` is null or valid.
pub struct PollTable {
ptr: *mut bindings::poll_table_struct,
}
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/iov_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern "C" {
///
/// # Invariants
///
/// The pointer [`IovIter::ptr`] is non-null and valid.
/// The pointer `IovIter::ptr` is non-null and valid.
pub struct IovIter {
ptr: *mut bindings::iov_iter,
}
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
///
/// # Invariants
///
/// The pointer [`Pages::pages`] is valid and points to 2^ORDER pages.
/// The pointer `Pages::pages` is valid and points to 2^ORDER pages.
pub struct Pages<const ORDER: u32> {
pages: *mut bindings::page,
}
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern "C" {
///
/// # Invariants
///
/// The pointer [`Task::ptr`] is non-null and valid. Its reference count is also non-zero.
/// The pointer `Task::ptr` is non-null and valid. Its reference count is also non-zero.
///
/// # Examples
///
Expand Down