Skip to content
New issue

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

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

Already on GitHub? # to your account

Fixing future compiler error "unaligned_references" (82523) #82

Merged
merged 1 commit into from
Jul 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 39 additions & 43 deletions src/vbe_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,18 @@ pub struct VBEControlInfo {

impl fmt::Debug for VBEControlInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe {
f.debug_struct("VBEControlInfo")
.field("signature", &self.signature)
.field("version", &self.version)
.field("oem_string_ptr", &self.oem_string_ptr)
.field("capabilities", &self.capabilities)
.field("mode_list_ptr", &self.mode_list_ptr)
.field("total_memory", &self.total_memory)
.field("oem_software_revision", &self.oem_software_revision)
.field("oem_vendor_name_ptr", &self.oem_vendor_name_ptr)
.field("oem_product_name_ptr", &self.oem_product_name_ptr)
.field("oem_product_revision_ptr", &self.oem_product_revision_ptr)
.finish()
}
f.debug_struct("VBEControlInfo")
.field("signature", &self.signature)
.field("version", &{self.version})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this curly syntax creates a new copy, because the value itself is copy

.field("oem_string_ptr", &{self.oem_string_ptr})
.field("capabilities", &{self.capabilities})
.field("mode_list_ptr", &{self.mode_list_ptr})
.field("total_memory", &{self.total_memory})
.field("oem_software_revision", &{self.oem_software_revision})
.field("oem_vendor_name_ptr", &{self.oem_vendor_name_ptr})
.field("oem_product_name_ptr", &{self.oem_product_name_ptr})
.field("oem_product_revision_ptr", &{self.oem_product_revision_ptr})
.finish()
}
}

Expand Down Expand Up @@ -200,35 +198,33 @@ pub struct VBEModeInfo {

impl fmt::Debug for VBEModeInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe {
f.debug_struct("VBEModeInfo")
.field("mode_attributes", &self.mode_attributes)
.field("window_a_attributes", &self.window_a_attributes)
.field("window_b_attributes", &self.window_b_attributes)
.field("window_granularity", &self.window_granularity)
.field("window_size", &self.window_size)
.field("window_a_segment", &self.window_a_segment)
.field("window_b_segment", &self.window_b_segment)
.field("window_function_ptr", &self.window_function_ptr)
.field("pitch", &self.pitch)
.field("resolution", &self.resolution)
.field("character_size", &self.character_size)
.field("number_of_planes", &self.number_of_planes)
.field("bpp", &self.bpp)
.field("number_of_banks", &self.number_of_banks)
.field("memory_model", &self.memory_model)
.field("bank_size", &self.bank_size)
.field("number_of_image_pages", &self.number_of_image_pages)
.field("red_field", &self.red_field)
.field("green_field", &self.green_field)
.field("blue_field", &self.blue_field)
.field("reserved_field", &self.reserved_field)
.field("direct_color_attributes", &self.direct_color_attributes)
.field("framebuffer_base_ptr", &self.framebuffer_base_ptr)
.field("offscreen_memory_offset", &self.offscreen_memory_offset)
.field("offscreen_memory_size", &self.offscreen_memory_size)
.finish()
}
f.debug_struct("VBEModeInfo")
.field("mode_attributes", &{self.mode_attributes})
.field("window_a_attributes", &self.window_a_attributes)
.field("window_b_attributes", &self.window_b_attributes)
.field("window_granularity", &{self.window_granularity})
.field("window_size", &{self.window_size})
.field("window_a_segment", &{self.window_a_segment})
.field("window_b_segment", &{self.window_b_segment})
.field("window_function_ptr", &{self.window_function_ptr})
.field("pitch", &{self.pitch})
.field("resolution", &{self.resolution})
.field("character_size", &self.character_size)
.field("number_of_planes", &self.number_of_planes)
.field("bpp", &self.bpp)
.field("number_of_banks", &self.number_of_banks)
.field("memory_model", &self.memory_model)
.field("bank_size", &self.bank_size)
.field("number_of_image_pages", &self.number_of_image_pages)
.field("red_field", &self.red_field)
.field("green_field", &self.green_field)
.field("blue_field", &self.blue_field)
.field("reserved_field", &self.reserved_field)
.field("direct_color_attributes", &self.direct_color_attributes)
.field("framebuffer_base_ptr", &{self.framebuffer_base_ptr})
.field("offscreen_memory_offset", &{self.offscreen_memory_offset})
.field("offscreen_memory_size", &{self.offscreen_memory_size})
.finish()
}
}

Expand Down