Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootloader seems to generated dead_code warnings #1317

Closed
Lokathor opened this issue Apr 29, 2024 · 2 comments
Closed

bootloader seems to generated dead_code warnings #1317

Lokathor opened this issue Apr 29, 2024 · 2 comments

Comments

@Lokathor
Copy link

I'm up to having the test cases running, and everything is compiling, but every time I cargo run or cargo test and build through the bootloader runner, I get a warning about dead code in some sort of generated enum declaration or something that's not actually part of my own crate:

Compiling bootloader v0.9.28 (/home/loka/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bootloader-0.9.28)
warning: field `0` is never read
  --> src/page_table.rs:20:13
   |
20 |     Mapping(MapToError<Size4KiB>),
   |     ------- ^^^^^^^^^^^^^^^^^^^^
   |     |
   |     field in this variant
   |
   = note: `#[warn(dead_code)]` on by default
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
   |
20 |     Mapping(()),
   |             ~~

warning: `bootloader` (bin "bootloader") generated 1 warning

I'd file an issue with the bootloader repo, but they're two breaking versions ahead of where this tutorial is, so I'm not sure they'll want to update the 0.9 series to fix this.

The exact versions of everything I'm using are as follows:

$ cargo tree
blog_os v0.1.0 (/home/loka/phil_opp_os)
├── bootloader v0.9.28
├── lazy_static v1.4.0
│   └── spin v0.5.2
├── spin v0.9.8
│   └── lock_api v0.4.12
│       └── scopeguard v1.2.0
│       [build-dependencies]
│       └── autocfg v1.2.0
├── uart_16550 v0.3.0
│   ├── bitflags v1.3.2
│   ├── rustversion v1.0.15 (proc-macro)
│   └── x86 v0.52.0
│       ├── bit_field v0.10.2
│       ├── bitflags v1.3.2
│       └── raw-cpuid v10.7.0
│           └── bitflags v1.3.2
├── voladdress v1.3.0
└── x86_64 v0.15.1
    ├── bit_field v0.10.2
    ├── bitflags v2.5.0
    ├── rustversion v1.0.15 (proc-macro)
    └── volatile v0.4.6

I've tried to set RUSTFLAGS in the .cargo/config.toml to allow unused, but that didn't have an effect. I've got no clue how to make this huge useless warning stop showing up.

@phil-opp
Copy link
Owner

Thanks for reporting!

I'd file an issue with the bootloader repo, but they're two breaking versions ahead of where this tutorial is, so I'm not sure they'll want to update the 0.9 series to fix this.

I'm maintaining the bootloader crate and I'm trying to keep the v0.9 releases up-to-date until I'm done migrating this tutorial to v0.11. I opened a PR at rust-osdev/bootloader#436 to fix the warning.

@phil-opp
Copy link
Owner

Should be fixed in bootloader v0.9.29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants