hopv/hoice

cargo test fails in rust 1.64.0

moratorium08 opened this issue · 1 comments

The output for cargo test

$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.25s
     Running unittests src/hoice.rs (target/debug/deps/hoice-8c0ebc4b1caf9f8b)

running 40 tests
test dtyp::dtyp_write_dec ... ok
...(omitted)....
test src/common/macros.rs - common::macros::try_val (line 382) ... FAILED
...(omitted)...
---- src/common/macros.rs - common::macros::try_val (line 382) stdout ----
error: cannot find macro `try_val` in this scope
  --> src/common/macros.rs:390:7
   |
11 |   Ok( try_val!{ bool val } )
   |       ^^^^^^^

error: cannot find macro `try_val` in this scope
 --> src/common/macros.rs:387:7
  |
8 |   Ok( try_val!{ int val } )
  |       ^^^^^^^

error[E0412]: cannot find type `Res` in this scope
 --> src/common/macros.rs:386:21
  |
7 | fn int(val: Val) -> Res<Val> {
  |                     ^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use hoice::errors::Res;
  |

error[E0412]: cannot find type `Res` in this scope
  --> src/common/macros.rs:389:22
   |
10 | fn bool(val: Val) -> Res<Val> {
   |                      ^^^ not found in this scope
   |
help: consider importing this type alias
   |
2  | use hoice::errors::Res;
   |

error[E0603]: type alias `Val` is private
  --> src/common/macros.rs:383:18
   |
4  | use hoice::term::Val ;
   |                  ^^^ private type alias
   |
note: the type alias `Val` is defined here
  --> /home/katsura/github.com/hopv/hoice/src/term.rs:60:5
   |
60 | use crate::common::*;
   |     ^^^^^^^^^^^^^^^^

error: unused import: `hoice::errors`
 --> src/common/macros.rs:384:5
  |
5 | use hoice::errors ;
  |     ^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/common/macros.rs:380:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^
  = note: `#[deny(unused_imports)]` implied by `#[deny(warnings)]`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0412, E0603.
For more information about an error, try `rustc --explain E0412`.
Couldn't compile the test.

failures:
    src/common/macros.rs - common::macros::try_val (line 382)

test result: FAILED. 215 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 53.01s

It looks like the doctest for common::macros::try_val is actually broken, but in the past stable cargo did not complain about it because it ignored that test. In fact, if I switch my toolchain version to 1.60.0, then cargo test successfully passes since it seems to ignore this broken test (well, presumably, cargo in 1.60.0 was broken with some reason 🤷 ).

I'm not sure about the implementation of hoice, so I cannot fix this problem myself, but the test should be fixed so that CI won't complain anymore about this.

Thank you for reporting this issue 🐱

You gave me all the information I needed, it seems this test was long, long broken and completely outdated. I removed it and updated dependencies, pinned versions, and switched to edition 2021.