update mir user type printing and apparently fix an ICE

This commit is contained in:
lcnr 2022-05-20 14:46:18 +02:00
parent 39a03779f8
commit db11c1939c
3 changed files with 11 additions and 48 deletions

View file

@ -1007,10 +1007,11 @@ fn write_user_type_annotations(
for (index, annotation) in body.user_type_annotations.iter_enumerated() {
writeln!(
w,
"| {:?}: {:?} at {}",
"| {:?}: user_ty: {:?}, span: {}, inferred_ty: {:?}",
index.index(),
annotation.user_ty,
tcx.sess.source_map().span_to_embeddable_string(annotation.span)
tcx.sess.source_map().span_to_embeddable_string(annotation.span),
annotation.inferred_ty,
)?;
}
if !body.user_type_annotations.is_empty() {

View file

@ -1,24 +1,8 @@
// known-bug
// failure-status: 101
// compile-flags: --edition=2021 --crate-type=lib
// rustc-env:RUST_BACKTRACE=0
// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
// normalize-stderr-test "#.*\n" -> ""
// normalize-stderr-test ".*delayed.*\n" -> ""
// tracked in https://github.com/rust-lang/rust/issues/96572
// compile-flags: --edition=2021
#![feature(type_alias_impl_trait)]
fn main() {
type T = impl Copy;
type T = impl Copy; //~ ERROR unconstrained opaque type
let foo: T = (1u32, 2u32);
let (a, b): (u32, u32) = foo;
}

View file

@ -1,32 +1,10 @@
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
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 }
--> $DIR/cross_inference_pattern_bug.rs:23:10
error: unconstrained opaque type
--> $DIR/cross_inference_pattern_bug.rs:5:14
|
LL | let (a, b): (u32, u32) = foo;
| ^
LL | type T = impl Copy;
| ^^^^^^^^^
|
= note: `T` must be used in combination with a concrete type within the same module
error: internal compiler error: TyKind::Error constructed but no error reported
|
error: aborting due to previous error
error: internal compiler error: TyKind::Error constructed but no error reported
|
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 }
--> $DIR/cross_inference_pattern_bug.rs:23:13
|
LL | let (a, b): (u32, u32) = foo;
| ^
|
error: internal compiler error: TyKind::Error constructed but no error reported
|
error: internal compiler error: TyKind::Error constructed but no error reported
|
thread 'rustc' panicked
query stack during panic:
end of query stack