Skip to content

Commit

Permalink
compilation fixes for rust nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
jabuwu committed Aug 4, 2023
1 parent abf7844 commit 8eeefcf
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mint = { version = "0.5", optional = true }
miniquad = "0.3.16"
image = { version = "0.24", default-features = false, features = [ "png", "webp", "jpeg" ] }
glam = "0.23"
cosmic-text = "0.8"
cosmic-text = "0.9"

[profile.dev.package."*"]
opt-level = 3
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.6.1 (UNRELEASED)
- Compilation fixes for new Rust lints

# 0.6.0
- All indices are now `usize` (previously some were `i32` which lead to inconsistent APIs)
- Events are nicer to work with using the new `AnimationEvent` enum.
Expand Down
4 changes: 2 additions & 2 deletions examples/miniquad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ fn main() {

/// Not part of the demo, just necessary to render some text.
mod text {
use cosmic_text::{Attrs, FontSystem, Metrics, SwashCache, Wrap};
use cosmic_text::{Attrs, FontSystem, Metrics, Shaping, SwashCache, Wrap};
use glam::Vec2;
use miniquad::*;
use rusty_spine::Color;
Expand Down Expand Up @@ -801,7 +801,7 @@ mod text {
let mut buffer = buffer.borrow_with(&mut self.font_system);
buffer.set_wrap(Wrap::None);
buffer.set_size(f32::MAX, f32::MAX);
buffer.set_text(text, Attrs::new());
buffer.set_text(text, Attrs::new(), Shaping::Basic);
buffer.shape_until_scroll();
}
let mut width = 1_usize;
Expand Down
17 changes: 8 additions & 9 deletions src/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ impl Atlas {

#[must_use]
pub fn pages_mut(&mut self) -> AtlasPageMutIterator {
AtlasPageMutIterator {
_atlas: self,
page: unsafe { self.c_ptr_mut().pages },
}
let page = unsafe { self.c_ptr_mut().pages };
AtlasPageMutIterator { _atlas: self, page }
}

#[must_use]
Expand All @@ -140,9 +138,10 @@ impl Atlas {

#[must_use]
pub fn regions_mut(&mut self) -> AtlasRegionMutIterator {
let region = unsafe { self.c_ptr_mut().regions };
AtlasRegionMutIterator {
_atlas: self,
region: unsafe { self.c_ptr_mut().regions },
region,
}
}

Expand Down Expand Up @@ -239,7 +238,7 @@ pub mod atlas {
}

pub struct AtlasPageMutIterator<'a> {
pub(crate) _atlas: &'a Atlas,
pub(crate) _atlas: &'a mut Atlas,
pub(crate) page: *mut spAtlasPage,
}

Expand All @@ -252,7 +251,7 @@ pub mod atlas {
self.page = unsafe { (*self.page).next };
#[allow(clippy::cast_ref_to_mut)]
Some(CTmpMut::new(
unsafe { &mut *(self._atlas as *const Atlas as *mut Atlas) },
unsafe { &mut *(self._atlas as *mut Atlas) },
page,
))
} else {
Expand Down Expand Up @@ -418,7 +417,7 @@ pub mod atlas {
}

pub struct AtlasRegionMutIterator<'a> {
pub(crate) _atlas: &'a Atlas,
pub(crate) _atlas: &'a mut Atlas,
pub(crate) region: *mut spAtlasRegion,
}

Expand All @@ -431,7 +430,7 @@ pub mod atlas {
self.region = unsafe { (*self.region).next };
#[allow(clippy::cast_ref_to_mut)]
Some(CTmpMut::new(
unsafe { &mut *(self._atlas as *const Atlas as *mut Atlas) },
unsafe { &mut *(self._atlas as *mut Atlas) },
page,
))
} else {
Expand Down
Loading

0 comments on commit 8eeefcf

Please sign in to comment.