Skip to content

Commit

Permalink
Remove ManuallyDrop usage
Browse files Browse the repository at this point in the history
This usage can be removed since the issue was fixed:
rust-lang/rust#70919
  • Loading branch information
SimonRask committed Sep 2, 2023
1 parent c0b332a commit e50fff7
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions crates/typst/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ pub use self::styles::{
Styles, Transform,
};

use std::mem::ManuallyDrop;

use comemo::{Track, Tracked, TrackedMut, Validate};

use crate::diag::{warning, SourceDiagnostic, SourceResult};
Expand All @@ -51,9 +49,7 @@ pub fn typeset(
let mut document;
let mut delayed;

// We need `ManuallyDrop` until this lands in stable:
// https://github.com/rust-lang/rust/issues/70919
let mut introspector = ManuallyDrop::new(Introspector::new(&[]));
let mut introspector = Introspector::new(&[]);

// Relayout until all introspections stabilize.
// If that doesn't happen within five attempts, we give up.
Expand All @@ -75,12 +71,9 @@ pub fn typeset(
// Layout!
let result = (library.items.layout)(&mut vt, content, styles)?;

// Drop the old introspector.
ManuallyDrop::into_inner(introspector);

// Only now assign the document and construct the new introspector.
document = result;
introspector = ManuallyDrop::new(Introspector::new(&document.pages));
introspector = Introspector::new(&document.pages);
iter += 1;

if introspector.validate(&constraint) {
Expand All @@ -96,9 +89,6 @@ pub fn typeset(
}
}

// Drop the introspector.
ManuallyDrop::into_inner(introspector);

// Promote delayed errors.
if !delayed.0.is_empty() {
return Err(Box::new(delayed.0));
Expand Down

0 comments on commit e50fff7

Please sign in to comment.