kerla
                                
                                
                                
                                    kerla copied to clipboard
                            
                            
                            
                        [Resolves #142] Add lifetimes to VAddr & PAddr
Description
An unfinished attempt to add lifetimes to VAddr & PAddr (as per #142).
@nuta I stuck with:
error[E0308]: mismatched types
   --> runtime/backtrace.rs:113:56
    |
113 |         Backtrace::current_frame().traverse(|_, vaddr: VAddr<'memory>| {
    |                                                        ^^^^^^^^^^^^^^ lifetime mismatch
    |
    = note: expected struct `address::VAddr<'_>`
               found struct `address::VAddr<'memory>`
note: the anonymous lifetime #1 defined here...
   --> runtime/backtrace.rs:113:45
    |
113 |           Backtrace::current_frame().traverse(|_, vaddr: VAddr<'memory>| {
    |  _____________________________________________^
114 | |             if let Some(symbol) = resolve_symbol(vaddr) {
115 | |                 let _ = trace.try_push(CapturedBacktraceFrame::<'memory> {
116 | |                     vaddr,
...   |
120 | |             }
121 | |         });
    | |_________^
note: ...does not necessarily outlive the lifetime `'memory` as defined here
   --> runtime/backtrace.rs:111:43
    |
111 |     pub fn capture() -> CapturedBacktrace<'memory> {
    |                                           ^^^^^^^
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:
- [X] I assert this contribution was authored by me.
 - [X] I license this contribution under the license of this project.
 - [X] The PR title describes your changes briefly and uses the present tense, without a trailing full stop.
 - [X] The PR description describes the reason why we need the change.
 - [X] This is an isolated change. No multiple changes and no unrelated changes are included.
 - [ ] Fixed all 
cargo clippywarnings. - [ ] Applied 
rustfmt. 
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.
I haven't tested locally but how about deleting : VAddr<'_>? Doesn't rustc infer it?