mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
6b8f2c7938
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.