esp-rs / esp-hal

no_std Hardware Abstraction Layers for ESP32 microcontrollers
https://docs.esp-rs.org/esp-hal/
Apache License 2.0
751 stars 208 forks source link

cargo doc fails #658

Closed FuzzyLitchi closed 1 year ago

FuzzyLitchi commented 1 year ago

What happens?

When I run cargo doc --target riscv32imc-unknown-none-elf on a project with esp32c3-hal = "0.10.0" as a dependency, it fails with the following error message.

    Checking esp-riscv-rt v0.3.0
 Documenting esp-riscv-rt v0.3.0
 Documenting esp-hal-procmacros v0.6.0
    Checking esp-hal-common v0.10.0
 Documenting esp-hal-common v0.10.0
error[E0428]: the name `InternalContext` is defined multiple times
  --> /home/polly/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-common-0.10.0/src/rom/md5.rs:67:1
   |
62 | struct InternalContext;
   | ----------------------- previous definition of the type `InternalContext` here
...
67 | struct InternalContext {
   | ^^^^^^^^^^^^^^^^^^^^^^ `InternalContext` redefined here
   |
   = note: `InternalContext` must be defined only once in the type namespace of this module

For more information about this error, try `rustc --explain E0428`.
error: could not document `esp-hal-common`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name esp_hal_common /home/polly/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-common-0.10.0/src/lib.rs --cap-lints allow --target riscv32imc-unknown-none-elf -o /home/polly/Development/repro/target/riscv32imc-unknown-none-elf/doc --cfg 'feature="esp-riscv-rt"' --cfg 'feature="esp32c3"' --cfg 'feature="riscv"' --cfg 'feature="riscv-atomic-emulation-trap"' --cfg 'feature="rv-zero-rtc-bss"' --cfg 'feature="vectored"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=143 -C metadata=b431a884e05003db -L dependency=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps -L dependency=/home/polly/Development/repro/target/debug/deps --extern bitflags=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libbitflags-0d8c316d089aab4b.rmeta --extern cfg_if=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libcfg_if-a7e189ade9f5712a.rmeta --extern critical_section=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libcritical_section-43ebbe3023cde884.rmeta --extern embedded_dma=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libembedded_dma-123a4fd9140cf194.rmeta --extern embedded_hal=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libembedded_hal-ccdb2116268097db.rmeta --extern procmacros=/home/polly/Development/repro/target/debug/deps/libesp_hal_procmacros-bff83fac9363a498.so --extern esp_riscv_rt=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libesp_riscv_rt-9bf1ca78d75d548c.rmeta --extern esp32c3=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libesp32c3-f838761dce6ca861.rmeta --extern fugit=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libfugit-3307809d5085c7d0.rmeta --extern log=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/liblog-4a2ae66dc17941ba.rmeta --extern nb=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libnb-28adfc6333f35e15.rmeta --extern paste=/home/polly/Development/repro/target/debug/deps/libpaste-d4a77623cdb6df0e.so --extern riscv_atomic_emulation_trap=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libriscv_atomic_emulation_trap-eed36d35e9d1aec8.rmeta --extern strum=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libstrum-191c54abdcd19d9d.rmeta --extern void=/home/polly/Development/repro/target/riscv32imc-unknown-none-elf/debug/deps/libvoid-98e3bce4932d8841.rmeta --crate-version 0.10.0 --cfg esp32c3 --cfg riscv --cfg single_core --cfg aes --cfg apb_ctrl --cfg apb_saradc --cfg assist_debug --cfg dma --cfg ds --cfg efuse --cfg extmem --cfg gpio --cfg gpio_sd --cfg hmac --cfg i2c0 --cfg i2s0 --cfg interrupt_core0 --cfg io_mux --cfg ledc --cfg rmt --cfg rng --cfg rsa --cfg rtc_cntl --cfg sensitive --cfg sha --cfg spi0 --cfg spi1 --cfg spi2 --cfg system --cfg systimer --cfg timg0 --cfg timg1 --cfg twai0 --cfg uart0 --cfg uart1 --cfg uhci0 --cfg uhci1 --cfg usb_device --cfg xts_aes --cfg adc --cfg assist_debug_sp_monitor --cfg assist_debug_region_monitor --cfg gdma --cfg radio --cfg phy --cfg bt --cfg wifi --cfg rom_crc_le --cfg rom_crc_be --cfg rom_md5_bsd --cfg pm_support_wifi_wakeup --cfg pm_support_bt_wakeup --cfg uart_support_wakeup_int --cfg gpio_support_deepsleep_wakeup` (exit status: 1)
warning: build failed, waiting for other jobs to finish...

I've read the other issues about docs, but they seem unrelated. It would be nice to have documentation locally :)

bjoernQ commented 1 year ago

Thanks! Seems like we currently have a bug - you can (locally) remove https://github.com/esp-rs/esp-hal/blob/37466fd9c7b065ea63ce2c0785919667c863bcd9/esp-hal-common/src/rom/md5.rs#L61-L62 and the docs should build fine.

We need to fix this