小编mak*_*aki的帖子

如何在没有赋值的情况下声明静态可变变量?

我尝试了以下内容

struct mbuf
{
  cacheline: *mut [u64],               // great amount of rows follows below
  // ..........
}
static mut arr: [mbuf; 32];                // Q1 my main aim
// something as before but using Vec;      // Q2 also main aim

fn main() {
 // let static mut arr: [mbuf; 32];        // Q3 also doesn't work
 // static mut arr: [mbuf; 32];            // Q3 also doesn't work
}
Run Code Online (Sandbox Code Playgroud)

并得到错误

src/main.rs:74:29: 74:30 error: expected one of `+` or `=`, found `;`
src/main.rs:74   static …
Run Code Online (Sandbox Code Playgroud)

static global declaration rust

7
推荐指数
2
解决办法
2530
查看次数

标签 统计

declaration ×1

global ×1

rust ×1

static ×1