Skip to content

Commit 1eabd91

Browse files
committed
src: Make the new format cache actually work
Err, oops, the new caching code wasn't actually wired in at all. Good jorb testing by me.
1 parent 97c0805 commit 1eabd91

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/driver.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,10 @@ impl ProcessingSession {
770770
return Err(ErrorKind::Msg("cannot create formats without using a bundle".to_owned()).into())
771771
}
772772

773+
if self.io.format_cache.is_none() {
774+
return Err(ErrorKind::Msg("cannot create formats having a place to save them".to_owned()).into())
775+
}
776+
773777
// PathBuf.file_stem() doesn't do what we want since it only strips
774778
// one extension. As of 1.17, the compiler needs a type annotation for
775779
// some reason, which is why we use the `r` variable.
@@ -804,7 +808,7 @@ impl ProcessingSession {
804808
// principle we could stream the format file directly to the staging
805809
// area as we ran the TeX engine, but we don't bother.
806810

807-
let bundle = &mut *self.io.bundle.as_mut().unwrap();
811+
let format_cache = &mut *self.io.format_cache.as_mut().unwrap();
808812

809813
for (name, contents) in &*self.io.mem.files.borrow() {
810814
if name == self.io.mem.stdout_key() {
@@ -818,7 +822,7 @@ impl ProcessingSession {
818822
}
819823

820824
// Note that we intentionally pass 'stem', not 'name'.
821-
ctry!(bundle.write_format(stem, contents, status); "cannot write format file {}", sname);
825+
ctry!(format_cache.write_format(stem, contents, status); "cannot write format file {}", sname);
822826
}
823827

824828
// All done. Clear the memory layer since this was a special preparatory step.

src/io/setup.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct IoSetup {
2424
pub bundle: Option<Box<Bundle>>,
2525
pub mem: MemoryIo,
2626
filesystem: FilesystemIo,
27-
format_cache: Option<FormatCache>,
27+
pub format_cache: Option<FormatCache>,
2828
genuine_stdout: Option<GenuineStdoutIo>,
2929
format_primary: Option<BufferedPrimaryIo>,
3030
}

0 commit comments

Comments
 (0)