-
Notifications
You must be signed in to change notification settings - Fork 13.6k
coverage: Run-make regression test for #[derive(arbitrary::Arbitrary)]
#144571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Ah, this will probably want |
It's quite uncommon to have tests with external dependencies. Is this only because it's still difficult to minimize? If so, I will minimize it. |
[dependencies] | ||
arbitrary = { version = "1.4.1", features = ["derive"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: this is subject to the same consideration as #128733. Maybe at least pin this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering how the other run-make cargo tests deal with these concerns, but I guess the answer is that they don't. 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, unfortunately...
can't you run |
This comment has been minimized.
This comment has been minimized.
The expanded code would become plain Rust code, which would almost certainly not reproduce the problem. |
Partly because it's difficult to minimize, and partly because I fear that a smaller repro would not actually be a very useful regression test if it ends up being overfitted to quirks of the current implementation. The (coverage) test suite currently has approximately no coverage of real-world proc-macro usage, which is very often what encounters these obscure regressions. And it's not possible to capture real-world usage without dependencies like I mainly wrote this test because #144530 (comment) made me worried about not being able to re-land #144298 without a test. |
That's the usual problem with all regression tests, and it's absolutely fine. We can't predict future changes and issues, so we try to prevent known ones. If it they reappear under slightly different conditions so be it, we'll fix that different issue. It happens all the time, and it's all good.
We have tests for all issues where we can, that's unrelated to any future coverage work which I'm actually excited to see land sooner rather than later. That is why I r+ed the PR and didn't consider the lack of test blocking. Big thanks for removing the annoying fuzzing setup in the original repro. I will make you a minimization ASAP. |
Here's another tip that could help with minimization: after reapplying #144298, go to the bottom of That will cause the buggy case to ICE the compiler, instead of having to do the extra steps with (Of course, it would be wise to verify the MCVE against llvm-cov to make sure it still reproduces the issue properly.) |
@rustbot blocked Waiting for an MCVE that could make this PR mostly obsolete. |
proc macro: #[proc_macro_derive(Arbitrary, attributes(arbitrary))]
pub fn derive_arbitrary(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
"impl Arbitrary for MyEnum {
fn try_size_hint() -> Option<usize> {
Some(0)?;
None
}
}".parse().unwrap()
} repro: #[derive(derive_dependency::Arbitrary)]
enum MyEnum {}
fn main() {
MyEnum::try_size_hint();
}
trait Arbitrary {
fn try_size_hint() -> Option<usize>;
} |
Thanks, that’s actually a more helpful repro than I was expecting. The main culprit seems to be the presence of I’ll get to work on adapting this into a coverage test, and verify it on my end. |
Closing this in favour of #144616. I would still like to get some more test coverage of “real-world” proc-macro expansions at some point, but that has its own obstacles such as #144571 (comment), so it's not a priority right now. |
coverage: Regression test for "function name is empty" bug Regression test for rust-lang#141577, which was triggered by rust-lang#144298. The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization at rust-lang#144571 (comment). --- I have manually verified that reverting the relevant follow-up fixes (rust-lang#144480 and rust-lang#144530) causes this test to reproduce the bug: ```sh git revert -m1 8aa3d41 c462895 ``` --- r? compiler
coverage: Regression test for "function name is empty" bug Regression test for rust-lang#141577, which was triggered by rust-lang#144298. The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization at rust-lang#144571 (comment). --- I have manually verified that reverting the relevant follow-up fixes (rust-lang#144480 and rust-lang#144530) causes this test to reproduce the bug: ```sh git revert -m1 8aa3d41 c462895 ``` --- r? compiler
coverage: Regression test for "function name is empty" bug Regression test for rust-lang#141577, which was triggered by rust-lang#144298. The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization at rust-lang#144571 (comment). --- I have manually verified that reverting the relevant follow-up fixes (rust-lang#144480 and rust-lang#144530) causes this test to reproduce the bug: ```sh git revert -m1 8aa3d41 c462895 ``` --- r? compiler
Rollup merge of #144616 - Zalathar:try-in-macro, r=jieyouxu coverage: Regression test for "function name is empty" bug Regression test for #141577, which was triggered by #144298. The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization at #144571 (comment). --- I have manually verified that reverting the relevant follow-up fixes (#144480 and #144530) causes this test to reproduce the bug: ```sh git revert -m1 8aa3d41 c462895 ``` --- r? compiler
coverage: Regression test for "function name is empty" bug Regression test for rust-lang/rust#141577, which was triggered by rust-lang/rust#144298. The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization at rust-lang/rust#144571 (comment). --- I have manually verified that reverting the relevant follow-up fixes (rust-lang/rust#144480 and rust-lang/rust#144530) causes this test to reproduce the bug: ```sh git revert -m1 8aa3d41b8527f9f78e0f2459b50a6e13aea35144 c462895a6f0b463ff0c1c1db2a3a654d7e5976c7 ``` --- r? compiler
This is a regression test for #141577 (comment), which resulted in
llvm-cov
producing the cryptic error message:The repro we have is triggered by
#[derive(arbitrary::Arbitrary)]
, and is difficult to minimize beyond that point. So instead of a coverage test, this PR adds a run-make test that builds against the realarbitrary
crate, and then runsllvm-cov
to verify that it doesn't crash.I have manually verified that this would have caught the regression introduced by #144298.
r? compiler