mirror of
https://github.com/typst/typst
synced 2025-05-23 05:25:28 +08:00
Remove ManuallyDrop
usage (#2058)
This usage can be removed since the issue was fixed: https://github.com/rust-lang/rust/issues/70919
This commit is contained in:
parent
1cc67d5df2
commit
be83b2cc66
@ -24,8 +24,6 @@ pub use self::styles::{
|
|||||||
Styles, Transform,
|
Styles, Transform,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::mem::ManuallyDrop;
|
|
||||||
|
|
||||||
use comemo::{Track, Tracked, TrackedMut, Validate};
|
use comemo::{Track, Tracked, TrackedMut, Validate};
|
||||||
|
|
||||||
use crate::diag::{warning, SourceDiagnostic, SourceResult};
|
use crate::diag::{warning, SourceDiagnostic, SourceResult};
|
||||||
@ -51,9 +49,7 @@ pub fn typeset(
|
|||||||
let mut document;
|
let mut document;
|
||||||
let mut delayed;
|
let mut delayed;
|
||||||
|
|
||||||
// We need `ManuallyDrop` until this lands in stable:
|
let mut introspector = Introspector::new(&[]);
|
||||||
// https://github.com/rust-lang/rust/issues/70919
|
|
||||||
let mut introspector = ManuallyDrop::new(Introspector::new(&[]));
|
|
||||||
|
|
||||||
// Relayout until all introspections stabilize.
|
// Relayout until all introspections stabilize.
|
||||||
// If that doesn't happen within five attempts, we give up.
|
// If that doesn't happen within five attempts, we give up.
|
||||||
@ -73,14 +69,9 @@ pub fn typeset(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Layout!
|
// Layout!
|
||||||
let result = (library.items.layout)(&mut vt, content, styles)?;
|
document = (library.items.layout)(&mut vt, content, styles)?;
|
||||||
|
|
||||||
// Drop the old introspector.
|
introspector = Introspector::new(&document.pages);
|
||||||
ManuallyDrop::into_inner(introspector);
|
|
||||||
|
|
||||||
// Only now assign the document and construct the new introspector.
|
|
||||||
document = result;
|
|
||||||
introspector = ManuallyDrop::new(Introspector::new(&document.pages));
|
|
||||||
iter += 1;
|
iter += 1;
|
||||||
|
|
||||||
if introspector.validate(&constraint) {
|
if introspector.validate(&constraint) {
|
||||||
@ -96,9 +87,6 @@ pub fn typeset(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop the introspector.
|
|
||||||
ManuallyDrop::into_inner(introspector);
|
|
||||||
|
|
||||||
// Promote delayed errors.
|
// Promote delayed errors.
|
||||||
if !delayed.0.is_empty() {
|
if !delayed.0.is_empty() {
|
||||||
return Err(Box::new(delayed.0));
|
return Err(Box::new(delayed.0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user