Avoid ICE in coverage builds with bad #[coverage(..)]
attributes
This code can sometimes witness malformed coverage attributes in builds that are going to fail, so use `span_delayed_bug` to avoid an inappropriate ICE in that case.
This commit is contained in:
parent
ad9c494835
commit
8e382ba022
5 changed files with 59 additions and 6 deletions
|
@ -63,7 +63,8 @@ fn coverage_attr_on(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|||
Some([item]) if item.has_name(sym::on) => return true,
|
||||
Some(_) | None => {
|
||||
// Other possibilities should have been rejected by `rustc_parse::validate_attr`.
|
||||
tcx.dcx().span_bug(attr.span, "unexpected value of coverage attribute");
|
||||
// Use `span_delayed_bug` to avoid an ICE in failing builds (#127880).
|
||||
tcx.dcx().span_delayed_bug(attr.span, "unexpected value of coverage attribute");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue