diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-14 15:17:15 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-14 20:30:37 +1100 |
| commit | 05849e8c2fccd1e66259d65fc4f3317161778212 (patch) | |
| tree | 322cbdd785b91dfcc3a5e240195c5d8329a8c24e /compiler/rustc_const_eval | |
| parent | bb89df6903539e7014b8db29bccd6a9ee9553122 (diff) | |
| download | rust-05849e8c2fccd1e66259d65fc4f3317161778212.tar.gz rust-05849e8c2fccd1e66259d65fc4f3317161778212.zip | |
Use fewer delayed bugs.
For some cases where it's clear that an error has already occurred, e.g.: - there's a comment stating exactly that, or - things like HIR lowering, where we are lowering an error kind The commit also tweaks some comments around delayed bug sites.
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 5ce6a71c4bd..b5c70538c52 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -117,18 +117,14 @@ struct CfgChecker<'a, 'tcx> { impl<'a, 'tcx> CfgChecker<'a, 'tcx> { #[track_caller] fn fail(&self, location: Location, msg: impl AsRef<str>) { - let span = self.body.source_info(location).span; - // We use `span_delayed_bug` as we might see broken MIR when other errors have already - // occurred. - self.tcx.dcx().span_delayed_bug( - span, - format!( - "broken MIR in {:?} ({}) at {:?}:\n{}", - self.body.source.instance, - self.when, - location, - msg.as_ref() - ), + // We might see broken MIR when other errors have already occurred. + assert!( + self.tcx.dcx().has_errors().is_some(), + "broken MIR in {:?} ({}) at {:?}:\n{}", + self.body.source.instance, + self.when, + location, + msg.as_ref(), ); } |
