commure / datatest

Datatest -- data-driven test framework for Rust
Apache License 2.0
53 stars 15 forks source link

Compiler errors on nightly: `TDynBenchFn` vs `DynBenchFn` #36

Open prestontw opened 2 years ago

prestontw commented 2 years ago

Running on rustc 1.61.0-nightly (58f11791a 2022-03-17), x86_64-apple-darwin, I'm seeing the following errors:

error[E0432]: unresolved import `rustc_test::TDynBenchFn`
 --> /Users/preston/.cargo/registry/src/-0173b81e52c88a87/datatest-0.6.3/src/data.rs:2:27
  |
2 | use rustc_test::{Bencher, TDynBenchFn};
  |                           ^^^^^^^^^^^
  |                           |
  |                           no `TDynBenchFn` in the root
  |                           help: a similar name exists in the module: `DynBenchFn`

error[E0405]: cannot find trait `TDynBenchFn` in crate `rustc_test`
  --> /Users/preston/.cargo/registry/src/-0173b81e52c88a87/datatest-0.6.3/src/data.rs:78:21
   |
78 | impl<T> rustc_test::TDynBenchFn for DataBenchFn<T>
   |                     ^^^^^^^^^^^ not found in `rustc_test`

error[E0405]: cannot find trait `TDynBenchFn` in crate `rustc_test`
   --> /Users/preston/.cargo/registry/src/-0173b81e52c88a87/datatest-0.6.3/src/runner.rs:120:18
    |
120 | impl rustc_test::TDynBenchFn for FilesBenchFn {
    |                  ^^^^^^^^^^^ not found in `rustc_test`

Some errors have detailed explanations: E0405, E0432.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `datatest` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

This fix to this seems pretty straight-forward (rename the import and implement the differences between the versions of the trait), but I'm not sure how to make this pass for both stable and nightly rustc versions. Maybe I can use @cormacrelf 's trick in https://github.com/commure/datatest/pull/30/files#diff-d0d98998092552a1d3259338c2c71e118a5b8343dd4703c0c7f552ada7f9cb42R26-R27 for detecting which trait we should use?

peterdk commented 1 year ago

I am trying to get datatest to work on nightly, but just replacing it with DynBenchFn doesn't work. It complains about that that is not a trait. Since I am a Rust noob I don't know how to fix this issue. Guess I'll have to look at another crate for dynamic tests.