Skip to content

Commit db11c19

Browse files
committed
update mir user type printing and apparently fix an ICE
1 parent 39a0377 commit db11c19

File tree

3 files changed

+11
-48
lines changed

3 files changed

+11
-48
lines changed

compiler/rustc_middle/src/mir/pretty.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,11 @@ fn write_user_type_annotations(
10071007
for (index, annotation) in body.user_type_annotations.iter_enumerated() {
10081008
writeln!(
10091009
w,
1010-
"| {:?}: {:?} at {}",
1010+
"| {:?}: user_ty: {:?}, span: {}, inferred_ty: {:?}",
10111011
index.index(),
10121012
annotation.user_ty,
1013-
tcx.sess.source_map().span_to_embeddable_string(annotation.span)
1013+
tcx.sess.source_map().span_to_embeddable_string(annotation.span),
1014+
annotation.inferred_ty,
10141015
)?;
10151016
}
10161017
if !body.user_type_annotations.is_empty() {
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
// known-bug
2-
// failure-status: 101
3-
// compile-flags: --edition=2021 --crate-type=lib
4-
// rustc-env:RUST_BACKTRACE=0
5-
6-
// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
7-
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
8-
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
9-
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
10-
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
11-
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
12-
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
13-
// normalize-stderr-test "#.*\n" -> ""
14-
// normalize-stderr-test ".*delayed.*\n" -> ""
15-
16-
// tracked in https://github.com/rust-lang/rust/issues/96572
17-
1+
// compile-flags: --edition=2021
182
#![feature(type_alias_impl_trait)]
193

204
fn main() {
21-
type T = impl Copy;
5+
type T = impl Copy; //~ ERROR unconstrained opaque type
226
let foo: T = (1u32, 2u32);
237
let (a, b): (u32, u32) = foo;
248
}
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
2-
3-
error: internal compiler error: broken MIR in DefId(0:3 ~ cross_inference_pattern_bug[646d]::main) ((_1.0: u32)): can't project out of PlaceTy { ty: main::T, variant_index: None }
4-
--> $DIR/cross_inference_pattern_bug.rs:23:10
5-
|
6-
LL | let (a, b): (u32, u32) = foo;
7-
| ^
8-
|
9-
10-
error: internal compiler error: TyKind::Error constructed but no error reported
11-
|
12-
13-
error: internal compiler error: TyKind::Error constructed but no error reported
1+
error: unconstrained opaque type
2+
--> $DIR/cross_inference_pattern_bug.rs:5:14
143
|
15-
16-
error: internal compiler error: broken MIR in DefId(0:3 ~ cross_inference_pattern_bug[646d]::main) ((_1.1: u32)): can't project out of PlaceTy { ty: main::T, variant_index: None }
17-
--> $DIR/cross_inference_pattern_bug.rs:23:13
18-
|
19-
LL | let (a, b): (u32, u32) = foo;
20-
| ^
21-
|
22-
23-
error: internal compiler error: TyKind::Error constructed but no error reported
24-
|
25-
26-
error: internal compiler error: TyKind::Error constructed but no error reported
4+
LL | type T = impl Copy;
5+
| ^^^^^^^^^
276
|
7+
= note: `T` must be used in combination with a concrete type within the same module
288

29-
thread 'rustc' panicked
9+
error: aborting due to previous error
3010

31-
query stack during panic:
32-
end of query stack

0 commit comments

Comments
 (0)