diff options
| author | Jordan McQueen <jmq@Jordans-MacBook-Air.local> | 2022-07-18 16:24:08 +0900 |
|---|---|---|
| committer | Jordan McQueen <jmq@Jordans-MacBook-Air.local> | 2022-07-18 16:24:08 +0900 |
| commit | 38f090b5e9bdf765eaeab80d5feaa1cd28021a3c (patch) | |
| tree | 80f75d70ccea6d86827091d30094b96fa3f279f2 /compiler | |
| parent | 2fa64d0e53c15e1920bd394500da010a4cdd057b (diff) | |
| download | rust-38f090b5e9bdf765eaeab80d5feaa1cd28021a3c.tar.gz rust-38f090b5e9bdf765eaeab80d5feaa1cd28021a3c.zip | |
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.)
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/ty/closure.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index 8ead0512274..27b9d27b8bb 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -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 + ) } }, |
