diff options
| author | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-30 12:11:29 +0000 |
|---|---|---|
| committer | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-31 09:13:45 +0000 |
| commit | c7c39ce6d07e4d33dc25e07c43f0139c0634b7eb (patch) | |
| tree | eed7ba96cd50fe9a2abd17fd22281249f41e8aaa | |
| parent | 1d56b8a2bc181c6da705c8aa7241672cf25e43bf (diff) | |
| download | rust-c7c39ce6d07e4d33dc25e07c43f0139c0634b7eb.tar.gz rust-c7c39ce6d07e4d33dc25e07c43f0139c0634b7eb.zip | |
We should never see unevaluated type-level constants after monomorphization unless errors occurred
| -rw-r--r-- | compiler/rustc_mir/src/monomorphize/collector.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_mir/src/monomorphize/collector.rs b/compiler/rustc_mir/src/monomorphize/collector.rs index c5c701082e6..5cc1d7082d1 100644 --- a/compiler/rustc_mir/src/monomorphize/collector.rs +++ b/compiler/rustc_mir/src/monomorphize/collector.rs @@ -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::Unevaluated(unevaluated) => { 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::TooGeneric) => span_bug!( self.body.source_info(location).span, |
