Skip to content

Commit 17339ca

Browse files
oli-obkfee1-dead
authored andcommitted
Add more information to substitution failure
1 parent 77b4af3 commit 17339ca

File tree

1 file changed

+9
-1
lines changed
  • compiler/rustc_typeck/src/check/fn_ctxt

1 file changed

+9
-1
lines changed

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
195195
if i < method_generics.parent_count {
196196
self.infcx.var_for_def(DUMMY_SP, param)
197197
} else {
198-
method.substs[i]
198+
*method.substs.get(i).unwrap_or_else(|| {
199+
span_bug!(
200+
self.tcx.hir().span(hir_id),
201+
"{:#?}\n{:#?}\ni: {}",
202+
method,
203+
method_generics,
204+
i
205+
)
206+
})
199207
}
200208
}),
201209
user_self_ty: None, // not relevant here

0 commit comments

Comments
 (0)