1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Std-API polyfills so the shared engine compiles on **Rust 1.73** — the last
//! toolchain whose prebuilt `x86_64-apple-darwin` std targets macOS 10.7 (the
//! vintage build in `rb-cli-vintage/`). 1.74+ raised the macOS floor to 10.12.
//!
//! This module is compiled **only** when the `rust173-polyfill` feature is on,
//! which is enabled solely by the vintage manifests. The desktop build omits it
//! entirely and uses the real std methods — so nothing modern is lost there.
//! Inside rusty-backup it is re-exported as `crate::rust173_compat`.
//!
//! ## Why an extension trait works for `is_multiple_of`
//!
//! `<uN>::is_multiple_of` was stabilized in Rust 1.87 and does **not exist at
//! all** on 1.73 (calling it there is `E0599: no method found`, not merely an
//! unstable-feature gate). So there is no inherent method to shadow, and the
//! trait method below resolves cleanly with the exact same `x.is_multiple_of(n)`
//! call syntax used throughout the codebase — no call sites change.
//!
//! Do **not** enable `rust173-polyfill` on a modern toolchain: there the std
//! inherent method also exists and you'd get an ambiguity error. It is for the
//! 1.73 vintage build only.
//!
//! (`io::Error::other`, by contrast, *does* exist on 1.73 as an unstable
//! inherent fn, so the same trick can't shadow it — those call sites are
//! rewritten to the equivalent [`crate::io_other`], which is
//! stable on every toolchain. And trait-upcasting `dyn EditableFilesystem` ->
//! `dyn Filesystem` uses an explicit `as_filesystem()` method rather than the
//! 1.86 upcast coercion.)
/// Polyfill of the Rust 1.87 `is_multiple_of` inherent method for the unsigned
/// integer types (the only ones std provides it on). Matches std's semantics,
/// including the `rhs == 0` edge cases.
impl_is_multiple_of!;
/// Polyfill of `Option::is_none_or` (stabilized Rust 1.82; absent on 1.73, so
/// the extension method resolves with no inherent to shadow it). Keeps the
/// `opt.is_none_or(f)` call syntax identical to the desktop build, where it
/// resolves to std's method.