mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
We should never see unevaluated type-level constants after monomorphization unless errors occurred
This commit is contained in:
parent
1d56b8a2bc
commit
c7c39ce6d0
@ -648,7 +648,13 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
|||||||
ty::ConstKind::Value(val) => collect_const_value(self.tcx, val, self.output),
|
ty::ConstKind::Value(val) => collect_const_value(self.tcx, val, self.output),
|
||||||
ty::ConstKind::Unevaluated(unevaluated) => {
|
ty::ConstKind::Unevaluated(unevaluated) => {
|
||||||
match self.tcx.const_eval_resolve(param_env, unevaluated, None) {
|
match self.tcx.const_eval_resolve(param_env, unevaluated, None) {
|
||||||
Ok(val) => collect_const_value(self.tcx, val, self.output),
|
// The `monomorphize` call should have evaluated that constant already.
|
||||||
|
Ok(val) => span_bug!(
|
||||||
|
self.body.source_info(location).span,
|
||||||
|
"collection encountered the unevaluated constant {} which evaluated to {:?}",
|
||||||
|
substituted_constant,
|
||||||
|
val
|
||||||
|
),
|
||||||
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
|
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
|
||||||
Err(ErrorHandled::TooGeneric) => span_bug!(
|
Err(ErrorHandled::TooGeneric) => span_bug!(
|
||||||
self.body.source_info(location).span,
|
self.body.source_info(location).span,
|
||||||
|
Loading…
Reference in New Issue
Block a user