Skip to content

Commit f392f76

Browse files
authored
Merge pull request #1202 from winstxnhdw/master
fix: use c++ 17
2 parents 19654bf + 513caa0 commit f392f76

File tree

16 files changed

+43
-64
lines changed

16 files changed

+43
-64
lines changed

Cargo.lock

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9-28
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ documentation = "https://docs.rs/tectonic"
1616
repository = "https://github.com/tectonic-typesetting/tectonic/"
1717
readme = "CARGO_README.md"
1818
keywords = ["tex", "latex", "typesetting", "font"]
19-
categories = [
20-
"command-line-interface",
21-
"parser-implementations",
22-
"rendering",
23-
"science",
24-
"text-processing",
25-
]
19+
categories = ["command-line-interface", "parser-implementations", "rendering", "science", "text-processing"]
2620
license = "MIT"
2721
edition = "2018"
2822
exclude = ["/dist/", "/reference_sources/"]
2923

24+
[lints.rust]
25+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(backtrace)'] }
26+
3027
[badges]
3128
travis-ci = { repository = "tectonic-typesetting/tectonic" }
3229
codecov = { repository = "tectonic-typesetting/tectonic", service = "github" }
@@ -97,6 +94,7 @@ watchexec-filterer-globset = "3.0"
9794
watchexec-signals = "2.0"
9895
watchexec-supervisor = "1.0"
9996
zip = { version = "^0.6", default-features = false, features = ["deflate"] }
97+
time = "0.3.36"
10098

10199
[features]
102100
default = ["geturl-reqwest", "serialization"]
@@ -114,10 +112,7 @@ external-harfbuzz = ["tectonic_engine_xetex/external-harfbuzz"]
114112
geturl-curl = ["tectonic_bundles/geturl-curl", "tectonic_geturl/curl"]
115113
geturl-reqwest = ["tectonic_bundles/geturl-reqwest", "tectonic_geturl/reqwest"]
116114

117-
native-tls-vendored = [
118-
"tectonic_bundles/native-tls-vendored",
119-
"tectonic_geturl/native-tls-vendored",
120-
]
115+
native-tls-vendored = ["tectonic_bundles/native-tls-vendored", "tectonic_geturl/native-tls-vendored"]
121116

122117
# developer feature to compile with the necessary flags for profiling tectonic.
123118
profile = []
@@ -141,23 +136,9 @@ overlay-triplets-path = "dist/vcpkg-triplets"
141136
# guidance if they might need to set $VCPKGRS_TRIPLET.
142137
[package.metadata.vcpkg.target]
143138
x86_64-apple-darwin = { install = ["freetype", "harfbuzz[graphite2]", "icu"] }
144-
aarch64-apple-darwin = { triplet = "arm64-osx", install = [
145-
"freetype",
146-
"harfbuzz[graphite2]",
147-
"icu",
148-
] }
149-
x86_64-unknown-linux-gnu = { install = [
150-
"fontconfig",
151-
"freetype",
152-
"harfbuzz[graphite2]",
153-
"icu",
154-
] }
155-
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-release", install = [
156-
"fontconfig",
157-
"freetype",
158-
"harfbuzz[graphite2]",
159-
"icu",
160-
] }
139+
aarch64-apple-darwin = { triplet = "arm64-osx", install = ["freetype", "harfbuzz[graphite2]", "icu"] }
140+
x86_64-unknown-linux-gnu = { install = ["fontconfig", "freetype", "harfbuzz[graphite2]", "icu"] }
141+
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-release", install = ["fontconfig", "freetype", "harfbuzz[graphite2]", "icu"] }
161142

162143
[package.metadata.internal_dep_versions]
163144
tectonic_bridge_core = "thiscommit:2023-06-11:PvhF7YB"

crates/bundles/src/cache.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ impl<CB: CacheBackend> CachingBundle<CB> {
460460
// If a filename contains newline characters, it will mess up our
461461
// line-based manifest format. Be paranoid and refuse to record such
462462
// filenames.
463-
if !name.contains(|c| c == '\n' || c == '\r') {
463+
if !name.contains(['\n', '\r']) {
464464
writeln!(man, "{name} {length} {digest_text}")?;
465465
}
466466

@@ -515,9 +515,7 @@ impl<CB: CacheBackend> CachingBundle<CB> {
515515
// giving incorrect results if we pulled files out of the cache
516516
// before this invocation. Rewrite the digest file so that next time
517517
// we'll start afresh, then bail.
518-
file_create_write(&self.digest_path, |f| {
519-
writeln!(f, "{}", pull_data.digest.to_string())
520-
})?;
518+
file_create_write(&self.digest_path, |f| writeln!(f, "{}", pull_data.digest))?;
521519
bail!("backend digest changed; rerun tectonic to use updated information");
522520
}
523521

crates/docmodel/src/document.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl Document {
263263
tried_src_path = true;
264264

265265
if let Some(s) = t.to_str() {
266-
name = s.to_owned();
266+
s.clone_into(&mut name);
267267
}
268268
}
269269

@@ -273,7 +273,7 @@ impl Document {
273273

274274
if let Some(Component::Normal(t)) = full_path.components().next_back() {
275275
if let Some(s) = t.to_str() {
276-
name = s.to_owned();
276+
s.clone_into(&mut name);
277277
}
278278
}
279279
}

crates/engine_spx2html/src/assets.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pub(crate) fn create_output_path(
179179

180180
for piece in dest_path.split('/') {
181181
if let Some(out_path) = out_path.as_mut() {
182-
match std::fs::create_dir(&out_path) {
182+
match std::fs::create_dir(out_path.as_path()) {
183183
Ok(_) => {}
184184
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {}
185185
Err(e) => {

crates/engine_spx2html/src/fontfile.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,10 @@ impl FontFileData {
426426

427427
if let Some(out_path) = out_path.as_mut() {
428428
out_path.push(rel_path);
429+
let display_path = out_path.clone();
429430
atry!(
430-
std::fs::write(&out_path, &self.buffer);
431-
["cannot write output file `{}`", out_path.display()]
431+
std::fs::write(out_path, &self.buffer);
432+
["cannot write output file `{}`", display_path.display()]
432433
);
433434
}
434435

@@ -490,9 +491,10 @@ impl FontFileData {
490491

491492
out_path.pop();
492493
out_path.push(&varname);
494+
let display_path = out_path.clone();
493495
atry!(
494-
std::fs::write(&out_path, &buffer);
495-
["cannot write output file `{}`", out_path.display()]
496+
std::fs::write(out_path, &buffer);
497+
["cannot write output file `{}`", display_path.display()]
496498
);
497499
}
498500

crates/engine_spx2html/src/fonts.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ impl FontEnsemble {
197197
// Update the info records for the relevant fonts to capture the
198198
// established relationship.
199199

200-
self.font_files[regular].family_name = name.clone();
200+
self.font_files[regular].family_name.clone_from(&name);
201201
self.font_files[regular].family_relation = FamilyRelativeFontId::Regular;
202-
self.font_files[bold].family_name = name.clone();
202+
self.font_files[bold].family_name.clone_from(&name);
203203
self.font_files[bold].family_relation = FamilyRelativeFontId::Bold;
204-
self.font_files[italic].family_name = name.clone();
204+
self.font_files[italic].family_name.clone_from(&name);
205205
self.font_files[italic].family_relation = FamilyRelativeFontId::Italic;
206-
self.font_files[bold_italic].family_name = name.clone();
206+
self.font_files[bold_italic].family_name.clone_from(&name);
207207
self.font_files[bold_italic].family_relation = FamilyRelativeFontId::BoldItalic;
208208

209209
self.font_families.insert(

crates/engine_spx2html/src/initialization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ impl InitializationState {
167167
}
168168

169169
fn handle_set_template(&mut self, texpath: &str, _common: &mut Common) -> Result<()> {
170-
self.next_template_path = texpath.to_owned();
170+
texpath.clone_into(&mut self.next_template_path);
171171
Ok(())
172172
}
173173

174174
fn handle_set_output_path(&mut self, texpath: &str, _common: &mut Common) -> Result<()> {
175-
self.next_output_path = texpath.to_owned();
175+
texpath.clone_into(&mut self.next_output_path);
176176
Ok(())
177177
}
178178

crates/engine_xetex/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn main() {
2525
let profile_target_requires_frame_pointer: bool =
2626
target_cfg!(not(all(target_os = "linux", target_arch = "x86_64")));
2727

28+
#[allow(unexpected_cfgs)]
2829
const PROFILE_BUILD_ENABLED: bool = cfg!(feature = "profile");
2930

3031
let profile_config = |cfg: &mut cc::Build| {

crates/io_base/src/digest.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Helpers to tidy up the computation of digests in various places.
55
66
use std::{
7-
fs,
7+
fmt, fs,
88
path::{Path, PathBuf},
99
str::FromStr,
1010
};
@@ -103,9 +103,9 @@ impl DigestData {
103103
}
104104
}
105105

106-
impl ToString for DigestData {
107-
fn to_string(&self) -> String {
108-
bytes_to_hex(&self.0)
106+
impl fmt::Display for DigestData {
107+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
108+
write!(f, "{}", bytes_to_hex(&self.0))
109109
}
110110
}
111111

crates/xdv/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ impl<'a, T: XdvEvents> Cursor<'a, T> {
12291229
return Err(InternalError::NeedMoreData);
12301230
}
12311231

1232-
let rv = unsafe { mem::transmute(self.buf[0]) };
1232+
let rv = unsafe { mem::transmute::<u8, i8>(self.buf[0]) };
12331233
self.buf = &self.buf[1..];
12341234
self.offset += 1;
12351235
Ok(rv)

crates/xetex_layout/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn main() {
8686
let mut cppcfg = cc::Build::new();
8787

8888
let cppflags = [
89-
"-std=c++14",
89+
"-std=c++17",
9090
"-Wall",
9191
"-Wdate-time",
9292
"-Wendif-labels",

src/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ impl ProcessingSessionBuilder {
11321132
}
11331133
};
11341134

1135-
filesystem_root = parent.clone();
1135+
filesystem_root.clone_from(&parent);
11361136
let pio: Box<dyn IoProvider> = Box::new(FilesystemPrimaryInputIo::new(&p));
11371137
(pio, Some(p), parent)
11381138
}

src/io/format_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl FormatCache {
5555
let mut p = self.formats_base.clone();
5656
p.push(format!(
5757
"{}-{}-{}.fmt",
58-
self.bundle_digest.to_string(),
58+
self.bundle_digest,
5959
stem,
6060
crate::FORMAT_SERIAL
6161
));

tests/formats.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,8 @@ fn test_format_generation(texname: &str, fmtname: &str, sha256: &str) {
176176
let observed = info.write_digest.unwrap();
177177

178178
if observed != want_digest {
179-
println!(
180-
"expected {} to have SHA256 = {}",
181-
fmtname,
182-
want_digest.to_string()
183-
);
184-
println!("instead, got {}", observed.to_string());
179+
println!("expected {} to have SHA256 = {}", fmtname, want_digest);
180+
println!("instead, got {}", observed);
185181
panic!();
186182
}
187183
}

tests/util/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl<'a> ExpectedFile<'a> {
216216
.unwrap_or_else(|| panic!("couldn't Unicode-ify file name of {:?}", pbase))
217217
.replace(std::path::is_separator, "_");
218218

219-
let mut dec = GzDecoder::new(File::open(&pbase).unwrap());
219+
let mut dec = GzDecoder::new(File::open(pbase.as_path()).unwrap());
220220
let mut contents = Vec::new();
221221
dec.read_to_end(&mut contents).unwrap();
222222

0 commit comments

Comments
 (0)