이 콘텐츠는 선택한 언어로 제공되지 않습니다.

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은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.