Skip to content

Commit cd2b030

Browse files
committed
Special-case alias ty in try_from_lit
1 parent 2c93fab commit cd2b030

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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,

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)