icedland / iced

Blazing fast and correct x86/x64 disassembler, assembler, decoder, encoder for Rust, .NET, Java, Python, Lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust doctest failure

vext01 opened this issue · comments

---- iced-x86/src/lib.rs - (line 192) stdout ----                                                                                                                                                                                             
error[E0432]: unresolved import `iced_x86::code_asm`
 --> iced-x86/src/lib.rs:194:15
  |
5 | use iced_x86::code_asm::*;
  |               ^^^^^^^^ could not find `code_asm` in `iced_x86`

error[E0412]: cannot find type `IcedError` in this scope
 --> iced-x86/src/lib.rs:197:57
  |
8 | pub(crate) fn how_to_use_code_assembler() -> Result<(), IcedError> {
  |                                                         ^^^^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
2 + use iced_x86::IcedError;

(today's master)

You need to add --feature code_asm since it's disabled by default.

Should the import line (and any other optionally used stuff) be guarded #[cfg(feature = "code_asm")]?

Those examples are part of README.md so users probably copy and paste some of it to their files to test it and they don't necessarily have the same feature flags as iced-x86 itself.

My build.yml only tests the docs like so: cargo doc --color always --features "serde code_asm mvex"

It would be good if it works as expected under any combo of features. I have no idea if that's possible/difficult, so I'll leave the decision up to you.

Cheers.

The README tests get tested by the CI with the correct feature flags. You can add code_asm if you want to run the tests.