-
Notifications
You must be signed in to change notification settings - Fork 87
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
[Resolves #142] Add lifetimes to VAddr & PAddr #150
base: main
Are you sure you want to change the base?
[Resolves #142] Add lifetimes to VAddr & PAddr #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks.
}; | ||
use kerla_utils::alignment::align_down; | ||
|
||
/// Represents a physical memory address. | ||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] | ||
#[repr(transparent)] | ||
pub struct PAddr(usize); | ||
pub struct PAddr<'memory> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 'a
to follow a naming convention in Rust.
pub struct PAddr<'memory> { | |
pub struct PAddr<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nuta there's no such convention - lifetimes should be named in meaningful way.
@@ -61,33 +61,33 @@ bitflags! { | |||
#[derive(Debug)] | |||
pub struct PageAllocError; | |||
|
|||
pub struct OwnedPages { | |||
paddr: PAddr, | |||
pub struct OwnedPages<'memory> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
pub struct OwnedPages<'memory> { | |
pub struct OwnedPages<'a> { |
I haven't tested locally but how about deleting |
Description
An unfinished attempt to add lifetimes to
VAddr
&PAddr
(as per #142).@nuta I stuck with:
I'm not the expert of lifetimes, but I read this a problem with the lifetime of the closure as argument of
traverse()
. Any suggestions welcome.Pre-Submission Checklist
When you submit a PR, please make sure your PR satisfies the following checklist:
cargo clippy
warnings.rustfmt
.