@@ -53,9 +53,8 @@ pub struct ConstEvalErr<'tcx> {
53
53
54
54
#[ derive( Debug ) ]
55
55
pub struct FrameInfo < ' tcx > {
56
- /// This span is in the caller.
57
- pub call_site : Span ,
58
56
pub instance : ty:: Instance < ' tcx > ,
57
+ pub span : Span ,
59
58
pub lint_root : Option < hir:: HirId > ,
60
59
}
61
60
@@ -65,12 +64,12 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
65
64
if tcx. def_key ( self . instance . def_id ( ) ) . disambiguated_data . data
66
65
== DefPathData :: ClosureExpr
67
66
{
68
- write ! ( f, "inside call to closure" ) ?;
67
+ write ! ( f, "inside closure" ) ?;
69
68
} else {
70
- write ! ( f, "inside call to `{}`" , self . instance) ?;
69
+ write ! ( f, "inside `{}`" , self . instance) ?;
71
70
}
72
- if !self . call_site . is_dummy ( ) {
73
- let lo = tcx. sess . source_map ( ) . lookup_char_pos ( self . call_site . lo ( ) ) ;
71
+ if !self . span . is_dummy ( ) {
72
+ let lo = tcx. sess . source_map ( ) . lookup_char_pos ( self . span . lo ( ) ) ;
74
73
write ! ( f, " at {}:{}:{}" , lo. file. name, lo. line, lo. col. to_usize( ) + 1 ) ?;
75
74
}
76
75
Ok ( ( ) )
@@ -169,13 +168,9 @@ impl<'tcx> ConstEvalErr<'tcx> {
169
168
err. span_label ( self . span , span_msg) ;
170
169
}
171
170
// Add spans for the stacktrace.
172
- // Skip the last, which is just the environment of the constant. The stacktrace
173
- // is sometimes empty because we create "fake" eval contexts in CTFE to do work
174
- // on constant values.
175
- if !self . stacktrace . is_empty ( ) {
176
- for frame_info in & self . stacktrace [ ..self . stacktrace . len ( ) - 1 ] {
177
- err. span_label ( frame_info. call_site , frame_info. to_string ( ) ) ;
178
- }
171
+ // Skip the first, which is the place of the error.
172
+ for frame_info in self . stacktrace . iter ( ) . skip ( 1 ) {
173
+ err. span_label ( frame_info. span , frame_info. to_string ( ) ) ;
179
174
}
180
175
// Let the caller finish the job.
181
176
emit ( err)
0 commit comments