-
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
base: master
Are you sure you want to change the base?
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>;
} |
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