Skip to content

Commit 9088ba9

Browse files
committed
Make ICE a bit more informative
1 parent 6bb4ad6 commit 9088ba9

File tree

1 file changed

+12
-3
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+12
-3
lines changed

compiler/rustc_trait_selection/src/traits/project.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
898898
if debruijn.as_usize() + 1
899899
> self.current_index.as_usize() + self.universe_indices.len() =>
900900
{
901-
bug!("Bound vars outside of `self.universe_indices`");
901+
bug!(
902+
"Bound vars {r:#?} outside of `self.universe_indices`: {:#?}",
903+
self.universe_indices
904+
);
902905
}
903906
ty::ReLateBound(debruijn, br) if debruijn >= self.current_index => {
904907
let universe = self.universe_for(debruijn);
@@ -916,7 +919,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
916919
if debruijn.as_usize() + 1
917920
> self.current_index.as_usize() + self.universe_indices.len() =>
918921
{
919-
bug!("Bound vars outside of `self.universe_indices`");
922+
bug!(
923+
"Bound vars {t:#?} outside of `self.universe_indices`: {:#?}",
924+
self.universe_indices
925+
);
920926
}
921927
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
922928
let universe = self.universe_for(debruijn);
@@ -935,7 +941,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
935941
if debruijn.as_usize() + 1
936942
> self.current_index.as_usize() + self.universe_indices.len() =>
937943
{
938-
bug!("Bound vars outside of `self.universe_indices`");
944+
bug!(
945+
"Bound vars {ct:#?} outside of `self.universe_indices`: {:#?}",
946+
self.universe_indices
947+
);
939948
}
940949
ty::ConstKind::Bound(debruijn, bound_const) if debruijn >= self.current_index => {
941950
let universe = self.universe_for(debruijn);

0 commit comments

Comments
 (0)