]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillot
authorbors <bors@rust-lang.org>
Tue, 6 Sep 2022 03:16:29 +0000 (03:16 +0000)
committerbors <bors@rust-lang.org>
Tue, 6 Sep 2022 03:16:29 +0000 (03:16 +0000)
commit6c358c67d4d39b1b4dbbcee89e96ec748d771e9e
tree0b408a0a95a82676690a365e92530600e2a78874
parent56b27110e7f72ea01312d99f1b1e0577431cbbd0
parent9ea82d57e296efd6dfc0cb0a6c4c09f4111c123d
Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillot

`BindingAnnotation` refactor

* `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`)
* `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)`
* Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}`

One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`.

I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
23 files changed:
compiler/rustc_ast/src/ast.rs
compiler/rustc_ast_lowering/src/expr.rs
compiler/rustc_ast_lowering/src/item.rs
compiler/rustc_ast_lowering/src/lib.rs
compiler/rustc_ast_lowering/src/pat.rs
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
compiler/rustc_hir/src/hir.rs
compiler/rustc_hir_pretty/src/lib.rs
compiler/rustc_lint/src/builtin.rs
compiler/rustc_save_analysis/src/lib.rs
src/tools/clippy/clippy_lints/src/dereference.rs
src/tools/clippy/clippy_lints/src/explicit_write.rs
src/tools/clippy/clippy_lints/src/loops/same_item_push.rs
src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs
src/tools/clippy/clippy_lints/src/methods/map_clone.rs
src/tools/clippy/clippy_lints/src/methods/str_splitn.rs
src/tools/clippy/clippy_lints/src/ptr.rs
src/tools/clippy/clippy_lints/src/question_mark.rs
src/tools/clippy/clippy_lints/src/slow_vector_initialization.rs
src/tools/clippy/clippy_lints/src/utils/author.rs
src/tools/clippy/clippy_lints/src/vec_init_then_push.rs
src/tools/clippy/clippy_utils/src/hir_utils.rs
src/tools/clippy/clippy_utils/src/lib.rs