rust-cli / env_logger

A logging implementation for `log` which is configured via an environment variable.
https://docs.rs/env_logger
Apache License 2.0
803 stars 125 forks source link

v0.11.5 doctests fail to compile with Rust 1.80.0 #327

Closed decathorpe closed 1 month ago

decathorpe commented 1 month ago

I encountered this when updating env_logger to 0.11.5 on Fedora Rawhide with Rust 1.80.0:

failures:
---- src/lib.rs - (line 40) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:41:1
  |
3 | $ RUST_LOG=info ./main
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
---- src/lib.rs - (line 73) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:74:1
  |
3 | $ RUST_LOG=my_app ./my-app
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
---- src/lib.rs - (line 63) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:64:1
  |
3 | $ RUST_LOG=main ./main
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
---- src/lib.rs - (line 55) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:56:1
  |
3 | $ RUST_LOG=main=info ./main
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
---- src/lib.rs - (line 35) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:36:1
  |
3 | $ RUST_LOG=error ./main
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
---- src/lib.rs - (line 46) stdout ----
error: expected expression, found `$`
 --> src/lib.rs:47:1
  |
3 | $ RUST_LOG=debug ./main
  | ^ expected expression
error: aborting due to 1 previous error
Couldn't compile the test.
failures:
    src/lib.rs - (line 35)
    src/lib.rs - (line 40)
    src/lib.rs - (line 46)
    src/lib.rs - (line 55)
    src/lib.rs - (line 63)
    src/lib.rs - (line 73)
test result: FAILED. 28 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.89s
error: doctest failed, to rerun pass `--doc`
error: 1 target failed:
    `--doc`

It looks like {.bash} is not recognized and rustdoc attempts to compile these snippets that are not Rust code.

Not sure if this is a regression in rustdoc with Rust 1.80.0 or if the syntax used to specify the language of the code snippet is invalid (I've never seen it used this way before).

epage commented 1 month ago

Fixed with #326

decathorpe commented 1 month ago

Ah, thanks! Could have sworn that this wasn't fixed yet when I filed this issue. Looks like a race condition :)

epage commented 1 month ago

I'm in the middle of processing 1.80 changes across all of my projects.