Rollup merge of #129042 - Jaic1:fix-116308, r=BoxyUwU
Special-case alias ty during the delayed bug emission in `try_from_lit` This PR tries to fix #116308. A delayed bug in `try_from_lit` will not be emitted so that the compiler will not ICE when it sees the pair `(ast::LitKind::Int, ty::TyKind::Alias)` in `lit_to_const` (called from `try_from_lit`). This PR is related to an unstable feature `adt_const_params` (#95174). r? ``@BoxyUwU``
This commit is contained in:
@@ -305,6 +305,10 @@ impl<'tcx> Const<'tcx> {
|
|||||||
// mir.
|
// mir.
|
||||||
match tcx.at(expr.span).lit_to_const(lit_input) {
|
match tcx.at(expr.span).lit_to_const(lit_input) {
|
||||||
Ok(c) => return Some(c),
|
Ok(c) => return Some(c),
|
||||||
|
Err(_) if lit_input.ty.has_aliases() => {
|
||||||
|
// allow the `ty` to be an alias type, though we cannot handle it here
|
||||||
|
return None;
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tcx.dcx().span_delayed_bug(
|
tcx.dcx().span_delayed_bug(
|
||||||
expr.span,
|
expr.span,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
//@ known-bug: #116308
|
//@ check-pass
|
||||||
#![feature(adt_const_params)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
|
// Regression test for #116308
|
||||||
|
|
||||||
pub trait Identity {
|
pub trait Identity {
|
||||||
type Identity;
|
type Identity;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user