-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error: malformed `coverage` attribute input | ||
--> $DIR/bad-attr-ice.rs:10:1 | ||
| | ||
LL | #[coverage] | ||
| ^^^^^^^^^^^ | ||
| | ||
help: the following are the possible correct uses | ||
| | ||
LL | #[coverage(off)] | ||
| | ||
LL | #[coverage(on)] | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: malformed `coverage` attribute input | ||
--> $DIR/bad-attr-ice.rs:10:1 | ||
| | ||
LL | #[coverage] | ||
| ^^^^^^^^^^^ | ||
| | ||
help: the following are the possible correct uses | ||
| | ||
LL | #[coverage(off)] | ||
| | ||
LL | #[coverage(on)] | ||
| | ||
|
||
error[E0658]: the `#[coverage]` attribute is an experimental feature | ||
--> $DIR/bad-attr-ice.rs:10:1 | ||
| | ||
LL | #[coverage] | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information | ||
= help: add `#![feature(coverage_attribute)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![cfg_attr(feat, feature(coverage_attribute))] | ||
//@ revisions: feat nofeat | ||
//@ compile-flags: -Cinstrument-coverage | ||
//@ needs-profiler-support | ||
|
||
// Malformed `#[coverage(..)]` attributes should not cause an ICE when built | ||
// with `-Cinstrument-coverage`. | ||
// Regression test for <https://github.com/rust-lang/rust/issues/127880>. | ||
|
||
#[coverage] | ||
//~^ ERROR malformed `coverage` attribute input | ||
//[nofeat]~| the `#[coverage]` attribute is an experimental feature | ||
fn main() {} | ||
|
||
// FIXME(#130766): When the `#[coverage(..)]` attribute is stabilized, | ||
// get rid of the revisions and just make this a normal test. |