rust-lang.github.io
Dependability Functions validate their arguments (C-VALIDATE) Rust APIs do not generally follow the robustness principle: "be conservative in what you send; be liberal in what you accept". Instead, Rust code should enforce the validity of i...
Rust API Guidelines
Book
2024-01-01
~2 min read
rust-lang.github.io
Debuggability All public types implement Debug (C-DEBUG) If there are exceptions, they are rare. Debug representation is never empty (C-DEBUG-NONEMPTY) Even for conceptually empty values, the Debug representation should never be empty. let...
Rust API Guidelines
Book
2024-01-01
~1 min read
rust-lang.github.io
Future proofing Sealed traits protect against downstream implementations (C-SEALED) Some traits are only meant to be implemented within the crate that defines them. In such cases, we can retain the ability to make changes to the trait in a...
Rust API Guidelines
Book
2024-01-01
~4 min read
rust-lang.github.io
Necessities Public dependencies of a stable crate are stable (C-STABLE) A crate cannot be stable (>=1.0.0) without all of its public dependencies being stable. Public dependencies are crates from which types are used in the public API of th...
Rust API Guidelines
Book
2024-01-01
~2 min read
rust-lang.github.io
External links • RFC 199 - Ownership naming conventions • RFC 344 - Naming conventions • RFC 430 - Naming conventions • RFC 505 - Doc conventions • RFC 1574 - Doc conventions • RFC 1687 - Crate-level documentation • Elegant Library APIs in...
Rust API Guidelines
Book
2024-01-01
~1 min read
rust-lang.github.io
Feature Name: trait_upcasting Start Date: 2022-12-10 RFC PR: rust-lang/rfcs#3324 Rust Issue: rust-lang/rust#65991 Design repository: rust-lang/dyn-upcasting-coercion-initiative Summary Enable upcasts from dyn Trait1 to dyn Trait2 if Trait1...
Updates from the Rust Project
2023-11-29
~14 min read
rust-lang.github.io
Feature Name: trim-paths Start Date: 2021-05-24 RFC PR: rust-lang/rfcs#3127 Rust Issue: rust-lang/rust#111540 Summary Cargo should have a profile setting named trim-paths to sanitise absolute paths introduced during compilation that may be...
Updates from the Rust Project
2023-11-08
~15 min read
rust-lang.github.io
Feature Name: macro_metavar_expr Start Date: 2021-01-23 RFC PR: rust-lang/rfcs#3086 Rust Issue: rust-lang/rust#83527 Summary Add new syntax to declarative macros to give their authors easy access to additional metadata about macro metavaria...
Updates from the Rust Project
2023-08-23
~10 min read
rust-lang.github.io
Feature Name: c_str_literal Start Date: 2022-11-15 RFC PR: rust-lang/rfcs#3348 Rust Issue: rust-lang/rust#105723 Summary c"…" string literals. Motivation Looking at the amount of cstr!() invocations just on GitHub (about 3.2k files with mat...
Updates from the Rust Project
2023-05-10
~4 min read
rust-lang.github.io
Feature Name: offset_of Start Date: 2022-08-29 RFC PR: rust-lang/rfcs#3308 Rust Issue: rust-lang/rust#106655 Summary Introduce a new macro core::mem::offset_of!, which evaluates to a constant containing the offset in bytes of a field inside...
Updates from the Rust Project
2023-04-26
~17 min read
rust-lang.github.io
Feature Name: do_not_recommend Start Date: 2018-04-07 RFC PR: rust-lang/rfcs#2397 Rust Issue: rust-lang/rust#51992 Summary A new attribute can be placed on trait implementations: #[do_not_recommend]. This attribute will cause the compiler t...
Updates from the Rust Project
2023-01-18
~8 min read
rust-lang.github.io
Feature Name: cargo_alternative_registry_auth Start Date: 2021-03-31 RFC PR: rust-lang/rfcs#3139 Tracking Issue: rust-lang/cargo#10474 Summary Enables Cargo to include the authorization token for all API requests, crate downloads and index...
Updates from the Rust Project
2022-11-23
~7 min read
rust-lang.github.io
Feature Name: source_replacement_ambiguity Start Date: 2022-07-05 RFC PR: rust-lang/rfcs#3289 Tracking Issue: rust-lang/cargo#10894 Summary When Cargo is performing an API operation (yank/login/publish/etc.) to a source-replaced crates-io,...
Updates from the Rust Project
2022-10-12
~4 min read
rust-lang.github.io
Feature Name: let-else Start Date: 2021-05-31 RFC PR: rust-lang/rfcs#3137 Rust Issue: rust-lang/rust#87335 Summary Introduce a new let PATTERN: TYPE = EXPRESSION else DIVERGING_BLOCK; construct (informally called a let-else statement), the...
Updates from the Rust Project
2022-09-21
~20 min read
rust-lang.github.io
Feature Name: generic_associated_types Start Date: 2016-04-29 RFC PR: rust-lang/rfcs#1598 Rust Issue: rust-lang/rust#44265 Summary Allow type constructors to be associated with traits. This is an incremental step toward a more general featu...
Updates from the Rust Project
2022-09-21
~13 min read
rust-lang.github.io
Feature Name: generic_assert Start Date: 2017-05-24 RFC PR: rust-lang/rfcs#2011 Rust Issue: rust-lang/rust#44838 Summary Make the assert! macro recognize more expressions (utilizing the power of procedural macros), and extend the readabilit...
Updates from the Rust Project
2022-06-29
~2 min read
rust-lang.github.io
Feature Name: thread_local_cell_methods Start Date: 2021-10-17 RFC PR: rust-lang/rfcs#3184 Rust Issue: rust-lang/rust#92122 Summary Adding methods to LocalKey for LocalKey<Cell<T>> and LocalKey<RefCell<T>> to make thread local cells easier...
Updates from the Rust Project
2022-03-09
~8 min read
rust-lang.github.io
Feature Name: (bindeps) Start Date: 2020-11-30 RFC PR: rust-lang/rfcs#3028 Tracking Issue: rust-lang/cargo#9096 Summary Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates. Motiva...
Updates from the Rust Project
2022-03-02
~15 min read
rust-lang.github.io
Feature Name: io_safety Start Date: 2021-05-24 RFC PR: rust-lang/rfcs#3128 Rust Issue: rust-lang/rust#87074 Summary Close a hole in encapsulation boundaries in Rust by providing users of AsRawFd and related traits guarantees about their raw...
Updates from Rust Core
2021-08-25
~13 min read
rust-lang.github.io
Feature Name: capture_disjoint_fields Start Date: 2017-11-28 RFC PR: rust-lang/rfcs#2229 Rust Issue: rust-lang/rust#53488 Summary This RFC proposes that closure capturing should be minimal rather than maximal. Conceptually, existing rules r...
Updates from Rust Core
2021-05-19
~6 min read