about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-12-04 05:42:08 +0100
committerGitHub <noreply@github.com>2024-12-04 05:42:08 +0100
commit45088fdf68b3a9b6e68c736f9e1cf4ee933fa46a (patch)
tree8d38364077cc901e29f34428fbbd16a4c7e0753a /compiler/rustc_codegen_llvm/src
parentafffc1a86557e0981902dafb04b9332932e08e9c (diff)
parenta3cfe2fd083408b53fa02a90af718b49d2bbe83a (diff)
downloadrust-45088fdf68b3a9b6e68c736f9e1cf4ee933fa46a.tar.gz
rust-45088fdf68b3a9b6e68c736f9e1cf4ee933fa46a.zip
Rollup merge of #133784 - dtolnay:visitspans, r=compiler-errors
Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans

The `Stmt` case is a bug introduced almost certainly unintentionally by https://github.com/rust-lang/rust/pull/126993. The code _used_ to visit and mutate `span` correctly, but got changed as follows by that PR. Notice how `span` is **copied** into the output by `|kind| Stmt { id, kind, span }` which happens after the mutation in the correct code (red) and before the mutation in the incorrect code (green).

```diff
  pub fn noop_flat_map_stmt<T: MutVisitor>(
      Stmt { kind, mut span, mut id }: Stmt,
      vis: &mut T,
  ) -> SmallVec<[Stmt; 1]> {
      vis.visit_id(&mut id);
-     vis.visit_span(&mut span);
      let stmts: SmallVec<_> = noop_flat_map_stmt_kind(kind, vis)
          .into_iter()
          .map(|kind| Stmt { id, kind, span })
          .collect();
      if stmts.len() > 1 {
          panic!(...);
      }
+     vis.visit_span(&mut span);
      stmts
  }
```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions