File tree 2 files changed +13
-5
lines changed 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -510,9 +510,17 @@ TypeCheckType::resolve_segments (
510
510
511
511
if (candidate.is_enum_candidate ())
512
512
{
513
- rust_error_at (seg->get_locus (),
514
- " expected type, found variant of %s" ,
515
- tyseg->get_name ().c_str ());
513
+ TyTy::ADTType *adt = static_cast <TyTy::ADTType *> (tyseg);
514
+ auto last_variant = adt->get_variants ();
515
+ TyTy::VariantDef *variant = last_variant.back ();
516
+
517
+ rich_location richloc (line_table, seg->get_locus ());
518
+ richloc.add_fixit_replace (" not a type" );
519
+
520
+ rust_error_at (richloc, ErrorCode::E0573 ,
521
+ " expected type, found variant of %<%s::%s%>" ,
522
+ adt->get_name ().c_str (),
523
+ variant->get_identifier ().c_str ());
516
524
return new TyTy::ErrorType (expr_id);
517
525
}
518
526
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ enum Dragon {
5
5
}
6
6
7
7
fn oblivion ( ) -> Dragon :: Born {
8
- // { dg-error "expected type, found variant of Dragon" "" { target *-*-* } .-1 }
8
+ // { dg-error "expected type, found variant of . Dragon::Born. " "" { target *-*-* } .-1 }
9
9
// { dg-error "failed to resolve return type" "" { target *-*-* } .-2 }
10
10
Dragon :: Born
11
11
}
@@ -17,6 +17,6 @@ enum Wizard {
17
17
18
18
trait Isengard {
19
19
fn wizard ( _: Wizard :: Saruman ) ;
20
- // { dg-error "expected type, found variant of Wizard" "" { target *-*-* } .-1 }
20
+ // { dg-error "expected type, found variant of . Wizard::Saruman. " "" { target *-*-* } .-1 }
21
21
}
22
22
}
You can’t perform that action at this time.
0 commit comments