Jon Gjengset 新作:Rust for Rustaceans
Rust 程序员进阶资料
你会学到:
- 如何基于最佳原则设计可靠、惯用且符合人体工程学的 Rust 程序
- 声明宏和过程宏的有效使用,以及它们之间的区别
- 异步在 Rust 中是如何工作的
- Unsafe 代码意味着什么,以及编写 Unsafe 函数和特征并与之交互的最佳实践
- 如何组织和配置更复杂的 Rust 项目
- 如何编写可以与非 Rust 库和系统互操作或在受限和嵌入式环境中运行的 Rust 代码
https://nostarch.com/rust-rustaceans
Rustup 1.24.3 寻找测试人员
特别是针对 FreeBSD 的
https://internals.rust-lang.org/t/rustup-1-24-3-seeking-beta-testers-particularly-freebsd/14813
后现代风格文本编辑器
https://github.com/helix-editor/helix
用 Rust 编写的 Git 极速终端 UI
GitUI 是一个用 Rust 编写的用于 git 的终端 UI,我们的目标是在不离开你心爱的命令行终端窗口的情况下,以快速、只需键盘和跨平台的方式简化常见的 git 任务。
https://github.com/extrawurst/gitui
博客:基于 Rust 和 WebAssembly 的插件系统
https://devblog.arcana.rs/how-to-make-plugins-system-with-rust-and-webassembly
nushell 发布 0.32
https://www.nushell.sh/blog/2021-06-01-nushell_0_32.html
reddit 讨论:一个难以发现的 Bug
https://www.reddit.com/r/rust/comments/nqjyb7/the_most_annoying_bug_ive_had_to_track_down/
From 日报小组 @挺肥
社区学习交流平台订阅:
评论区
写评论感谢:)
--
👇
苦瓜小仔: The Most Annoying Bug I've Had To Track Down
I recently had this https://github.com/Morganamilo/paru/issues/392 bug reported to me.
The user came at me with a full backtrace so I thought it would be an easy fix. The bug appeared to be in the c bindings I was using, so clearly there's some subtle UB/error not being handled somewhere.
Yet I couldn't find anything wrong. No matter how many null checks and assertions I put around the place.
Then I figured out what wrong: https://github.com/archlinux/alpm.rs/commit/5253d6
Perviously, when getting a pointer to a union the code did
Due to the &mut being outside the unsafe block this actually takes a reference to a temporary variables instead of the union filed.
It effectively looks like:
The fix is to just move the &mut into the unsafe block, making rust not create a temporary variable and actually reference the union.
This is the first time rust has let me footgun myself.
--
👇
Neutron3529:
https://www.reddit.com/r/rust/comments/nqjyb7/the_most_annoying_bug_ive_had_to_track_down/
能体谅一下墙内的读者,给个简介吗
实在不想找梯子……
The Most Annoying Bug I've Had To Track Down
I recently had this https://github.com/Morganamilo/paru/issues/392 bug reported to me.
The user came at me with a full backtrace so I thought it would be an easy fix. The bug appeared to be in the c bindings I was using, so clearly there's some subtle UB/error not being handled somewhere.
Yet I couldn't find anything wrong. No matter how many null checks and assertions I put around the place.
Then I figured out what wrong: https://github.com/archlinux/alpm.rs/commit/5253d6
Perviously, when getting a pointer to a union the code did
Due to the &mut being outside the unsafe block this actually takes a reference to a temporary variables instead of the union filed.
It effectively looks like:
The fix is to just move the &mut into the unsafe block, making rust not create a temporary variable and actually reference the union.
This is the first time rust has let me footgun myself.
--
👇
Neutron3529:
https://www.reddit.com/r/rust/comments/nqjyb7/the_most_annoying_bug_ive_had_to_track_down/
能体谅一下墙内的读者,给个简介吗
实在不想找梯子……
https://www.reddit.com/r/rust/comments/nqjyb7/the_most_annoying_bug_ive_had_to_track_down/
能体谅一下墙内的读者,给个简介吗
实在不想找梯子……
这个编辑器有意思 哈哈