このコンテンツは選択した言語では利用できません。

Chapter 5. Changes in Rust Toolset in Red Hat Developer Tools 2019.1


This chapter lists some notable changes in Rust Toolset since its previous release.

5.1. Rust

Rust has been updated from version 1.29.0 to 1.31.1. Notable changes include:

  • New capabilities with defining procedural macros

    • Attribute macros let you define custom #[name] annotations.
    • Function macros work like those defined by macro_rules!, but have more flexibility being implemented in Rust.
    • Macros can now be imported in use statements, removing the need for the #[macro_use] crate attribute.
    • The proc_macro crate is now stable, to help write these new macros.
  • Module improvements

    • External crates are now in the prelude, which allows a crate name to serve as the root of a path from anywhere.
    • The crate keyword now serves as the root of your own crate in paths and use statements.
  • 2018 edition

    • The new 2018 edition marks a collective milestone of the last 3 years of Rust development, while also making a few opt-in breaking changes. Existing code will default to 2015 edition, with no breaking changes, and crates from different editions are fully interoperable. cargo new will specify edition = "2018" in Cargo.toml for new projects.
    • async, await, and try are reserved keywords in 2018, and dyn is now a strict keyword.
    • Non-lexical lifetimes are a refinement of the previous block-based lifetime system, allowing borrowed values to be released sooner in many cases to be reused elsewhere. This is initially exclusive to the 2018 edition, but planned for 2015 as well.
    • Module changes: Explicit extern crate declarations are unnecessary in most cases in 2018. use paths can now be relative from the current scope, rather than always starting from the root scope as in 2015.
  • Lifetimes can now be left implicit in more cases, especially using the new '_ placeholder.
  • const fn — Functions can be declared constant, which allows them to be used in restricted contexts, like the initialization of a const or static value.
  • Stable tools: clippy, rls, and rustfmt. We have been shipping these tools as preview already, but now they are officially supported.

    • clippy adds extra lints for code/style issues.
    • rls implements the Language Server protocol for IDE integration.
    • rustfmt formats your code, also integrated with the cargo fmt subcommand.
  • Tool lints allow you to add warning annotations for custom lints, especially for those added by clippy. For example, #[allow(clippy::bool_comparison)] will silence that warning on an item for which you deem it acceptable.

5.2. cargo

The cargo tool has been updated from version 1.29.0 to 1.31.0. Notable changes include:

  • Cargo now shows a progress bar as it builds your crates and dependencies.
  • Cargo now allows renaming dependencies in Cargo.toml, affecting how they are referenced in your sources. Previously, you could only rename in source like extern crate published_name as new_name;.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.