1
Fork 0

Rollup merge of #122487 - GuillaumeGomez:rename-stmtkind-local, r=oli-obk

Rename `StmtKind::Local` variant into `StmtKind::Let`

It comes from this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F).

Starting point was:

> I often end up looking at [ExprKind::Let](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.ExprKind.html#variant.Let) instead of Local because of the name. I think renaming it (both the `ExprKind` variant and the Let struct) to `LetPattern` or LetPat could improve the situation as I'm not sure I'm not the only one encountering this issue.

And then it evolved into:

> It's already `Expr::Let` instead of `StmtKind::Local`. Counterproposal: rename `StmtKind::Local` to `StmtKind::Let`.

The goal here is to clear this confusion.

r? `@oli-obk`
This commit is contained in:
Matthias Krüger 2024-03-14 20:00:21 +01:00 committed by GitHub
commit 1f4aff7d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 103 additions and 103 deletions

View file

@ -2139,7 +2139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
// the same span as the error and the type is specified.
if let hir::Stmt {
kind:
hir::StmtKind::Local(hir::Local {
hir::StmtKind::Let(hir::Local {
init: Some(hir::Expr { span: init_span, .. }),
ty: Some(array_ty),
..

View file

@ -585,7 +585,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
fn visit_stmt(&mut self, ex: &'v hir::Stmt<'v>) -> Self::Result {
if let hir::StmtKind::Local(hir::Local {
if let hir::StmtKind::Let(hir::Local {
span,
pat: hir::Pat { .. },
ty: None,
@ -824,7 +824,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
let hir = self.tcx.hir();
for stmt in blk.stmts.iter().rev() {
let hir::StmtKind::Local(local) = &stmt.kind else {
let hir::StmtKind::Let(local) = &stmt.kind else {
continue;
};
local.pat.walk(&mut find_compatible_candidates);