| commit | 6b8f2c79381b925e0f67cb98d68b0076cbc3ab86 | [log] [tgz] |
|---|---|---|
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | Mon Nov 17 18:07:34 2025 +0100 |
| committer | GitHub <noreply@github.com> | Mon Nov 17 18:07:34 2025 +0100 |
| tree | 6aaf42370200861bfab014812ea0f1629c4b9cb9 | |
| parent | 0e0dac2efc797c436953e0874f243c41c4b8e09f [diff] | |
| parent | 34cccb2697c37f56325a4b1d10dd700ab3edc71d [diff] |
Rollup merge of #149016 - Zalathar:let-this-self, r=Kivooeo Document the `let this = self;` idiom used in MIR building In `rustc_mir_build` there are a few `Builder` methods that start with `let this = self;`, so that subsequent code can uniformly refer to the builder as `this`, instead of having to choose between `self` at the top level or `this` when nested in closures that need to borrow the builder. There is some existing documentation of the idiom in `expr_into_dest`: https://github.com/rust-lang/rust/blob/69d4d5fc0e4db60272aac85ef27ecccef5764f3a/compiler/rustc_mir_build/src/builder/expr/into.rs#L32-L35 But that documentation is brief and hard to find, especially if one is unaware that such documentation even exists. --- This PR therefore adds a longer explanation of the `let this = self;` idiom in the module documentation for `rustc_mir_build::builder`, and makes that documentation easier to find by adding a searchable tag (“LET_THIS_SELF”) to the documentation and to each occurrence of the idiom.
Website | Getting started | Learn | Documentation | Contributing
This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.
Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.
Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).
Read “Installation” from The Book.
If you really want to install from source (though this is not recommended), see INSTALL.md.
See https://www.rust-lang.org/community for a list of chat platforms and forums.
See CONTRIBUTING.md.
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”).
If you want to use these names or brands, please read the Rust language trademark policy.
Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.