Skip to content

Commit 4d0b2c9

Browse files
authored
Unrolled build for rust-lang#129042
Rollup merge of rust-lang#129042 - Jaic1:fix-116308, r=BoxyUwU Special-case alias ty during the delayed bug emission in `try_from_lit` This PR tries to fix rust-lang#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` (rust-lang#95174). r? ``@BoxyUwU``
2 parents 569d7e3 + cd2b030 commit 4d0b2c9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: compiler/rustc_middle/src/ty/consts.rs

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ impl<'tcx> Const<'tcx> {
305305
// mir.
306306
match tcx.at(expr.span).lit_to_const(lit_input) {
307307
Ok(c) => return Some(c),
308+
Err(_) if lit_input.ty.has_aliases() => {
309+
// allow the `ty` to be an alias type, though we cannot handle it here
310+
return None;
311+
}
308312
Err(e) => {
309313
tcx.dcx().span_delayed_bug(
310314
expr.span,

Diff for: tests/crashes/116308.rs renamed to tests/ui/const-generics/adt_const_params/116308.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
//@ known-bug: #116308
1+
//@ check-pass
22
#![feature(adt_const_params)]
33

4+
// Regression test for #116308
5+
46
pub trait Identity {
57
type Identity;
68
}

0 commit comments

Comments
 (0)