Skip to content

Commit 5ba1895

Browse files
varkorpietroalbini
authored andcommitted
Make const parent errors delay_span_bugs
1 parent 02b0ca3 commit 5ba1895

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/librustc_typeck/collect.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,15 +1403,27 @@ pub fn checked_type_of<'a, 'tcx>(
14031403
if !fail {
14041404
return None;
14051405
}
1406-
bug!("unexpected const parent path def {:?}", x);
1406+
tcx.sess.delay_span_bug(
1407+
DUMMY_SP,
1408+
&format!(
1409+
"unexpected const parent path def {:?}", x
1410+
),
1411+
);
1412+
tcx.types.err
14071413
}
14081414
}
14091415
}
14101416
x => {
14111417
if !fail {
14121418
return None;
14131419
}
1414-
bug!("unexpected const parent path {:?}", x);
1420+
tcx.sess.delay_span_bug(
1421+
DUMMY_SP,
1422+
&format!(
1423+
"unexpected const parent path {:?}", x
1424+
),
1425+
);
1426+
tcx.types.err
14151427
}
14161428
}
14171429
}
@@ -1420,7 +1432,13 @@ pub fn checked_type_of<'a, 'tcx>(
14201432
if !fail {
14211433
return None;
14221434
}
1423-
bug!("unexpected const parent in type_of_def_id(): {:?}", x);
1435+
tcx.sess.delay_span_bug(
1436+
DUMMY_SP,
1437+
&format!(
1438+
"unexpected const parent in type_of_def_id(): {:?}", x
1439+
),
1440+
);
1441+
tcx.types.err
14241442
}
14251443
}
14261444
}

0 commit comments

Comments
 (0)