Skip to content

Conversation

@mkroening
Copy link
Member

@mkroening mkroening commented Jan 13, 2026

When documenting #574 with --document-private-items, I got

warning: this URL is not a hyperlink
  --> src/structures/paging/mapper/mapped_page_table.rs:54:9
   |
54 |     /// https://github.com/rust-lang/rfcs/pull/2585.
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: bare URLs are not automatically turned into clickable links
   = note: `#[warn(rustdoc::bare_urls)]` on by default
help: use an automatic link instead
   |
54 |     /// <https://github.com/rust-lang/rfcs/pull/2585.>
   |         +                                            +

This made me take a closer look at the doc comment and the function added in c336201:

/// Helper function for implementing Mapper. Safe to limit the scope of unsafe, see
/// https://github.com/rust-lang/rfcs/pull/2585.
fn map_to_1gib<A>(
&mut self,
page: Page<Size1GiB>,
frame: PhysFrame<Size1GiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A,
) -> Result<MapperFlush<Size1GiB>, MapToError<Size1GiB>>
where
A: FrameAllocator<Size4KiB> + ?Sized,

I think it is better to avoid this intentional internal unsoundness. After making the function unsafe and removing the link from the doc comment, I noticed that these methods are only used in one place, which is already correctly unsafe. So instead, I inlined them.

If you prefer any of the other two options (fixing the hyperlink or making the function unsafe), please let me know. :)

@Freax13
Copy link
Member

Freax13 commented Jan 14, 2026

Thank you for your contribution!

I agree with your reasoning.

If you prefer, I can also target master, but this does not seem important enough for me.

By default, changes should target master, unless they are breaking changes.

@mkroening mkroening changed the base branch from next to master January 14, 2026 08:55
@mkroening
Copy link
Member Author

By default, changes should target master, unless they are breaking changes.

Done. 👍

Copy link
Member

@Freax13 Freax13 left a comment

Choose a reason for hiding this comment

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

Thanks!

@Freax13 Freax13 merged commit bb4fd95 into rust-osdev:master Jan 14, 2026
12 checks passed
@mkroening mkroening deleted the inline-map_to branch January 14, 2026 09:22
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.

2 participants