问题标签 [rust-2021]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1712 浏览

rust - Rust 2021 的主要功能是什么?

Rust 的2021 版将于今年晚些时候推出,其主要功能已获批准。用户可以在每晚开始测试其中的一些:

有哪些主要功能以及它们有何用处?

欢迎提供问题和跟踪问题的示例和链接!


此问题旨在为夜间用户提供早期参考,并作为最终版本指南的补充。

0 投票
2 回答
89 浏览

rust - Can Rust macros be shared across editions?

Say a Rust 2018 macro defines an async function inside it. The syntax it would use would be incompatible with Rust 2015. So if you're compiling your crate with 2015 edition, wouldn't this expanded code from the macro conflict with that?

I'm not that familiar with inner workings of either procedural or declarative macros, but I imagine they need to produce edition-specific code, because their output is going to be treated the same as the rest of the code. If so, how can I share macro exports across edition boundaries. Do I need to re-write them on a per-edition basis? That doesn't seem scalable especially if editions are supposed to be released every 3 years or so.

0 投票
1 回答
66 浏览

rust - 更新“rustc”后,“use std::io”可以破坏我的代码吗?

我在 C++ 课后为了好玩而学习 rust,我想知道,在将版本use std::io更新为新版本后会破坏我的代码rustc吗?

例如,在 C++ 中使用using namespace std是不好的,因为如果将新函数添加到std您的多个翻译单元中,则编译器更新后代码可能会中断,因为与您编写的函数名称相同的函数已添加到 namespace std

但是在所有官方的 rust 教程use std::io中都使用了。

可以use std::io破坏我的代码生锈吗?