diff --git a/content/posts/operating-systems/deepin20.9.md b/content/posts/operating-systems/deepin20.9.md index b46ffc41..793d3b9c 100644 --- a/content/posts/operating-systems/deepin20.9.md +++ b/content/posts/operating-systems/deepin20.9.md @@ -77,6 +77,10 @@ repost: - **Vim** - **VSCode Great Icons** 文件图标主题 +{{< admonition question >}} +rust5-analyzer 插件可能会因为新版本要求 glibc 2.29 而导致启动失败,请参考这个 [issue](https://github.com/rust-lang/rust-analyzer/issues/11558) 来解决。 +{{< /admonition >}} + ## 终端和 Vim 新手教学文档: diff --git a/content/posts/riscv/openeuler-riscv-qemu-mugen.md b/content/posts/operating-systems/openeuler-riscv-qemu.md similarity index 96% rename from content/posts/riscv/openeuler-riscv-qemu-mugen.md rename to content/posts/operating-systems/openeuler-riscv-qemu.md index 86816e7e..0f17cff8 100644 --- a/content/posts/riscv/openeuler-riscv-qemu-mugen.md +++ b/content/posts/operating-systems/openeuler-riscv-qemu.md @@ -1,5 +1,5 @@ --- -title: "openEuler RISC-V 系统: QEMU 仿真和 Mugen 测试框架" +title: "openEuler RISC-V 系统: QEMU 仿真" subtitle: date: 2024-03-07T14:48:21+08:00 # draft: true @@ -19,6 +19,7 @@ tags: - openEuler - QEMU - Mugen + - Neofetch categories: - RISC-V - Operating Systems @@ -292,6 +293,19 @@ $ echo $? 我个人比较期待 RISC-V 配合 nommu 在嵌入式这类低功耗领域的发展,同时也对 [RISC-V Hypervisor Extension](https://riscv.org/wp-content/uploads/2017/12/Tue0942-riscv-hypervisor-waterman.pdf) 在虚拟化方面的发展感兴趣。 +## Neofetch + +根据 [neofetch wiki](https://github.com/dylanaraps/neofetch/wiki/Installation#latest-git-master-bleeding-edge) 从 git 拉取最新数据进行构建: + +```bash +$ git clone https://github.com/dylanaraps/neofetch +$ cd neofetch +$ make install +$ neofetch +``` + +{{< image src="/images/oerv/openEuler-RISC-V-neofetch.png" >}} + ## References - openEuler RISC-V: [通过 QEMU 仿真 RISC-V 环境并启动 OpenEuler RISC-V 系统](https://github.com/openeuler-mirror/RISC-V/blob/master/doc/tutorials/vm-qemu-oErv.md) diff --git a/content/posts/rust/subtying-and-variance.md b/content/posts/rust/subtying-and-variance.md index ffbc0943..745a425d 100644 --- a/content/posts/rust/subtying-and-variance.md +++ b/content/posts/rust/subtying-and-variance.md @@ -55,6 +55,38 @@ repost: - cplusplus: [strtok](https://cplusplus.com/reference/cstring/strtok/) - cppreference: [strtok](https://en.cppreference.com/w/cpp/string/byte/strtok) +### shortening lifetimes + +影片大概 19 分时给出了为何 cargo test 失败的推导,个人觉得非常巧妙 + +```rs +pub fn strtok<'a>(s: &'a mut &'a str, delimiter: char) { ... } + +let mut x = "hello world"; +strtok(&mut x, ' '); +``` + +为了更直观地表示和函数 `strtok` 的返回值 lifetime 无关,这里将返回值先去掉了。在调用 `strtok` 时,编译器对于参数 `s` 的 lifetime 推导如下: + +``` +&'a mut &'a str +& mut x + +&'a mut &'a str +& mut &'static str + +&'a mut &'static str +& mut &'static str + +&'static mut &'static str +& mut &'static str + +&'static mut &'static str +&'static mut &'static str +``` + +所以 `strtok` 在接收参数 `s` 后 (通过传入 `&mut x`),会推导其 lifetime 为 static,这就会导致后面使用 `x` 的不可变引用 (`&x`) 时发生冲突。 + ## Documentations 这里列举视频中一些概念相关的 documentation diff --git a/docs/404.html b/docs/404.html index d2752cb0..1ee4cf08 100644 --- a/docs/404.html +++ b/docs/404.html @@ -25,7 +25,7 @@