Skip to content

Commit 45f038f

Browse files
crash if invalid type kind in const_to_valtree_inner
1 parent cc95610 commit 45f038f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/rustc_const_eval/src/const_eval/valtrees.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,21 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
140140
ty::Never
141141
| ty::Error(_)
142142
| ty::Foreign(..)
143-
| ty::Infer(ty::FreshIntTy(_))
144-
| ty::Infer(ty::FreshFloatTy(_))
145-
| ty::Projection(..)
146-
| ty::Param(_)
147-
| ty::Bound(..)
148-
| ty::Placeholder(..)
149143
// FIXME(oli-obk): we could look behind opaque types
150144
| ty::Opaque(..)
151-
| ty::Infer(_)
152145
// FIXME(oli-obk): we can probably encode closures just like structs
153146
| ty::Closure(..)
154147
| ty::Generator(..)
155-
// FIXME: we could look behind type aliases.
156-
| ty::TyAlias(..)
157148
| ty::GeneratorWitness(..) => Err(ValTreeCreationError::NonSupportedType),
149+
150+
ty::Infer(_)
151+
| ty::TyAlias(..)
152+
| ty::Projection(..)
153+
| ty::Param(_)
154+
| ty::Bound(..)
155+
| ty::Placeholder(..) => {
156+
bug!("{:?} should have errored and never gotten converted to valtree", ty.kind())
157+
}
158158
}
159159
}
160160

0 commit comments

Comments
 (0)