Skip to content

Commit 90ec757

Browse files
committed
multiboot2-header: update changelog + integration test
1 parent 55b836b commit 90ec757

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use core::ops::Deref;
12
use elf_rs::{ElfFile, ProgramHeaderEntry, ProgramType};
23
use multiboot2::{
3-
BootLoaderNameTag, CommandLineTag, MemoryArea, MemoryAreaType, MemoryMapTag,
4-
ModuleTag,
4+
BootLoaderNameTag, CommandLineTag, MemoryArea, MemoryAreaType, MemoryMapTag, ModuleTag,
5+
SmbiosTag,
56
};
67

78
/// Loads the first module into memory. Assumes that the module is a ELF file.
@@ -56,6 +57,11 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
5657
elf_mod.end as u32,
5758
elf_mod.string.unwrap(),
5859
))
60+
// Test that we can add SmbiosTag multiple times.
61+
.add_tag(SmbiosTag::new(1, 1, &[1, 2, 3]).deref())
62+
.unwrap()
63+
.add_tag(SmbiosTag::new(1, 2, &[1, 2, 3]).deref())
64+
.expect("should allow tag multiple times")
5965
.build();
6066

6167
log::info!(

multiboot2-header/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- added `EndHeaderTag::default()`
66
- MSRV is 1.69
7+
- Can add multiple `TagType::Smbios` tags in the builder.
78

89
## 0.3.2 (2023-11-30)
910

multiboot2/src/builder/boxed_dst.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,16 @@ mod tests {
141141
assert_eq!(tag.size as usize, METADATA_SIZE + content.len());
142142
assert_eq!(tag.string(), Ok(content_rust_str));
143143
}
144+
145+
#[test]
146+
fn can_hold_tag_trait() {
147+
fn consume<T: TagTrait + ?Sized>(_: &T) {}
148+
let content = b"hallo\0";
149+
150+
let tag = BoxedDst::<CustomTag>::new(content);
151+
consume(tag.deref());
152+
consume(&*tag);
153+
// Compiler not smart enough?
154+
// consume(&tag);
155+
}
144156
}

0 commit comments

Comments
 (0)