Skip to content

Commit 19d9fd5

Browse files
committed
fix ice on unknown const arg parent
1 parent cc7a6d1 commit 19d9fd5

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/librustc_typeck/collect/type_of.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ pub(super) fn const_param_of(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
108108
tcx.generics_of(tcx.parent(def_id).unwrap())
109109
}
110110
Res::Def(_, def_id) => tcx.generics_of(def_id),
111-
res => span_bug!(
111+
Res::Err => {
112+
tcx.sess.delay_span_bug(tcx.def_span(def_id), "anon const with Res::Err");
113+
return None;
114+
}
115+
_ => span_bug!(
112116
DUMMY_SP,
113117
"unexpected anon const res {:?} in path: {:?}",
114118
res,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
fn main() {
5+
let _: UnknownStruct<7>;
6+
//~^ ERROR cannot find type `UnknownStruct`
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `UnknownStruct` in this scope
2+
--> $DIR/unknown_adt.rs:5:12
3+
|
4+
LL | let _: UnknownStruct<7>;
5+
| ^^^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)