Rollup merge of #99404 - jmqd:master, r=compiler-errors

Use span_bug for unexpected field projection type

Improves the compiler error backtrace information, as shown in #99363,
by using `span_bug` instead of `bug`.

New output:

```
build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021
error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection
  --> /tmp/test.rs:11:27
   |
11 |         let Foo((a, b)) = foo;
   |                           ^^^

thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9
stack backtrace:
```

(Remainder of output truncated.)
This commit is contained in:
Dylan DPC 2022-07-19 11:38:56 +05:30 committed by GitHub
commit 43dbf054b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,7 +182,11 @@ impl<'tcx> CapturedPlace<'tcx> {
.unwrap();
}
ty => {
bug!("Unexpected type {:?} for `Field` projection", ty)
span_bug!(
self.get_capture_kind_span(tcx),
"Unexpected type {:?} for `Field` projection",
ty
)
}
},