summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Rask <33556894+SimonRask@users.noreply.github.com>2023-09-04 11:47:13 +0200
committerGitHub <noreply@github.com>2023-09-04 11:47:13 +0200
commitbe83b2cc66bfd3b6114de8efa49754496cd1f527 (patch)
treea1f7db2ef02ccba15b4fa296abd7a98259dc33e3
parent1cc67d5df228eab95131082122753f29d4c15a07 (diff)
Remove `ManuallyDrop` usage (#2058)
This usage can be removed since the issue was fixed: https://github.com/rust-lang/rust/issues/70919
-rw-r--r--crates/typst/src/model/mod.rs18
1 files changed, 3 insertions, 15 deletions
diff --git a/crates/typst/src/model/mod.rs b/crates/typst/src/model/mod.rs
index 0e7f99b1..100006b4 100644
--- a/crates/typst/src/model/mod.rs
+++ b/crates/typst/src/model/mod.rs
@@ -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};
@@ -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.
@@ -73,14 +69,9 @@ pub fn typeset(
};
// Layout!
- let result = (library.items.layout)(&mut vt, content, styles)?;
-
- // Drop the old introspector.
- ManuallyDrop::into_inner(introspector);
+ document = (library.items.layout)(&mut vt, content, styles)?;
- // 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) {
@@ -96,9 +87,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));