Repository: go
Issue: x/tools/gopls: Rename: crash due to Info.Defs[id]=nil bug in checkStructField
Labels: NeedsInvestigation,gopls,Tools,gopls/telemetry-wins

```
#!stacks
"runtime.sigpanic" && "checkStructField:+36"
```
Issue created by [stacks](https://pkg.go.dev/golang.org/x/tools/gopls/internal/telemetry/cmd/stacks).
```go
named := r.pkg.TypesInfo().Defs[spec.Name].Type()
```
This stack `Zepg4g` was [reported by telemetry](https://storage.googleapis.com/prod-telemetry-merged/2024-12-21.json):

- `crash/crash`
- [`runtime.gopanic:+69`](https://cs.opensource.google/go/go/+/go1.23.3:src/runtime/panic.go;l=804)
- `runtime.panicmem:=262`
- [`runtime.sigpanic:+19`](https://cs.opensource.google/go/go/+/go1.23.3:src/runtime/signal_unix.go;l=917)
- [`golang.org/x/tools/gopls/internal/golang.(*renamer).checkStructField:+36`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename_check.go;l=475)
- [`golang.org/x/tools/gopls/internal/golang.(*renamer).check:+14`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename_check.go;l=106)
- [`golang.org/x/tools/gopls/internal/golang.(*renamer).checkInLexicalScope:+62`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename_check.go;l=284)
- [`golang.org/x/tools/gopls/internal/golang.(*renamer).checkInPackageBlock:+47`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename_check.go;l=187)
- [`golang.org/x/tools/gopls/internal/golang.(*renamer).check:+12`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename_check.go;l=104)
- [`golang.org/x/tools/gopls/internal/golang.renameObjects:+24`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename.go;l=1173)
- [`golang.org/x/tools/gopls/internal/golang.renameExported:+56`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename.go;l=750)
- [`golang.org/x/tools/gopls/internal/golang.renameOrdinary:+157`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename.go;l=632)
- [`golang.org/x/tools/gopls/internal/golang.Rename:+24`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/golang/rename.go;l=419)
- [`golang.org/x/tools/gopls/internal/server.(*server).Rename:+17`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/server/rename.go;l=36)
- [`golang.org/x/tools/gopls/internal/protocol.serverDispatch:+489`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/protocol/tsserver.go;l=659)
- [`golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/protocol/protocol.go;l=160)
- [`golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:gopls/internal/lsprpc/lsprpc.go;l=509)
- [`golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2`](https://cs.opensource.google/go/x/tools/+/gopls/v0.17.0:internal/jsonrpc2/handler.go;l=35)
```
golang.org/x/tools/gopls@v0.17.0 go1.23.3 darwin/arm64 other,vscode (1)
```
Dups: _A3zlQ