add test infra to explicitely test rustc with autodiff/enzyme disabled by ZuseZ4 · Pull Request #131470 · rust-lang/rust (original) (raw)
I assume this is not what you want for now, but I'll update the PR once I understand how the ignore- directives work.
To summarize the situation, we want a feature gate test where we don't enable the autodiff feature using #![feature(autodiff)]
. There are two situations.
- We have a rustc which was build without autodiff support (current default): It gives one error about the feature being needed and one error about this rustc version being build without autodiff support.
- We have a rustc which was build with autodiff support (i.e. for now a custom build): It gives one error about the feature being needed.
We have a //@needs-enzyme
directive which we can use in revisions for the second case.
However, we have no way to specify that needs-enzyme implies that the second error should not be seen.
This ads a way of passing the following test:
//@ revisions: has_support no_support
//@[has_support] needs-enzyme
//@[no_support] needs-enzyme-disabled
#![crate_type = "lib"]
#[autodiff(dfoo, Reverse)]
//[has_support]~^ ERROR use of unstable library feature 'autodiff' [E0658]
//[no_support]~^^ ERROR use of unstable library feature 'autodiff' [E0658]
//[no_support]~| ERROR this rustc version does not support autodiff
fn foo() {}
Cherry picking this PR to my frontend pr makes the test above pass in both configurations (enzyme=true/false in config.toml).
I'm open to other changes that make this testcase pass.
r? @jieyouxu
Tracking: