- Notifications
You must be signed in to change notification settings - Fork 158
Closed
Description
Using this svd and svd2rust version 0.31.2, 0.31.3, or 0.31.4 generates a PAC that fails to build.
0.31.1 and 0.30.3 do generate a PAC that can successfully build.
This is the error returned:
error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function --> src/dma.rs:109:20 | 109 | (0..4).map(|n| unsafe { | ^^^ may outlive borrowed value `self` 110 | &*(self as *const Self) | ---- `self` is borrowed here | note: closure is returned here --> src/dma.rs:109:9 | 109 | / (0..4).map(|n| unsafe { 110 | | &*(self as *const Self) 111 | | .cast::<u8>() 112 | | .add(256) 113 | | .add(256 * n) 114 | | .cast() 115 | | }) | |__________^ help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword | 109 | (0..4).map(move |n| unsafe { | ++++ here is the generated code that it is referring to (or you can view it here):
#[doc = "Iterator for array of:"] #[doc = "0x100..0x150 - Cluster CH%s, containing SrcAddr, DstAddr, LLI, Control, Config"] #[inline(always)] pub fn ch_iter(&self) -> impl Iterator<Item = &CH> { (0..4).map(|n| unsafe { &*(self as *const Self) .cast::<u8>() .add(256) .add(256 * n) .cast() }) }applying the fix in that error message is sufficient to get the PAC to build.
the cluster that is causing the issues is on line 24279 of the svd, in case this is specific to the way the cluster is written.
Metadata
Metadata
Assignees
Labels
No labels