Skip to content

Commit e2c691e

Browse files
authored
Merge pull request #226 from rust-osdev/tag-casting
multiboot2: massive refactoring, removed UB, Miri passes all tests
2 parents c8030ae + 3484e63 commit e2c691e

36 files changed

+1199
-900
lines changed

.github/workflows/_build-rust.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ jobs:
9898
run: cargo test --verbose
9999
- name: Unit Test with Miri
100100
if: inputs.do-miri
101-
# "--tests" so that the doctests are skipped. Currently, the doctest
102-
# in miri fails.
103101
run: |
104102
rustup component add miri
105-
cargo miri test --tests
103+
# Run with stack-borrow model
104+
# XXX Temporarily, just for multiboot2 crate.
105+
cargo miri test -p multiboot2
106+
# Run with tree-borrow model
107+
# XXX Temporarily, just for multiboot2 crate.
108+
MIRIFLAGS=-Zmiri-tree-borrows cargo +nightly miri test -p multiboot2

.github/workflows/rust.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
name: build (msrv)
2525
uses: ./.github/workflows/_build-rust.yml
2626
with:
27-
rust-version: 1.75.0 # MSRV
27+
rust-version: 1.70.0 # MSRV
2828
do-style-check: false
2929
features: builder
3030

@@ -50,7 +50,7 @@ jobs:
5050
needs: build_msrv
5151
uses: ./.github/workflows/_build-rust.yml
5252
with:
53-
rust-version: 1.75.0 # MSRV
53+
rust-version: 1.70.0 # MSRV
5454
do-style-check: false
5555
rust-target: thumbv7em-none-eabihf
5656
features: builder
@@ -107,7 +107,7 @@ jobs:
107107
needs: build_msrv
108108
uses: ./.github/workflows/_build-rust.yml
109109
with:
110-
rust-version: 1.75.0 # MSRV
110+
rust-version: 1.70.0 # MSRV
111111
do-style-check: true
112112
do-test: false
113113
features: builder

Cargo.lock

Lines changed: 2 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exclude = [
1010

1111
[workspace.dependencies]
1212
bitflags = "2.6.0"
13-
derive_more = { version = "1.0.0", default-features = false, features = ["display"] }
13+
derive_more = { version = "~0.99.18", default-features = false, features = ["display"] }
1414
log = { version = "~0.4", default-features = false }
1515

1616
# This way, the "multiboot2" dependency in the multiboot2-header crate can be

integration-test/bins/Cargo.lock

Lines changed: 2 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-test/bins/multiboot2_chainloader/src/loader.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
4444

4545
// build MBI
4646
let mbi = multiboot2::builder::InformationBuilder::new()
47-
.bootloader_name_tag(BootLoaderNameTag::new("mb2_integrationtest_chainloader"))
48-
.command_line_tag(CommandLineTag::new("chainloaded YEAH"))
47+
.bootloader_name_tag(&BootLoaderNameTag::new("mb2_integrationtest_chainloader"))
48+
.command_line_tag(&CommandLineTag::new("chainloaded YEAH"))
4949
// random non-sense memory map
50-
.memory_map_tag(MemoryMapTag::new(&[MemoryArea::new(
50+
.memory_map_tag(&MemoryMapTag::new(&[MemoryArea::new(
5151
0,
5252
0xffffffff,
5353
MemoryAreaType::Reserved,
5454
)]))
55-
.add_module_tag(ModuleTag::new(
55+
.add_module_tag(&ModuleTag::new(
5656
elf_mod.start as u32,
5757
elf_mod.end as u32,
5858
elf_mod.string.unwrap(),

multiboot2-header/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ readme = "README.md"
2626
homepage = "https://github.com/rust-osdev/multiboot2-header"
2727
repository = "https://github.com/rust-osdev/multiboot2"
2828
documentation = "https://docs.rs/multiboot2-header"
29-
rust-version = "1.75"
29+
rust-version = "1.70"
3030

3131
[[example]]
3232
name = "minimal"

multiboot2-header/Changelog.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
## Unreleased
44

55
- **Breaking** All functions that returns something useful are now `#[must_use]`
6-
- updated dependencies
7-
- documentation enhancements
86

97
## 0.4.0 (2024-05-01)
108

multiboot2-header/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ bytes of the ELF. See Multiboot2 specification.
7777

7878
## MSRV
7979

80-
The MSRV is 1.75.0 stable.
80+
The MSRV is 1.70.0 stable.
8181

8282
## License & Contribution
8383

multiboot2-header/src/builder/header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ impl HeaderBuilder {
255255
/// Adds information requests from the
256256
/// [`InformationRequestHeaderTagBuilder`] to the builder.
257257
#[must_use]
258+
#[allow(clippy::missing_const_for_fn)] // only in Rust 1.70 necessary
258259
pub fn information_request_tag(
259260
mut self,
260261
information_request_tag: InformationRequestHeaderTagBuilder,

0 commit comments

Comments
 (0)