IT资讯
卡巴斯基称拼多多 App 包含恶意代码
Redis 错误导致 ChatGPT 数据泄露,技术细节一并公布
Twitter 源代码泄露
ChatGPT 开始支持插件:可联网、可执行代码等
Docker 撤回受争议的收费方案,不再取消 Free Team 订阅
JDK 20 / Java 20 正式 GA
2023年Java程序员生存指南
Java 正经历变革性的复兴,企业向 Java 17 迁移
macOS “深藏” 比特币白皮书
TIOBE 4 月榜单:Zig 进入 Top 50,Go 保住前 10 位置
微星 1.5TB 源代码等数据泄漏,赎金 400 万美元
Microsoft PowerToys 即将获得 ChatGPT 支持
Linux 早期发展史
Google 称内部全在用 Kotlin 搞安卓开发,体验碾压 Java
Kotlin 2.0 和 Kotlin K2 编译器即将发布
开源静态站点生成器
Ubuntu 23.04 / 22.10 性能对比,英特尔 12 代 CPU 性能暴跌
大厂开源之殇
加密邮件服务 Proton Mail 推出开源密码管理器
Java 17 采用率飙升四倍,Amazon 成最受欢迎 JDK 供应商
爱奇艺客户端 “白嫖” 电视机,后台满速上传
Beaver Notes:一款开源的私人记事本应用
Java 21:下一个 LTS 版本,提供了虚拟线程、记录模式和模式匹配
TiDB 7.4 发版:正式兼容 MySQL 8.0
Rust 1.73.0 发布
Ubuntu 23.10 正式发布,不妨趁周五升级一波!
Stack Overflow 2024 年度开发者调查报告
Llama 3.1 - 405B、70B 和 8B 的多语言与长上下文能力解析
继裁掉Python团队后,谷歌Go团队也迎来动荡:团队灵魂人物、领导Go十二年的技术负责人突然宣布退位_编程语言_核子可乐_InfoQ精选文章
本文档使用 MrDoc 发布
-
+
Rust 1.73.0 发布
Rust 1.73.0 稳定版已正式[发布](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fblog.rust-lang.org%2F2023%2F10%2F05%2FRust-1.73.0.html),主要带来以下变化: #### **Cleaner panic messages** 默认紧急处理程序生成的输出已更改为将 panic 消息放在单独一行,而不是用引号括起来。这可以使 panic 消息更易于阅读,如本示例所示: ``` fn main() { let file = "ferris.txt"; panic!("oh no! {file:?} not found!"); } ``` Output before Rust 1.73: ```text thread 'main' panicked at 'oh no! "ferris.txt" not found!', src/main.rs:3:5 ``` Output starting in Rust 1.73: ```text thread 'main' panicked at src/main.rs:3:5: oh no! "ferris.txt" not found! ``` 这在信息较长、包含嵌套引号或跨多行时尤其有用。 此外,`assert_eq` 和 `assert_ne` 产生的 panic 消息也已被修改,移动了自定义消息(第三个参数)并删除了一些不必要的标点符号,如下所示: ``` fn main() { assert_eq!("🦀", "🐟", "ferris is not a fish"); } ``` Output before Rust 1.73: ```text thread 'main' panicked at 'assertion failed: `(left == right)` left: `"🦀"`, right: `"🐟"`: ferris is not a fish', src/main.rs:2:5 ``` Output starting in Rust 1.73: ```text thread 'main' panicked at src/main.rs:2:5: assertion `left == right` failed: ferris is not a fish left: "🦀" right: "🐟" ``` #### **Thread local initialization** [正如 RFC 3184](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fgithub.com%2Frust-lang%2Frfcs%2Fblob%2Fmaster%2Ftext%2F3184-thread-local-cell-methods.md) 中所提议的,`LocalKey<Cell<T>>` 和 `LocalKey<RefCell<T>>` 现在可以直接使用 `get()`、`set()`、`take()` 和 `replace()` 方法进行操作,而无需像一般 `LocalKey` 工作那样跳过 `with(|inner| ...)` 闭包。`LocalKey<T>` 是 `thread_local!`statics 的类型。 新方法使 common code 更加简洁,并避免了为新线程在 `thread_local!` 中指定的默认值运行额外的初始化代码。 ```rust thread_local! { static THINGS: Cell<Vec<i32>> = Cell::new(Vec::new()); } fn f() { // before: THINGS.with(|i| i.set(vec![1, 2, 3])); // now: THINGS.set(vec![1, 2, 3]); // ... // before: let v = THINGS.with(|i| i.take()); // now: let v: Vec<i32> = THINGS.take(); } ``` **Stabilized APIs** - [Unsigned `{integer}::div_ceil`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fprimitive.u32.html%23method.div_ceil) - [Unsigned `{integer}::next_multiple_of`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fprimitive.u32.html%23method.next_multiple_of) - [Unsigned `{integer}::checked_next_multiple_of`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fprimitive.u32.html%23method.checked_next_multiple_of) - [`std::ffi::FromBytesUntilNulError`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fffi%2Fstruct.FromBytesUntilNulError.html) - [`std::os::unix::fs::chown`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fos%2Funix%2Ffs%2Ffn.chown.html) - [`std::os::unix::fs::fchown`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fos%2Funix%2Ffs%2Ffn.fchown.html) - [`std::os::unix::fs::lchown`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fos%2Funix%2Ffs%2Ffn.lchown.html) - [`LocalKey::<Cell<T>>::get`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.get) - [`LocalKey::<Cell<T>>::set`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.set) - [`LocalKey::<Cell<T>>::take`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.take) - [`LocalKey::<Cell<T>>::replace`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.replace) - [`LocalKey::<RefCell<T>>::with_borrow`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.with_borrow) - [`LocalKey::<RefCell<T>>::with_borrow_mut`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.with_borrow_mut) - [`LocalKey::<RefCell<T>>::set`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.set-1) - [`LocalKey::<RefCell<T>>::take`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.take-1) - [`LocalKey::<RefCell<T>>::replace`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fstd%2Fthread%2Fstruct.LocalKey.html%23method.replace-1) 这些 API 现在在 const contexts 中是稳定的: - [`rc::Weak::new`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Falloc%2Frc%2Fstruct.Weak.html%23method.new) - [`sync::Weak::new`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Falloc%2Fsync%2Fstruct.Weak.html%23method.new) - [`NonNull::as_ref`](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Fcore%2Fptr%2Fstruct.NonNull.html%23method.as_ref) 详情可[查看官方公告](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fblog.rust-lang.org%2F2023%2F10%2F05%2FRust-1.73.0.html)。
admin
2023年10月14日 07:00
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
PDF文档(打印)
分享
链接
类型
密码
更新密码