← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6075.c.1.q · 生成模型:未记录

Edition按crate选择

理解等级:中级

Cargo 清单的 edition 选择项目采用的语言规则。更新编译器与迁移 edition 可独立进行。项目可依赖另一受支持 edition 的 crate,因为编译时分别采用各自的规则。部分引入新关键字的能力可能要求更新 edition。

相关卡片 [[原始标识符避开保留字]]

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 附录 E · Edition E Editions · 查看原书依据

      All Rust compiler versions support any edition that existed prior to that compiler’s release, and they can link crates of any supported editions together. Edition changes only affect the way the compiler initially parses code. Therefore, if you’re using Rust 2015 and one of your dependencies uses Rust 2018, your project will compile and be able to use that dependency.

    参考来源

    - 位置:《The Rust Programming Language(第2版)》附录 E · Edition(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/b05.xhtml`,块 0013) - 结论依据:原文说明同一编译器可编译并连接采用不同受支持 edition 的 crate。 - 原始内容:All Rust compiler versions support any edition that existed prior to that compiler’s release, and they can link crates of any supported editions together. Edition changes only affect the way the compiler initially parses code. Therefore, if you’re using Rust 2015 and one of your dependencies uses Rust 2018, your project will compile and be able to use that dependency.