authorbors <bors@rust-lang.org> 2025-12-14 12:32:36 UTC
committerbors <bors@rust-lang.org> 2025-12-14 12:32:36 UTC
log0208ee09be465f69005a7a12c28d5eccac7d5f34
treeea160ae18905a5e0866117d0d49b7e2421786235
parent08de25c4ea16d7ecc3ceeb093d4f343a2be30df5
parentfbd259da35de52ac484124f3ad6002d3376bb9ac

Auto merge of #149979 - ChrisDenton:rollup-9rvyn3h, r=ChrisDenton

Rollup of 8 pull requests Successful merges: - rust-lang/rust#148755 (Constify `DropGuard::dismiss` and trait impls) - rust-lang/rust#148825 (Add SystemTime::{MIN, MAX}) - rust-lang/rust#149272 (Fix vec iter zst alignment) - rust-lang/rust#149417 (tidy: Detect outdated workspaces in workspace list) - rust-lang/rust#149773 (fix va_list test by adding a llvmir signext check) - rust-lang/rust#149894 (Update to mdbook 0.5) - rust-lang/rust#149955 (Fix typo in armv7a-vex-v5 documentation) - rust-lang/rust#149972 (Enable to ping LoongArch group via triagebot) r? `@ghost` `@rustbot` modify labels: rollup

34 files changed, 677 insertions(+), 879 deletions(-)

library/alloc/src/vec/into_iter.rs+6-1
......@@ -411,7 +411,12 @@ impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
411411 // SAFETY: same as for advance_by()
412412 self.end = unsafe { self.end.sub(step_size) };
413413 }
414 let to_drop = ptr::slice_from_raw_parts_mut(self.end as *mut T, step_size);
414 let to_drop = if T::IS_ZST {
415 // ZST may cause unalignment
416 ptr::slice_from_raw_parts_mut(ptr::NonNull::<T>::dangling().as_ptr(), step_size)
417 } else {
418 ptr::slice_from_raw_parts_mut(self.end as *mut T, step_size)
419 };
415420 // SAFETY: same as for advance_by()
416421 unsafe {
417422 ptr::drop_in_place(to_drop);
library/alloctests/tests/vec.rs+32
......@@ -2717,3 +2717,35 @@ fn vec_null_ptr_roundtrip() {
27172717 let new = roundtripped.with_addr(ptr.addr());
27182718 unsafe { new.read() };
27192719}
2720
2721// Regression test for Undefined Behavior (UB) caused by IntoIter::nth_back (#148682)
2722// when dealing with high-aligned Zero-Sized Types (ZSTs).
2723use std::collections::{BTreeMap, BinaryHeap, HashMap, LinkedList, VecDeque};
2724#[test]
2725fn zst_collections_iter_nth_back_regression() {
2726 #[repr(align(8))]
2727 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
2728 struct Thing;
2729 let v = vec![Thing, Thing];
2730 let _ = v.into_iter().nth_back(1);
2731 let mut d = VecDeque::new();
2732 d.push_back(Thing);
2733 d.push_back(Thing);
2734 let _ = d.into_iter().nth_back(1);
2735 let mut map = BTreeMap::new();
2736 map.insert(0, Thing);
2737 map.insert(1, Thing);
2738 let _ = map.into_values().nth_back(0);
2739 let mut hash_map = HashMap::new();
2740 hash_map.insert(1, Thing);
2741 hash_map.insert(2, Thing);
2742 let _ = hash_map.into_values().nth(1);
2743 let mut heap = BinaryHeap::new();
2744 heap.push(Thing);
2745 heap.push(Thing);
2746 let _ = heap.into_iter().nth_back(1);
2747 let mut list = LinkedList::new();
2748 list.push_back(Thing);
2749 list.push_back(Thing);
2750 let _ = list.into_iter().nth_back(1);
2751}
library/core/src/mem/drop_guard.rs+17-9
......@@ -1,4 +1,5 @@
11use crate::fmt::{self, Debug};
2use crate::marker::Destruct;
23use crate::mem::ManuallyDrop;
34use crate::ops::{Deref, DerefMut};
45
......@@ -78,32 +79,37 @@ where
7879 ///
7980 /// let value = String::from("Nori likes chicken");
8081 /// let guard = DropGuard::new(value, |s| println!("{s}"));
81 /// assert_eq!(guard.dismiss(), "Nori likes chicken");
82 /// assert_eq!(DropGuard::dismiss(guard), "Nori likes chicken");
8283 /// ```
8384 #[unstable(feature = "drop_guard", issue = "144426")]
85 #[rustc_const_unstable(feature = "const_drop_guard", issue = "none")]
8486 #[inline]
85 pub fn dismiss(self) -> T {
87 pub const fn dismiss(guard: Self) -> T
88 where
89 F: [const] Destruct,
90 {
8691 // First we ensure that dropping the guard will not trigger
8792 // its destructor
88 let mut this = ManuallyDrop::new(self);
93 let mut guard = ManuallyDrop::new(guard);
8994
9095 // Next we manually read the stored value from the guard.
9196 //
9297 // SAFETY: this is safe because we've taken ownership of the guard.
93 let value = unsafe { ManuallyDrop::take(&mut this.inner) };
98 let value = unsafe { ManuallyDrop::take(&mut guard.inner) };
9499
95100 // Finally we drop the stored closure. We do this *after* having read
96101 // the value, so that even if the closure's `drop` function panics,
97102 // unwinding still tries to drop the value.
98103 //
99104 // SAFETY: this is safe because we've taken ownership of the guard.
100 unsafe { ManuallyDrop::drop(&mut this.f) };
105 unsafe { ManuallyDrop::drop(&mut guard.f) };
101106 value
102107 }
103108}
104109
105110#[unstable(feature = "drop_guard", issue = "144426")]
106impl<T, F> Deref for DropGuard<T, F>
111#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
112impl<T, F> const Deref for DropGuard<T, F>
107113where
108114 F: FnOnce(T),
109115{
......@@ -115,7 +121,8 @@ where
115121}
116122
117123#[unstable(feature = "drop_guard", issue = "144426")]
118impl<T, F> DerefMut for DropGuard<T, F>
124#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
125impl<T, F> const DerefMut for DropGuard<T, F>
119126where
120127 F: FnOnce(T),
121128{
......@@ -125,9 +132,10 @@ where
125132}
126133
127134#[unstable(feature = "drop_guard", issue = "144426")]
128impl<T, F> Drop for DropGuard<T, F>
135#[rustc_const_unstable(feature = "const_drop_guard", issue = "none")]
136impl<T, F> const Drop for DropGuard<T, F>
129137where
130 F: FnOnce(T),
138 F: [const] FnOnce(T),
131139{
132140 fn drop(&mut self) {
133141 // SAFETY: `DropGuard` is in the process of being dropped.
library/coretests/tests/mem.rs+2-2
......@@ -815,7 +815,7 @@ fn drop_guard_into_inner() {
815815 let dropped = Cell::new(false);
816816 let value = DropGuard::new(42, |_| dropped.set(true));
817817 let guard = DropGuard::new(value, |_| dropped.set(true));
818 let inner = guard.dismiss();
818 let inner = DropGuard::dismiss(guard);
819819 assert_eq!(dropped.get(), false);
820820 assert_eq!(*inner, 42);
821821}
......@@ -837,7 +837,7 @@ fn drop_guard_always_drops_value_if_closure_drop_unwinds() {
837837 // run the destructor of the value we passed, which we validate.
838838 let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
839839 let guard = DropGuard::new(value_with_tracked_destruction, closure_that_panics_on_drop);
840 guard.dismiss();
840 DropGuard::dismiss(guard);
841841 }));
842842 assert!(value_was_dropped);
843843}
library/std/src/sys/pal/hermit/time.rs+8
......@@ -15,6 +15,10 @@ struct Timespec {
1515}
1616
1717impl Timespec {
18 const MAX: Timespec = Self::new(i64::MAX, 1_000_000_000 - 1);
19
20 const MIN: Timespec = Self::new(i64::MIN, 0);
21
1822 const fn zero() -> Timespec {
1923 Timespec { t: timespec { tv_sec: 0, tv_nsec: 0 } }
2024 }
......@@ -209,6 +213,10 @@ pub struct SystemTime(Timespec);
209213pub const UNIX_EPOCH: SystemTime = SystemTime(Timespec::zero());
210214
211215impl SystemTime {
216 pub const MAX: SystemTime = SystemTime { t: Timespec::MAX };
217
218 pub const MIN: SystemTime = SystemTime { t: Timespec::MIN };
219
212220 pub fn new(tv_sec: i64, tv_nsec: i32) -> SystemTime {
213221 SystemTime(Timespec::new(tv_sec, tv_nsec))
214222 }
library/std/src/sys/pal/sgx/time.rs+4
......@@ -28,6 +28,10 @@ impl Instant {
2828}
2929
3030impl SystemTime {
31 pub const MAX: SystemTime = SystemTime(Duration::MAX);
32
33 pub const MIN: SystemTime = SystemTime(Duration::ZERO);
34
3135 pub fn now() -> SystemTime {
3236 SystemTime(usercalls::insecure_time())
3337 }
library/std/src/sys/pal/solid/time.rs+4
......@@ -10,6 +10,10 @@ pub struct SystemTime(abi::time_t);
1010pub const UNIX_EPOCH: SystemTime = SystemTime(0);
1111
1212impl SystemTime {
13 pub const MAX: SystemTime = SystemTime(abi::time_t::MAX);
14
15 pub const MIN: SystemTime = SystemTime(abi::time_t::MIN);
16
1317 pub fn now() -> SystemTime {
1418 let rtc = unsafe {
1519 let mut out = MaybeUninit::zeroed();
library/std/src/sys/pal/uefi/time.rs+17
......@@ -70,6 +70,23 @@ impl Instant {
7070}
7171
7272impl SystemTime {
73 pub const MAX: SystemTime = MAX_UEFI_TIME;
74
75 pub const MIN: SystemTime = SystemTime::from_uefi(r_efi::efi::Time {
76 year: 1900,
77 month: 1,
78 day: 1,
79 hour: 0,
80 minute: 0,
81 second: 0,
82 nanosecond: 0,
83 timezone: -1440,
84 daylight: 0,
85 pad1: 0,
86 pad2: 0,
87 })
88 .unwrap();
89
7390 pub(crate) const fn from_uefi(t: r_efi::efi::Time) -> Option<Self> {
7491 match system_time_internal::from_uefi(&t) {
7592 Some(x) => Some(Self(x)),
library/std/src/sys/pal/unix/time.rs+11
......@@ -30,6 +30,10 @@ pub(crate) struct Timespec {
3030}
3131
3232impl SystemTime {
33 pub const MAX: SystemTime = SystemTime { t: Timespec::MAX };
34
35 pub const MIN: SystemTime = SystemTime { t: Timespec::MIN };
36
3337 #[cfg_attr(any(target_os = "horizon", target_os = "hurd"), allow(unused))]
3438 pub fn new(tv_sec: i64, tv_nsec: i64) -> Result<SystemTime, io::Error> {
3539 Ok(SystemTime { t: Timespec::new(tv_sec, tv_nsec)? })
......@@ -62,6 +66,13 @@ impl fmt::Debug for SystemTime {
6266}
6367
6468impl Timespec {
69 const MAX: Timespec = unsafe { Self::new_unchecked(i64::MAX, 1_000_000_000 - 1) };
70
71 // As described below, on Apple OS, dates before epoch are represented differently.
72 // This is not an issue here however, because we are using tv_sec = i64::MIN,
73 // which will cause the compatibility wrapper to not be executed at all.
74 const MIN: Timespec = unsafe { Self::new_unchecked(i64::MIN, 0) };
75
6576 const unsafe fn new_unchecked(tv_sec: i64, tv_nsec: i64) -> Timespec {
6677 Timespec { tv_sec, tv_nsec: unsafe { Nanoseconds::new_unchecked(tv_nsec as u32) } }
6778 }
library/std/src/sys/pal/unsupported/time.rs+4
......@@ -27,6 +27,10 @@ impl Instant {
2727}
2828
2929impl SystemTime {
30 pub const MAX: SystemTime = SystemTime(Duration::MAX);
31
32 pub const MIN: SystemTime = SystemTime(Duration::ZERO);
33
3034 pub fn now() -> SystemTime {
3135 panic!("time not implemented on this platform")
3236 }
library/std/src/sys/pal/windows/time.rs+17-2
......@@ -64,6 +64,16 @@ impl Instant {
6464}
6565
6666impl SystemTime {
67 pub const MAX: SystemTime = SystemTime {
68 t: c::FILETIME {
69 dwLowDateTime: (i64::MAX & 0xFFFFFFFF) as u32,
70 dwHighDateTime: (i64::MAX >> 32) as u32,
71 },
72 };
73
74 pub const MIN: SystemTime =
75 SystemTime { t: c::FILETIME { dwLowDateTime: 0, dwHighDateTime: 0 } };
76
6777 pub fn now() -> SystemTime {
6878 unsafe {
6979 let mut t: SystemTime = mem::zeroed();
......@@ -101,8 +111,13 @@ impl SystemTime {
101111 }
102112
103113 pub fn checked_sub_duration(&self, other: &Duration) -> Option<SystemTime> {
104 let intervals = self.intervals().checked_sub(checked_dur2intervals(other)?)?;
105 Some(SystemTime::from_intervals(intervals))
114 // Windows does not support times before 1601, hence why we don't
115 // support negatives. In order to tackle this, we try to convert the
116 // resulting value into an u64, which should obviously fail in the case
117 // that the value is below zero.
118 let intervals: u64 =
119 self.intervals().checked_sub(checked_dur2intervals(other)?)?.try_into().ok()?;
120 Some(SystemTime::from_intervals(intervals as i64))
106121 }
107122}
108123
library/std/src/sys/pal/xous/time.rs+4
......@@ -35,6 +35,10 @@ impl Instant {
3535}
3636
3737impl SystemTime {
38 pub const MAX: SystemTime = SystemTime(Duration::MAX);
39
40 pub const MIN: SystemTime = SystemTime(Duration::ZERO);
41
3842 pub fn now() -> SystemTime {
3943 let result = blocking_scalar(systime_server(), GetUtcTimeMs.into())
4044 .expect("failed to request utc time in ms");
library/std/src/time.rs+83
......@@ -511,6 +511,83 @@ impl SystemTime {
511511 #[stable(feature = "assoc_unix_epoch", since = "1.28.0")]
512512 pub const UNIX_EPOCH: SystemTime = UNIX_EPOCH;
513513
514 /// Represents the maximum value representable by [`SystemTime`] on this platform.
515 ///
516 /// This value differs a lot between platforms, but it is always the case
517 /// that any positive addition of a [`Duration`], whose value is greater
518 /// than or equal to the time precision of the operating system, to
519 /// [`SystemTime::MAX`] will fail.
520 ///
521 /// # Examples
522 ///
523 /// ```no_run
524 /// #![feature(time_systemtime_limits)]
525 /// use std::time::{Duration, SystemTime};
526 ///
527 /// // Adding zero will change nothing.
528 /// assert_eq!(SystemTime::MAX.checked_add(Duration::ZERO), Some(SystemTime::MAX));
529 ///
530 /// // But adding just one second will already fail ...
531 /// //
532 /// // Keep in mind that this in fact may succeed, if the Duration is
533 /// // smaller than the time precision of the operating system, which
534 /// // happens to be 1ns on most operating systems, with Windows being the
535 /// // notable exception by using 100ns, hence why this example uses 1s.
536 /// assert_eq!(SystemTime::MAX.checked_add(Duration::new(1, 0)), None);
537 ///
538 /// // Utilize this for saturating arithmetic to improve error handling.
539 /// // In this case, we will use a certificate with a timestamp in the
540 /// // future as a practical example.
541 /// let configured_offset = Duration::from_secs(60 * 60 * 24);
542 /// let valid_after =
543 /// SystemTime::now()
544 /// .checked_add(configured_offset)
545 /// .unwrap_or(SystemTime::MAX);
546 /// ```
547 #[unstable(feature = "time_systemtime_limits", issue = "149067")]
548 pub const MAX: SystemTime = SystemTime(time::SystemTime::MAX);
549
550 /// Represents the minimum value representable by [`SystemTime`] on this platform.
551 ///
552 /// This value differs a lot between platforms, but it is always the case
553 /// that any positive subtraction of a [`Duration`] from, whose value is
554 /// greater than or equal to the time precision of the operating system, to
555 /// [`SystemTime::MIN`] will fail.
556 ///
557 /// Depending on the platform, this may be either less than or equal to
558 /// [`SystemTime::UNIX_EPOCH`], depending on whether the operating system
559 /// supports the representation of timestamps before the Unix epoch or not.
560 /// However, it is always guaranteed that a [`SystemTime::UNIX_EPOCH`] fits
561 /// between a [`SystemTime::MIN`] and [`SystemTime::MAX`].
562 ///
563 /// # Examples
564 ///
565 /// ```
566 /// #![feature(time_systemtime_limits)]
567 /// use std::time::{Duration, SystemTime};
568 ///
569 /// // Subtracting zero will change nothing.
570 /// assert_eq!(SystemTime::MIN.checked_sub(Duration::ZERO), Some(SystemTime::MIN));
571 ///
572 /// // But subtracting just one second will already fail.
573 /// //
574 /// // Keep in mind that this in fact may succeed, if the Duration is
575 /// // smaller than the time precision of the operating system, which
576 /// // happens to be 1ns on most operating systems, with Windows being the
577 /// // notable exception by using 100ns, hence why this example uses 1s.
578 /// assert_eq!(SystemTime::MIN.checked_sub(Duration::new(1, 0)), None);
579 ///
580 /// // Utilize this for saturating arithmetic to improve error handling.
581 /// // In this case, we will use a cache expiry as a practical example.
582 /// let configured_expiry = Duration::from_secs(60 * 3);
583 /// let expiry_threshold =
584 /// SystemTime::now()
585 /// .checked_sub(configured_expiry)
586 /// .unwrap_or(SystemTime::MIN);
587 /// ```
588 #[unstable(feature = "time_systemtime_limits", issue = "149067")]
589 pub const MIN: SystemTime = SystemTime(time::SystemTime::MIN);
590
514591 /// Returns the system time corresponding to "now".
515592 ///
516593 /// # Examples
......@@ -588,6 +665,9 @@ impl SystemTime {
588665 /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
589666 /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None`
590667 /// otherwise.
668 ///
669 /// In the case that the `duration` is smaller than the time precision of the operating
670 /// system, `Some(self)` will be returned.
591671 #[stable(feature = "time_checked_add", since = "1.34.0")]
592672 pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
593673 self.0.checked_add_duration(&duration).map(SystemTime)
......@@ -596,6 +676,9 @@ impl SystemTime {
596676 /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
597677 /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None`
598678 /// otherwise.
679 ///
680 /// In the case that the `duration` is smaller than the time precision of the operating
681 /// system, `Some(self)` will be returned.
599682 #[stable(feature = "time_checked_add", since = "1.34.0")]
600683 pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
601684 self.0.checked_sub_duration(&duration).map(SystemTime)
library/std/tests/time.rs+26
......@@ -1,4 +1,5 @@
11#![feature(duration_constants)]
2#![feature(time_systemtime_limits)]
23
34use std::fmt::Debug;
45use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
......@@ -237,9 +238,34 @@ fn system_time_duration_since_max_range_on_unix() {
237238 let min = SystemTime::UNIX_EPOCH - (Duration::new(i64::MAX as u64 + 1, 0));
238239 let max = SystemTime::UNIX_EPOCH + (Duration::new(i64::MAX as u64, 999_999_999));
239240
241 assert_eq!(min, SystemTime::MIN);
242 assert_eq!(max, SystemTime::MAX);
243
240244 let delta_a = max.duration_since(min).expect("duration_since overflow");
241245 let delta_b = min.duration_since(max).expect_err("duration_since overflow").duration();
242246
243247 assert_eq!(Duration::MAX, delta_a);
244248 assert_eq!(Duration::MAX, delta_b);
245249}
250
251#[test]
252fn system_time_max_min() {
253 #[cfg(not(target_os = "windows"))]
254 /// Most (all?) non-Windows systems have nanosecond precision.
255 const MIN_INTERVAL: Duration = Duration::new(0, 1);
256 #[cfg(target_os = "windows")]
257 /// Windows' time precision is at 100ns.
258 const MIN_INTERVAL: Duration = Duration::new(0, 100);
259
260 // First, test everything with checked_* and Duration::ZERO.
261 assert_eq!(SystemTime::MAX.checked_add(Duration::ZERO), Some(SystemTime::MAX));
262 assert_eq!(SystemTime::MAX.checked_sub(Duration::ZERO), Some(SystemTime::MAX));
263 assert_eq!(SystemTime::MIN.checked_add(Duration::ZERO), Some(SystemTime::MIN));
264 assert_eq!(SystemTime::MIN.checked_sub(Duration::ZERO), Some(SystemTime::MIN));
265
266 // Now do the same again with checked_* but try by ± the lowest time precision.
267 assert!(SystemTime::MAX.checked_add(MIN_INTERVAL).is_none());
268 assert!(SystemTime::MAX.checked_sub(MIN_INTERVAL).is_some());
269 assert!(SystemTime::MIN.checked_add(MIN_INTERVAL).is_some());
270 assert!(SystemTime::MIN.checked_sub(MIN_INTERVAL).is_none());
271}
src/doc/book+1-1
......@@ -1 +1 @@
1Subproject commit 8c0eacd5c4acbb650497454f3a58c9e8083202a4
1Subproject commit 39aeceaa3aeab845bc4517e7a44e48727d3b9dbe
src/doc/edition-guide+1-1
......@@ -1 +1 @@
1Subproject commit 9cf5443d632673c4d41edad5e8ed8be86eeb3b8f
1Subproject commit c3c0f0b3da26610138b7ba7663f60cd2c68cf184
src/doc/nomicon+1-1
......@@ -1 +1 @@
1Subproject commit 0fe83ab28985b99aba36a1f0dbde3e08286fefda
1Subproject commit 9fe8fa599ad228dda74f240cc32b54bc5c1aa3e6
src/doc/reference+1-1
......@@ -1 +1 @@
1Subproject commit b14b4e40f53ca468beaf2f5d0dfb4f4c4ba6bc7b
1Subproject commit 50c5de90487b68d429a30cc9466dc8f5b410128f
src/doc/rust-by-example+1-1
......@@ -1 +1 @@
1Subproject commit 111cfae2f9c3a43f7b0ff8fa68c51cc8f930637c
1Subproject commit 7d21279e40e8f0e91c2a22c5148dd2d745aef8b6
src/doc/rustc/book.toml-4
......@@ -1,13 +1,9 @@
11[book]
2multilingual = false
3src = "src"
42title = "The rustc book"
53
64[output.html]
75git-repository-url = "https://github.com/rust-lang/rust/tree/HEAD/src/doc/rustc"
86edit-url-template = "https://github.com/rust-lang/rust/edit/HEAD/src/doc/rustc/{path}"
9additional-css = ["theme/pagetoc.css"]
10additional-js = ["theme/pagetoc.js"]
117
128[output.html.search]
139use-boolean-and = true
src/doc/rustc/src/platform-support/armv7a-vex-v5.md+1-1
......@@ -21,7 +21,7 @@ This target is cross-compiled. Dynamic linking is unsupported.
2121
2222`#![no_std]` crates can be built using `build-std` to build `core` and `panic_abort` and optionally `alloc`. Unwinding panics are not yet supported on this target.
2323
24`std` has only partial support due platform limitations. Notably:
24`std` has only partial support due to platform limitations. Notably:
2525- `std::process` and `std::net` are unimplemented. `std::thread` only supports sleeping and yielding, as this is a single-threaded environment.
2626- `std::time` has full support for `Instant`, but no support for `SystemTime`.
2727- `std::io` has full support for `stdin`/`stdout`/`stderr`. `stdout` and `stderr` both write to to USB channel 1 on this platform and are not differentiated.
src/doc/rustc/theme/pagetoc.css deleted-84
......@@ -1,84 +0,0 @@
1/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) */
2
3:root {
4 --toc-width: 270px;
5 --center-content-toc-shift: calc(-1 * var(--toc-width) / 2);
6}
7
8.nav-chapters {
9 /* adjust width of buttons that bring to the previous or the next page */
10 min-width: 50px;
11}
12
13@media only screen {
14 @media (max-width: 1179px) {
15 .sidebar-hidden #sidetoc {
16 display: none;
17 }
18 }
19
20 @media (max-width: 1439px) {
21 .sidebar-visible #sidetoc {
22 display: none;
23 }
24 }
25
26 @media (1180px <= width <= 1439px) {
27 .sidebar-hidden main {
28 position: relative;
29 left: var(--center-content-toc-shift);
30 }
31 }
32
33 @media (1440px <= width <= 1700px) {
34 .sidebar-visible main {
35 position: relative;
36 left: var(--center-content-toc-shift);
37 }
38 }
39
40 #sidetoc {
41 margin-left: calc(100% + 20px);
42 }
43 #pagetoc {
44 position: fixed;
45 /* adjust TOC width */
46 width: var(--toc-width);
47 height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
48 overflow: auto;
49 }
50 #pagetoc a {
51 border-left: 1px solid var(--sidebar-bg);
52 color: var(--fg);
53 display: block;
54 padding-bottom: 5px;
55 padding-top: 5px;
56 padding-left: 10px;
57 text-align: left;
58 text-decoration: none;
59 }
60 #pagetoc a:hover,
61 #pagetoc a.active {
62 background: var(--sidebar-bg);
63 color: var(--sidebar-active) !important;
64 }
65 #pagetoc .active {
66 background: var(--sidebar-bg);
67 color: var(--sidebar-active);
68 }
69 #pagetoc .pagetoc-H2 {
70 padding-left: 20px;
71 }
72 #pagetoc .pagetoc-H3 {
73 padding-left: 40px;
74 }
75 #pagetoc .pagetoc-H4 {
76 padding-left: 60px;
77 }
78}
79
80@media print {
81 #sidetoc {
82 display: none;
83 }
84}
src/doc/rustc/theme/pagetoc.js deleted-104
......@@ -1,104 +0,0 @@
1// Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL)
2
3let activeHref = location.href;
4function updatePageToc(elem = undefined) {
5 let selectedPageTocElem = elem;
6 const pagetoc = document.getElementById("pagetoc");
7
8 function getRect(element) {
9 return element.getBoundingClientRect();
10 }
11
12 function overflowTop(container, element) {
13 return getRect(container).top - getRect(element).top;
14 }
15
16 function overflowBottom(container, element) {
17 return getRect(container).bottom - getRect(element).bottom;
18 }
19
20 // We've not selected a heading to highlight, and the URL needs updating
21 // so we need to find a heading based on the URL
22 if (selectedPageTocElem === undefined && location.href !== activeHref) {
23 activeHref = location.href;
24 for (const pageTocElement of pagetoc.children) {
25 if (pageTocElement.href === activeHref) {
26 selectedPageTocElem = pageTocElement;
27 }
28 }
29 }
30
31 // We still don't have a selected heading, let's try and find the most
32 // suitable heading based on the scroll position
33 if (selectedPageTocElem === undefined) {
34 const margin = window.innerHeight / 3;
35
36 const headers = document.getElementsByClassName("header");
37 for (let i = 0; i < headers.length; i++) {
38 const header = headers[i];
39 if (selectedPageTocElem === undefined && getRect(header).top >= 0) {
40 if (getRect(header).top < margin) {
41 selectedPageTocElem = header;
42 } else {
43 selectedPageTocElem = headers[Math.max(0, i - 1)];
44 }
45 }
46 // a very long last section's heading is over the screen
47 if (selectedPageTocElem === undefined && i === headers.length - 1) {
48 selectedPageTocElem = header;
49 }
50 }
51 }
52
53 // Remove the active flag from all pagetoc elements
54 for (const pageTocElement of pagetoc.children) {
55 pageTocElement.classList.remove("active");
56 }
57
58 // If we have a selected heading, set it to active and scroll to it
59 if (selectedPageTocElem !== undefined) {
60 for (const pageTocElement of pagetoc.children) {
61 if (selectedPageTocElem.href.localeCompare(pageTocElement.href) === 0) {
62 pageTocElement.classList.add("active");
63 if (overflowTop(pagetoc, pageTocElement) > 0) {
64 pagetoc.scrollTop = pageTocElement.offsetTop;
65 }
66 if (overflowBottom(pagetoc, pageTocElement) < 0) {
67 pagetoc.scrollTop -= overflowBottom(pagetoc, pageTocElement);
68 }
69 }
70 }
71 }
72}
73
74if (document.getElementById("sidetoc") === null &&
75 document.getElementsByClassName("header").length > 0) {
76 // The sidetoc element doesn't exist yet, let's create it
77
78 // Create the empty sidetoc and pagetoc elements
79 const sidetoc = document.createElement("div");
80 const pagetoc = document.createElement("div");
81 sidetoc.id = "sidetoc";
82 pagetoc.id = "pagetoc";
83 sidetoc.appendChild(pagetoc);
84
85 // And append them to the current DOM
86 const main = document.querySelector('main');
87 main.insertBefore(sidetoc, main.firstChild);
88
89 // Populate sidebar on load
90 window.addEventListener("load", () => {
91 for (const header of document.getElementsByClassName("header")) {
92 const link = document.createElement("a");
93 link.innerHTML = header.innerHTML;
94 link.href = header.hash;
95 link.classList.add("pagetoc-" + header.parentElement.tagName);
96 document.getElementById("pagetoc").appendChild(link);
97 link.onclick = () => updatePageToc(link);
98 }
99 updatePageToc();
100 });
101
102 // Update page table of contents selected heading on scroll
103 window.addEventListener("scroll", () => updatePageToc());
104}
src/doc/rustdoc/src/read-documentation/in-doc-settings.md+1-1
......@@ -4,7 +4,7 @@ Rustdoc's HTML output includes a settings menu, and this chapter describes what
44each setting in this menu does.
55
66It can be accessed by clicking on the gear button
7(<i class="fa fa-cog" aria-hidden="true"></i>) in the upper right.
7(<i class="fas fa-gear" aria-hidden="true"></i>) in the upper right.
88
99## Changing displayed theme
1010
src/doc/style-guide/book.toml+1-3
......@@ -1,8 +1,6 @@
11[book]
22title = "The Rust Style Guide"
3author = "The Rust Style Team"
4multilingual = false
5src = "src"
3authors = ["The Rust Style Team"]
64
75[output.html]
86git-repository-url = "https://github.com/rust-lang/rust/tree/HEAD/src/doc/style-guide/"
src/doc/unstable-book/book.toml-1
......@@ -1,6 +1,5 @@
11[book]
22title = "The Rust Unstable Book"
3author = "The Rust Community"
43
54[output.html]
65git-repository-url = "https://github.com/rust-lang/rust/tree/HEAD/src/doc/unstable-book"
src/tools/error_index_generator/Cargo.toml+2-1
......@@ -5,7 +5,8 @@ edition = "2021"
55workspace = "../rustbook"
66
77[dependencies]
8mdbook = { version = "0.4", default-features = false, features = ["search"] }
8mdbook-driver = { version = "0.5.1", features = ["search"] }
9mdbook-summary = "0.5.1"
910
1011[[bin]]
1112name = "error_index_generator"
src/tools/error_index_generator/main.rs+5-3
......@@ -12,8 +12,10 @@ use std::io::Write;
1212use std::path::{Path, PathBuf};
1313use std::str::FromStr;
1414
15use mdbook::book::{BookItem, Chapter, parse_summary};
16use mdbook::{Config, MDBook};
15use mdbook_driver::MDBook;
16use mdbook_driver::book::{BookItem, Chapter};
17use mdbook_driver::config::Config;
18use mdbook_summary::parse_summary;
1719use rustc_errors::codes::DIAGNOSTICS;
1820
1921enum OutputFormat {
......@@ -121,7 +123,7 @@ This page lists all the error codes emitted by the Rust compiler.
121123 source_path: None,
122124 parent_names: Vec::new(),
123125 };
124 book.book.sections.push(BookItem::Chapter(chapter));
126 book.book.items.push(BookItem::Chapter(chapter));
125127 book.build()?;
126128
127129 // The error-index used to be generated manually (without mdbook), and the
src/tools/rustbook/Cargo.lock+313-586
......@@ -17,19 +17,6 @@ dependencies = [
1717 "memchr",
1818]
1919
20[[package]]
21name = "ammonia"
22version = "4.1.2"
23source = "registry+https://github.com/rust-lang/crates.io-index"
24checksum = "17e913097e1a2124b46746c980134e8c954bc17a6a59bb3fde96f088d126dde6"
25dependencies = [
26 "cssparser",
27 "html5ever",
28 "maplit",
29 "tendril",
30 "url",
31]
32
3320[[package]]
3421name = "android_system_properties"
3522version = "0.1.5"
......@@ -110,6 +97,21 @@ dependencies = [
11097 "serde",
11198]
11299
100[[package]]
101name = "bit-set"
102version = "0.8.0"
103source = "registry+https://github.com/rust-lang/crates.io-index"
104checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
105dependencies = [
106 "bit-vec",
107]
108
109[[package]]
110name = "bit-vec"
111version = "0.8.0"
112source = "registry+https://github.com/rust-lang/crates.io-index"
113checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
114
113115[[package]]
114116name = "bitflags"
115117version = "2.10.0"
......@@ -125,17 +127,6 @@ dependencies = [
125127 "generic-array",
126128]
127129
128[[package]]
129name = "bstr"
130version = "1.12.1"
131source = "registry+https://github.com/rust-lang/crates.io-index"
132checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
133dependencies = [
134 "memchr",
135 "regex-automata",
136 "serde",
137]
138
139130[[package]]
140131name = "bumpalo"
141132version = "3.19.0"
......@@ -191,16 +182,6 @@ dependencies = [
191182 "anstyle",
192183 "clap_lex",
193184 "strsim",
194 "terminal_size",
195]
196
197[[package]]
198name = "clap_complete"
199version = "4.5.60"
200source = "registry+https://github.com/rust-lang/crates.io-index"
201checksum = "8e602857739c5a4291dfa33b5a298aeac9006185229a700e5810a3ef7272d971"
202dependencies = [
203 "clap",
204185]
205186
206187[[package]]
......@@ -261,29 +242,6 @@ dependencies = [
261242 "typenum",
262243]
263244
264[[package]]
265name = "cssparser"
266version = "0.35.0"
267source = "registry+https://github.com/rust-lang/crates.io-index"
268checksum = "4e901edd733a1472f944a45116df3f846f54d37e67e68640ac8bb69689aca2aa"
269dependencies = [
270 "cssparser-macros",
271 "dtoa-short",
272 "itoa",
273 "phf 0.11.3",
274 "smallvec",
275]
276
277[[package]]
278name = "cssparser-macros"
279version = "0.6.1"
280source = "registry+https://github.com/rust-lang/crates.io-index"
281checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
282dependencies = [
283 "quote",
284 "syn",
285]
286
287245[[package]]
288246name = "darling"
289247version = "0.20.11"
......@@ -372,17 +330,6 @@ dependencies = [
372330 "crypto-common",
373331]
374332
375[[package]]
376name = "displaydoc"
377version = "0.2.5"
378source = "registry+https://github.com/rust-lang/crates.io-index"
379checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
380dependencies = [
381 "proc-macro2",
382 "quote",
383 "syn",
384]
385
386333[[package]]
387334name = "doc-comment"
388335version = "0.3.4"
......@@ -390,19 +337,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
390337checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9"
391338
392339[[package]]
393name = "dtoa"
394version = "1.0.10"
340name = "ego-tree"
341version = "0.10.0"
395342source = "registry+https://github.com/rust-lang/crates.io-index"
396checksum = "d6add3b8cff394282be81f3fc1a0605db594ed69890078ca6e2cab1c408bcf04"
397
398[[package]]
399name = "dtoa-short"
400version = "0.3.5"
401source = "registry+https://github.com/rust-lang/crates.io-index"
402checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87"
403dependencies = [
404 "dtoa",
405]
343checksum = "b2972feb8dffe7bc8c5463b1dacda1b0dfbed3710e50f977d965429692d74cd8"
406344
407345[[package]]
408346name = "elasticlunr-rs"
......@@ -416,29 +354,6 @@ dependencies = [
416354 "serde_json",
417355]
418356
419[[package]]
420name = "env_filter"
421version = "0.1.4"
422source = "registry+https://github.com/rust-lang/crates.io-index"
423checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
424dependencies = [
425 "log",
426 "regex",
427]
428
429[[package]]
430name = "env_logger"
431version = "0.11.8"
432source = "registry+https://github.com/rust-lang/crates.io-index"
433checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
434dependencies = [
435 "anstream",
436 "anstyle",
437 "env_filter",
438 "jiff",
439 "log",
440]
441
442357[[package]]
443358name = "equivalent"
444359version = "1.0.2"
......@@ -459,7 +374,19 @@ dependencies = [
459374name = "error_index_generator"
460375version = "0.0.0"
461376dependencies = [
462 "mdbook",
377 "mdbook-driver",
378 "mdbook-summary",
379]
380
381[[package]]
382name = "fancy-regex"
383version = "0.16.2"
384source = "registry+https://github.com/rust-lang/crates.io-index"
385checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f"
386dependencies = [
387 "bit-set",
388 "regex-automata",
389 "regex-syntax",
463390]
464391
465392[[package]]
......@@ -491,13 +418,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
491418checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
492419
493420[[package]]
494name = "form_urlencoded"
495version = "1.2.2"
421name = "font-awesome-as-a-crate"
422version = "0.3.0"
496423source = "registry+https://github.com/rust-lang/crates.io-index"
497checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
498dependencies = [
499 "percent-encoding",
500]
424checksum = "932dcfbd51320af5f27f1ba02d2e567dec332cac7d2c221ba45d8e767264c4dc"
501425
502426[[package]]
503427name = "futf"
......@@ -558,9 +482,9 @@ dependencies = [
558482
559483[[package]]
560484name = "hashbrown"
561version = "0.16.0"
485version = "0.16.1"
562486source = "registry+https://github.com/rust-lang/crates.io-index"
563checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
487checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
564488
565489[[package]]
566490name = "heck"
......@@ -576,13 +500,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
576500
577501[[package]]
578502name = "html5ever"
579version = "0.35.0"
503version = "0.36.1"
580504source = "registry+https://github.com/rust-lang/crates.io-index"
581checksum = "55d958c2f74b664487a2035fe1dadb032c48718a03b63f3ab0b8537db8549ed4"
505checksum = "6452c4751a24e1b99c3260d505eaeee76a050573e61f30ac2c924ddc7236f01e"
582506dependencies = [
583507 "log",
584508 "markup5ever",
585 "match_token",
586509]
587510
588511[[package]]
......@@ -624,119 +547,17 @@ dependencies = [
624547 "cc",
625548]
626549
627[[package]]
628name = "icu_collections"
629version = "2.1.1"
630source = "registry+https://github.com/rust-lang/crates.io-index"
631checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
632dependencies = [
633 "displaydoc",
634 "potential_utf",
635 "yoke",
636 "zerofrom",
637 "zerovec",
638]
639
640[[package]]
641name = "icu_locale_core"
642version = "2.1.1"
643source = "registry+https://github.com/rust-lang/crates.io-index"
644checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
645dependencies = [
646 "displaydoc",
647 "litemap",
648 "tinystr",
649 "writeable",
650 "zerovec",
651]
652
653[[package]]
654name = "icu_normalizer"
655version = "2.1.1"
656source = "registry+https://github.com/rust-lang/crates.io-index"
657checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
658dependencies = [
659 "icu_collections",
660 "icu_normalizer_data",
661 "icu_properties",
662 "icu_provider",
663 "smallvec",
664 "zerovec",
665]
666
667[[package]]
668name = "icu_normalizer_data"
669version = "2.1.1"
670source = "registry+https://github.com/rust-lang/crates.io-index"
671checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
672
673[[package]]
674name = "icu_properties"
675version = "2.1.1"
676source = "registry+https://github.com/rust-lang/crates.io-index"
677checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99"
678dependencies = [
679 "icu_collections",
680 "icu_locale_core",
681 "icu_properties_data",
682 "icu_provider",
683 "zerotrie",
684 "zerovec",
685]
686
687[[package]]
688name = "icu_properties_data"
689version = "2.1.1"
690source = "registry+https://github.com/rust-lang/crates.io-index"
691checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899"
692
693[[package]]
694name = "icu_provider"
695version = "2.1.1"
696source = "registry+https://github.com/rust-lang/crates.io-index"
697checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
698dependencies = [
699 "displaydoc",
700 "icu_locale_core",
701 "writeable",
702 "yoke",
703 "zerofrom",
704 "zerotrie",
705 "zerovec",
706]
707
708550[[package]]
709551name = "ident_case"
710552version = "1.0.1"
711553source = "registry+https://github.com/rust-lang/crates.io-index"
712554checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
713555
714[[package]]
715name = "idna"
716version = "1.1.0"
717source = "registry+https://github.com/rust-lang/crates.io-index"
718checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
719dependencies = [
720 "idna_adapter",
721 "smallvec",
722 "utf8_iter",
723]
724
725[[package]]
726name = "idna_adapter"
727version = "1.2.1"
728source = "registry+https://github.com/rust-lang/crates.io-index"
729checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
730dependencies = [
731 "icu_normalizer",
732 "icu_properties",
733]
734
735556[[package]]
736557name = "indexmap"
737version = "2.12.0"
558version = "2.12.1"
738559source = "registry+https://github.com/rust-lang/crates.io-index"
739checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
560checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
740561dependencies = [
741562 "equivalent",
742563 "hashbrown",
......@@ -754,30 +575,6 @@ version = "1.0.15"
754575source = "registry+https://github.com/rust-lang/crates.io-index"
755576checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
756577
757[[package]]
758name = "jiff"
759version = "0.2.16"
760source = "registry+https://github.com/rust-lang/crates.io-index"
761checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35"
762dependencies = [
763 "jiff-static",
764 "log",
765 "portable-atomic",
766 "portable-atomic-util",
767 "serde_core",
768]
769
770[[package]]
771name = "jiff-static"
772version = "0.2.16"
773source = "registry+https://github.com/rust-lang/crates.io-index"
774checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69"
775dependencies = [
776 "proc-macro2",
777 "quote",
778 "syn",
779]
780
781578[[package]]
782579name = "js-sys"
783580version = "0.3.82"
......@@ -815,12 +612,6 @@ version = "0.11.0"
815612source = "registry+https://github.com/rust-lang/crates.io-index"
816613checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
817614
818[[package]]
819name = "litemap"
820version = "0.8.1"
821source = "registry+https://github.com/rust-lang/crates.io-index"
822checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
823
824615[[package]]
825616name = "lock_api"
826617version = "0.4.14"
......@@ -842,17 +633,11 @@ version = "0.1.1"
842633source = "registry+https://github.com/rust-lang/crates.io-index"
843634checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
844635
845[[package]]
846name = "maplit"
847version = "1.0.2"
848source = "registry+https://github.com/rust-lang/crates.io-index"
849checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
850
851636[[package]]
852637name = "markup5ever"
853version = "0.35.0"
638version = "0.36.1"
854639source = "registry+https://github.com/rust-lang/crates.io-index"
855checksum = "311fe69c934650f8f19652b3946075f0fc41ad8757dbb68f1ca14e7900ecc1c3"
640checksum = "6c3294c4d74d0742910f8c7b466f44dda9eb2d5742c1e430138df290a1e8451c"
856641dependencies = [
857642 "log",
858643 "tendril",
......@@ -860,58 +645,91 @@ dependencies = [
860645]
861646
862647[[package]]
863name = "match_token"
864version = "0.35.0"
648name = "matchers"
649version = "0.2.0"
865650source = "registry+https://github.com/rust-lang/crates.io-index"
866checksum = "ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf"
651checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
867652dependencies = [
868 "proc-macro2",
869 "quote",
870 "syn",
653 "regex-automata",
871654]
872655
873656[[package]]
874name = "mdbook"
875version = "0.4.52"
657name = "mdbook-core"
658version = "0.5.2"
876659source = "registry+https://github.com/rust-lang/crates.io-index"
877checksum = "93c284d2855916af7c5919cf9ad897cfc77d3c2db6f55429c7cfb769182030ec"
660checksum = "39a3873d4afac65583f1acb56ff058df989d5b4a2464bb02c785549727d307ee"
878661dependencies = [
879 "ammonia",
880662 "anyhow",
881 "chrono",
882 "clap",
883 "clap_complete",
663 "regex",
664 "serde",
665 "serde_json",
666 "toml 0.9.8",
667 "tracing",
668]
669
670[[package]]
671name = "mdbook-driver"
672version = "0.5.2"
673source = "registry+https://github.com/rust-lang/crates.io-index"
674checksum = "a229930b29a9908560883e1f386eae25d8a971d259a80f49916a50627f04a42d"
675dependencies = [
676 "anyhow",
677 "indexmap",
678 "mdbook-core",
679 "mdbook-html",
680 "mdbook-markdown",
681 "mdbook-preprocessor",
682 "mdbook-renderer",
683 "mdbook-summary",
684 "regex",
685 "serde",
686 "serde_json",
687 "shlex",
688 "tempfile",
689 "toml 0.9.8",
690 "topological-sort",
691 "tracing",
692]
693
694[[package]]
695name = "mdbook-html"
696version = "0.5.2"
697source = "registry+https://github.com/rust-lang/crates.io-index"
698checksum = "9dee80c03c65e3212fb528b8c9be5568a6a85cf795d03cf9fd6ba39ad52069ca"
699dependencies = [
700 "anyhow",
701 "ego-tree",
884702 "elasticlunr-rs",
885 "env_logger",
703 "font-awesome-as-a-crate",
886704 "handlebars",
887705 "hex",
888 "log",
889 "memchr",
890 "opener",
891 "pulldown-cmark 0.10.3",
706 "html5ever",
707 "indexmap",
708 "mdbook-core",
709 "mdbook-markdown",
710 "mdbook-renderer",
711 "pulldown-cmark 0.13.0",
892712 "regex",
893713 "serde",
894714 "serde_json",
895715 "sha2",
896 "shlex",
897 "tempfile",
898 "toml 0.5.11",
899 "topological-sort",
716 "tracing",
900717]
901718
902719[[package]]
903720name = "mdbook-i18n-helpers"
904version = "0.3.6"
721version = "0.4.0"
905722source = "registry+https://github.com/rust-lang/crates.io-index"
906checksum = "5644bf29b95683ea60979e30188221c374965c3a1dc0ad2d5c69e867dc0c09dc"
723checksum = "82a64b6c27dc99a20968cc85a89dcfe0d36f82e2c9bc3b4342a2ffc55158822f"
907724dependencies = [
908725 "anyhow",
909726 "chrono",
910727 "dateparser",
911 "mdbook",
728 "mdbook-preprocessor",
729 "mdbook-renderer",
912730 "polib",
913 "pulldown-cmark 0.12.2",
914 "pulldown-cmark-to-cmark 20.0.1",
731 "pulldown-cmark 0.13.0",
732 "pulldown-cmark-to-cmark 21.1.0",
915733 "regex",
916734 "semver",
917735 "serde_json",
......@@ -919,15 +737,50 @@ dependencies = [
919737 "textwrap",
920738]
921739
740[[package]]
741name = "mdbook-markdown"
742version = "0.5.2"
743source = "registry+https://github.com/rust-lang/crates.io-index"
744checksum = "07c41bf35212f5d8b83e543aa6a4887dc5709c8489c5fb9ed00f1b51ce1a2cc6"
745dependencies = [
746 "pulldown-cmark 0.13.0",
747 "regex",
748 "tracing",
749]
750
751[[package]]
752name = "mdbook-preprocessor"
753version = "0.5.2"
754source = "registry+https://github.com/rust-lang/crates.io-index"
755checksum = "4d87bf40be0597f26f0822f939a64f02bf92c4655ba04490aadbf83601a013bb"
756dependencies = [
757 "anyhow",
758 "mdbook-core",
759 "serde",
760 "serde_json",
761]
762
763[[package]]
764name = "mdbook-renderer"
765version = "0.5.2"
766source = "registry+https://github.com/rust-lang/crates.io-index"
767checksum = "93ed59f225b3ae4283c56bea633db83184627a090d892908bd66990c68e10b43"
768dependencies = [
769 "anyhow",
770 "mdbook-core",
771 "serde",
772 "serde_json",
773]
774
922775[[package]]
923776name = "mdbook-spec"
924777version = "0.1.2"
925778dependencies = [
926779 "anyhow",
927 "mdbook",
780 "mdbook-markdown",
781 "mdbook-preprocessor",
928782 "once_cell",
929783 "pathdiff",
930 "pulldown-cmark 0.10.3",
931784 "railroad",
932785 "regex",
933786 "semver",
......@@ -936,6 +789,20 @@ dependencies = [
936789 "walkdir",
937790]
938791
792[[package]]
793name = "mdbook-summary"
794version = "0.5.2"
795source = "registry+https://github.com/rust-lang/crates.io-index"
796checksum = "c00d85b291d67a69c92e939450390fe34d6ea418a868c8f7b42f0b300af35a7b"
797dependencies = [
798 "anyhow",
799 "mdbook-core",
800 "memchr",
801 "pulldown-cmark 0.13.0",
802 "serde",
803 "tracing",
804]
805
939806[[package]]
940807name = "mdbook-trpl"
941808version = "0.1.0"
......@@ -943,9 +810,10 @@ dependencies = [
943810 "anyhow",
944811 "clap",
945812 "html_parser",
946 "mdbook",
813 "mdbook-preprocessor",
947814 "pulldown-cmark 0.12.2",
948815 "pulldown-cmark-to-cmark 19.0.1",
816 "serde",
949817 "serde_json",
950818 "thiserror 1.0.69",
951819 "toml 0.8.23",
......@@ -974,10 +842,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
974842checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
975843
976844[[package]]
977name = "normpath"
978version = "1.5.0"
845name = "nu-ansi-term"
846version = "0.50.3"
979847source = "registry+https://github.com/rust-lang/crates.io-index"
980checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b"
848checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
981849dependencies = [
982850 "windows-sys 0.61.2",
983851]
......@@ -1018,39 +886,6 @@ version = "1.70.2"
1018886source = "registry+https://github.com/rust-lang/crates.io-index"
1019887checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
1020888
1021[[package]]
1022name = "onig"
1023version = "6.5.1"
1024source = "registry+https://github.com/rust-lang/crates.io-index"
1025checksum = "336b9c63443aceef14bea841b899035ae3abe89b7c486aaf4c5bd8aafedac3f0"
1026dependencies = [
1027 "bitflags",
1028 "libc",
1029 "once_cell",
1030 "onig_sys",
1031]
1032
1033[[package]]
1034name = "onig_sys"
1035version = "69.9.1"
1036source = "registry+https://github.com/rust-lang/crates.io-index"
1037checksum = "c7f86c6eef3d6df15f23bcfb6af487cbd2fed4e5581d58d5bf1f5f8b7f6727dc"
1038dependencies = [
1039 "cc",
1040 "pkg-config",
1041]
1042
1043[[package]]
1044name = "opener"
1045version = "0.8.3"
1046source = "registry+https://github.com/rust-lang/crates.io-index"
1047checksum = "cb9024962ab91e00c89d2a14352a8d0fc1a64346bf96f1839b45c09149564e47"
1048dependencies = [
1049 "bstr",
1050 "normpath",
1051 "windows-sys 0.60.2",
1052]
1053
1054889[[package]]
1055890name = "parking_lot"
1056891version = "0.12.5"
......@@ -1080,12 +915,6 @@ version = "0.2.3"
1080915source = "registry+https://github.com/rust-lang/crates.io-index"
1081916checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
1082917
1083[[package]]
1084name = "percent-encoding"
1085version = "2.3.2"
1086source = "registry+https://github.com/rust-lang/crates.io-index"
1087checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
1088
1089918[[package]]
1090919name = "pest"
1091920version = "2.8.3"
......@@ -1129,23 +958,13 @@ dependencies = [
1129958 "sha2",
1130959]
1131960
1132[[package]]
1133name = "phf"
1134version = "0.11.3"
1135source = "registry+https://github.com/rust-lang/crates.io-index"
1136checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
1137dependencies = [
1138 "phf_macros",
1139 "phf_shared 0.11.3",
1140]
1141
1142961[[package]]
1143962name = "phf"
1144963version = "0.13.1"
1145964source = "registry+https://github.com/rust-lang/crates.io-index"
1146965checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
1147966dependencies = [
1148 "phf_shared 0.13.1",
967 "phf_shared",
1149968 "serde",
1150969]
1151970
......@@ -1155,18 +974,8 @@ version = "0.13.1"
1155974source = "registry+https://github.com/rust-lang/crates.io-index"
1156975checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
1157976dependencies = [
1158 "phf_generator 0.13.1",
1159 "phf_shared 0.13.1",
1160]
1161
1162[[package]]
1163name = "phf_generator"
1164version = "0.11.3"
1165source = "registry+https://github.com/rust-lang/crates.io-index"
1166checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
1167dependencies = [
1168 "phf_shared 0.11.3",
1169 "rand",
977 "phf_generator",
978 "phf_shared",
1170979]
1171980
1172981[[package]]
......@@ -1176,29 +985,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1176985checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
1177986dependencies = [
1178987 "fastrand",
1179 "phf_shared 0.13.1",
1180]
1181
1182[[package]]
1183name = "phf_macros"
1184version = "0.11.3"
1185source = "registry+https://github.com/rust-lang/crates.io-index"
1186checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
1187dependencies = [
1188 "phf_generator 0.11.3",
1189 "phf_shared 0.11.3",
1190 "proc-macro2",
1191 "quote",
1192 "syn",
1193]
1194
1195[[package]]
1196name = "phf_shared"
1197version = "0.11.3"
1198source = "registry+https://github.com/rust-lang/crates.io-index"
1199checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
1200dependencies = [
1201 "siphasher",
988 "phf_shared",
1202989]
1203990
1204991[[package]]
......@@ -1211,10 +998,10 @@ dependencies = [
1211998]
1212999
12131000[[package]]
1214name = "pkg-config"
1215version = "0.3.32"
1001name = "pin-project-lite"
1002version = "0.2.16"
12161003source = "registry+https://github.com/rust-lang/crates.io-index"
1217checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
1004checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
12181005
12191006[[package]]
12201007name = "polib"
......@@ -1225,30 +1012,6 @@ dependencies = [
12251012 "linereader",
12261013]
12271014
1228[[package]]
1229name = "portable-atomic"
1230version = "1.11.1"
1231source = "registry+https://github.com/rust-lang/crates.io-index"
1232checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
1233
1234[[package]]
1235name = "portable-atomic-util"
1236version = "0.2.4"
1237source = "registry+https://github.com/rust-lang/crates.io-index"
1238checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
1239dependencies = [
1240 "portable-atomic",
1241]
1242
1243[[package]]
1244name = "potential_utf"
1245version = "0.1.4"
1246source = "registry+https://github.com/rust-lang/crates.io-index"
1247checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
1248dependencies = [
1249 "zerovec",
1250]
1251
12521015[[package]]
12531016name = "precomputed-hash"
12541017version = "0.1.1"
......@@ -1266,35 +1029,29 @@ dependencies = [
12661029
12671030[[package]]
12681031name = "pulldown-cmark"
1269version = "0.10.3"
1032version = "0.12.2"
12701033source = "registry+https://github.com/rust-lang/crates.io-index"
1271checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993"
1034checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
12721035dependencies = [
12731036 "bitflags",
1037 "getopts",
12741038 "memchr",
1275 "pulldown-cmark-escape 0.10.1",
1039 "pulldown-cmark-escape",
12761040 "unicase",
12771041]
12781042
12791043[[package]]
12801044name = "pulldown-cmark"
1281version = "0.12.2"
1045version = "0.13.0"
12821046source = "registry+https://github.com/rust-lang/crates.io-index"
1283checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
1047checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0"
12841048dependencies = [
12851049 "bitflags",
1286 "getopts",
12871050 "memchr",
1288 "pulldown-cmark-escape 0.11.0",
1051 "pulldown-cmark-escape",
12891052 "unicase",
12901053]
12911054
1292[[package]]
1293name = "pulldown-cmark-escape"
1294version = "0.10.1"
1295source = "registry+https://github.com/rust-lang/crates.io-index"
1296checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3"
1297
12981055[[package]]
12991056name = "pulldown-cmark-escape"
13001057version = "0.11.0"
......@@ -1312,11 +1069,11 @@ dependencies = [
13121069
13131070[[package]]
13141071name = "pulldown-cmark-to-cmark"
1315version = "20.0.1"
1072version = "21.1.0"
13161073source = "registry+https://github.com/rust-lang/crates.io-index"
1317checksum = "6c0f333311d2d8fda65bcf76af35054e9f38e253332a0289746156a59656988b"
1074checksum = "8246feae3db61428fd0bb94285c690b460e4517d83152377543ca802357785f1"
13181075dependencies = [
1319 "pulldown-cmark 0.12.2",
1076 "pulldown-cmark 0.13.0",
13201077]
13211078
13221079[[package]]
......@@ -1343,21 +1100,6 @@ dependencies = [
13431100 "unicode-width",
13441101]
13451102
1346[[package]]
1347name = "rand"
1348version = "0.8.5"
1349source = "registry+https://github.com/rust-lang/crates.io-index"
1350checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
1351dependencies = [
1352 "rand_core",
1353]
1354
1355[[package]]
1356name = "rand_core"
1357version = "0.6.4"
1358source = "registry+https://github.com/rust-lang/crates.io-index"
1359checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
1360
13611103[[package]]
13621104name = "redox_syscall"
13631105version = "0.5.18"
......@@ -1401,12 +1143,11 @@ name = "rustbook"
14011143version = "0.1.0"
14021144dependencies = [
14031145 "clap",
1404 "env_logger",
1405 "libc",
1406 "mdbook",
1146 "mdbook-driver",
14071147 "mdbook-i18n-helpers",
14081148 "mdbook-spec",
14091149 "mdbook-trpl",
1150 "tracing-subscriber",
14101151]
14111152
14121153[[package]]
......@@ -1507,6 +1248,15 @@ dependencies = [
15071248 "serde",
15081249]
15091250
1251[[package]]
1252name = "serde_spanned"
1253version = "1.0.3"
1254source = "registry+https://github.com/rust-lang/crates.io-index"
1255checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392"
1256dependencies = [
1257 "serde_core",
1258]
1259
15101260[[package]]
15111261name = "sha2"
15121262version = "0.10.9"
......@@ -1518,6 +1268,15 @@ dependencies = [
15181268 "digest",
15191269]
15201270
1271[[package]]
1272name = "sharded-slab"
1273version = "0.1.7"
1274source = "registry+https://github.com/rust-lang/crates.io-index"
1275checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
1276dependencies = [
1277 "lazy_static",
1278]
1279
15211280[[package]]
15221281name = "shlex"
15231282version = "1.3.0"
......@@ -1542,12 +1301,6 @@ version = "1.15.1"
15421301source = "registry+https://github.com/rust-lang/crates.io-index"
15431302checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
15441303
1545[[package]]
1546name = "stable_deref_trait"
1547version = "1.2.1"
1548source = "registry+https://github.com/rust-lang/crates.io-index"
1549checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
1550
15511304[[package]]
15521305name = "string_cache"
15531306version = "0.9.0"
......@@ -1556,7 +1309,7 @@ checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901"
15561309dependencies = [
15571310 "new_debug_unreachable",
15581311 "parking_lot",
1559 "phf_shared 0.13.1",
1312 "phf_shared",
15601313 "precomputed-hash",
15611314 "serde",
15621315]
......@@ -1567,8 +1320,8 @@ version = "0.6.1"
15671320source = "registry+https://github.com/rust-lang/crates.io-index"
15681321checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69"
15691322dependencies = [
1570 "phf_generator 0.13.1",
1571 "phf_shared 0.13.1",
1323 "phf_generator",
1324 "phf_shared",
15721325 "proc-macro2",
15731326 "quote",
15741327]
......@@ -1590,17 +1343,6 @@ dependencies = [
15901343 "unicode-ident",
15911344]
15921345
1593[[package]]
1594name = "synstructure"
1595version = "0.13.2"
1596source = "registry+https://github.com/rust-lang/crates.io-index"
1597checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
1598dependencies = [
1599 "proc-macro2",
1600 "quote",
1601 "syn",
1602]
1603
16041346[[package]]
16051347name = "syntect"
16061348version = "5.3.0"
......@@ -1608,10 +1350,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
16081350checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925"
16091351dependencies = [
16101352 "bincode",
1353 "fancy-regex",
16111354 "flate2",
16121355 "fnv",
16131356 "once_cell",
1614 "onig",
16151357 "regex-syntax",
16161358 "serde",
16171359 "serde_derive",
......@@ -1643,16 +1385,6 @@ dependencies = [
16431385 "utf-8",
16441386]
16451387
1646[[package]]
1647name = "terminal_size"
1648version = "0.4.3"
1649source = "registry+https://github.com/rust-lang/crates.io-index"
1650checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0"
1651dependencies = [
1652 "rustix",
1653 "windows-sys 0.60.2",
1654]
1655
16561388[[package]]
16571389name = "textwrap"
16581390version = "0.16.2"
......@@ -1700,34 +1432,39 @@ dependencies = [
17001432]
17011433
17021434[[package]]
1703name = "tinystr"
1704version = "0.8.2"
1435name = "thread_local"
1436version = "1.1.9"
17051437source = "registry+https://github.com/rust-lang/crates.io-index"
1706checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
1438checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
17071439dependencies = [
1708 "displaydoc",
1709 "zerovec",
1440 "cfg-if",
17101441]
17111442
17121443[[package]]
17131444name = "toml"
1714version = "0.5.11"
1445version = "0.8.23"
17151446source = "registry+https://github.com/rust-lang/crates.io-index"
1716checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
1447checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
17171448dependencies = [
17181449 "serde",
1450 "serde_spanned 0.6.9",
1451 "toml_datetime 0.6.11",
1452 "toml_edit",
17191453]
17201454
17211455[[package]]
17221456name = "toml"
1723version = "0.8.23"
1457version = "0.9.8"
17241458source = "registry+https://github.com/rust-lang/crates.io-index"
1725checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
1459checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
17261460dependencies = [
1727 "serde",
1728 "serde_spanned",
1729 "toml_datetime",
1730 "toml_edit",
1461 "indexmap",
1462 "serde_core",
1463 "serde_spanned 1.0.3",
1464 "toml_datetime 0.7.3",
1465 "toml_parser",
1466 "toml_writer",
1467 "winnow",
17311468]
17321469
17331470[[package]]
......@@ -1739,6 +1476,15 @@ dependencies = [
17391476 "serde",
17401477]
17411478
1479[[package]]
1480name = "toml_datetime"
1481version = "0.7.3"
1482source = "registry+https://github.com/rust-lang/crates.io-index"
1483checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
1484dependencies = [
1485 "serde_core",
1486]
1487
17421488[[package]]
17431489name = "toml_edit"
17441490version = "0.22.27"
......@@ -1747,24 +1493,100 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
17471493dependencies = [
17481494 "indexmap",
17491495 "serde",
1750 "serde_spanned",
1751 "toml_datetime",
1496 "serde_spanned 0.6.9",
1497 "toml_datetime 0.6.11",
17521498 "toml_write",
17531499 "winnow",
17541500]
17551501
1502[[package]]
1503name = "toml_parser"
1504version = "1.0.4"
1505source = "registry+https://github.com/rust-lang/crates.io-index"
1506checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
1507dependencies = [
1508 "winnow",
1509]
1510
17561511[[package]]
17571512name = "toml_write"
17581513version = "0.1.2"
17591514source = "registry+https://github.com/rust-lang/crates.io-index"
17601515checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
17611516
1517[[package]]
1518name = "toml_writer"
1519version = "1.0.4"
1520source = "registry+https://github.com/rust-lang/crates.io-index"
1521checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
1522
17621523[[package]]
17631524name = "topological-sort"
17641525version = "0.2.2"
17651526source = "registry+https://github.com/rust-lang/crates.io-index"
17661527checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d"
17671528
1529[[package]]
1530name = "tracing"
1531version = "0.1.43"
1532source = "registry+https://github.com/rust-lang/crates.io-index"
1533checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
1534dependencies = [
1535 "pin-project-lite",
1536 "tracing-attributes",
1537 "tracing-core",
1538]
1539
1540[[package]]
1541name = "tracing-attributes"
1542version = "0.1.31"
1543source = "registry+https://github.com/rust-lang/crates.io-index"
1544checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
1545dependencies = [
1546 "proc-macro2",
1547 "quote",
1548 "syn",
1549]
1550
1551[[package]]
1552name = "tracing-core"
1553version = "0.1.35"
1554source = "registry+https://github.com/rust-lang/crates.io-index"
1555checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
1556dependencies = [
1557 "once_cell",
1558 "valuable",
1559]
1560
1561[[package]]
1562name = "tracing-log"
1563version = "0.2.0"
1564source = "registry+https://github.com/rust-lang/crates.io-index"
1565checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
1566dependencies = [
1567 "log",
1568 "once_cell",
1569 "tracing-core",
1570]
1571
1572[[package]]
1573name = "tracing-subscriber"
1574version = "0.3.22"
1575source = "registry+https://github.com/rust-lang/crates.io-index"
1576checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
1577dependencies = [
1578 "matchers",
1579 "nu-ansi-term",
1580 "once_cell",
1581 "regex-automata",
1582 "sharded-slab",
1583 "smallvec",
1584 "thread_local",
1585 "tracing",
1586 "tracing-core",
1587 "tracing-log",
1588]
1589
17681590[[package]]
17691591name = "typenum"
17701592version = "1.19.0"
......@@ -1795,36 +1617,24 @@ version = "0.2.2"
17951617source = "registry+https://github.com/rust-lang/crates.io-index"
17961618checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
17971619
1798[[package]]
1799name = "url"
1800version = "2.5.7"
1801source = "registry+https://github.com/rust-lang/crates.io-index"
1802checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
1803dependencies = [
1804 "form_urlencoded",
1805 "idna",
1806 "percent-encoding",
1807 "serde",
1808]
1809
18101620[[package]]
18111621name = "utf-8"
18121622version = "0.7.6"
18131623source = "registry+https://github.com/rust-lang/crates.io-index"
18141624checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
18151625
1816[[package]]
1817name = "utf8_iter"
1818version = "1.0.4"
1819source = "registry+https://github.com/rust-lang/crates.io-index"
1820checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
1821
18221626[[package]]
18231627name = "utf8parse"
18241628version = "0.2.2"
18251629source = "registry+https://github.com/rust-lang/crates.io-index"
18261630checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
18271631
1632[[package]]
1633name = "valuable"
1634version = "0.1.1"
1635source = "registry+https://github.com/rust-lang/crates.io-index"
1636checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
1637
18281638[[package]]
18291639name = "version_check"
18301640version = "0.9.5"
......@@ -1897,11 +1707,11 @@ dependencies = [
18971707
18981708[[package]]
18991709name = "web_atoms"
1900version = "0.1.4"
1710version = "0.2.0"
19011711source = "registry+https://github.com/rust-lang/crates.io-index"
1902checksum = "44b72896d90cfd22c495d0ee4960d3dd20ca64180895cb92cd5342ff7482a579"
1712checksum = "acd0c322f146d0f8aad130ce6c187953889359584497dac6561204c8e17bb43d"
19031713dependencies = [
1904 "phf 0.13.1",
1714 "phf",
19051715 "phf_codegen",
19061716 "string_cache",
19071717 "string_cache_codegen",
......@@ -2072,86 +1882,3 @@ name = "wit-bindgen"
20721882version = "0.46.0"
20731883source = "registry+https://github.com/rust-lang/crates.io-index"
20741884checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
2075
2076[[package]]
2077name = "writeable"
2078version = "0.6.2"
2079source = "registry+https://github.com/rust-lang/crates.io-index"
2080checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
2081
2082[[package]]
2083name = "yoke"
2084version = "0.8.1"
2085source = "registry+https://github.com/rust-lang/crates.io-index"
2086checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
2087dependencies = [
2088 "stable_deref_trait",
2089 "yoke-derive",
2090 "zerofrom",
2091]
2092
2093[[package]]
2094name = "yoke-derive"
2095version = "0.8.1"
2096source = "registry+https://github.com/rust-lang/crates.io-index"
2097checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
2098dependencies = [
2099 "proc-macro2",
2100 "quote",
2101 "syn",
2102 "synstructure",
2103]
2104
2105[[package]]
2106name = "zerofrom"
2107version = "0.1.6"
2108source = "registry+https://github.com/rust-lang/crates.io-index"
2109checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
2110dependencies = [
2111 "zerofrom-derive",
2112]
2113
2114[[package]]
2115name = "zerofrom-derive"
2116version = "0.1.6"
2117source = "registry+https://github.com/rust-lang/crates.io-index"
2118checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
2119dependencies = [
2120 "proc-macro2",
2121 "quote",
2122 "syn",
2123 "synstructure",
2124]
2125
2126[[package]]
2127name = "zerotrie"
2128version = "0.2.3"
2129source = "registry+https://github.com/rust-lang/crates.io-index"
2130checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
2131dependencies = [
2132 "displaydoc",
2133 "yoke",
2134 "zerofrom",
2135]
2136
2137[[package]]
2138name = "zerovec"
2139version = "0.11.5"
2140source = "registry+https://github.com/rust-lang/crates.io-index"
2141checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
2142dependencies = [
2143 "yoke",
2144 "zerofrom",
2145 "zerovec-derive",
2146]
2147
2148[[package]]
2149name = "zerovec-derive"
2150version = "0.11.2"
2151source = "registry+https://github.com/rust-lang/crates.io-index"
2152checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
2153dependencies = [
2154 "proc-macro2",
2155 "quote",
2156 "syn",
2157]
src/tools/rustbook/Cargo.toml+5-10
......@@ -8,14 +8,9 @@ license = "MIT OR Apache-2.0"
88edition = "2021"
99
1010[dependencies]
11clap = "4.0.32"
12env_logger = "0.11"
13libc = "0.2"
14mdbook-trpl = { path = "../../doc/book/packages/mdbook-trpl" }
15mdbook-i18n-helpers = "0.3.3"
11clap = { version = "4.0.32", features = ["cargo"] }
12mdbook-driver = { version = "0.5.2", features = ["search"] }
13mdbook-i18n-helpers = "0.4.0"
1614mdbook-spec = { path = "../../doc/reference/mdbook-spec" }
17
18[dependencies.mdbook]
19version = "0.4.52"
20default-features = false
21features = ["search"]
15mdbook-trpl = { path = "../../doc/book/packages/mdbook-trpl" }
16tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
src/tools/rustbook/src/main.rs+58-42
......@@ -2,15 +2,27 @@ use std::env;
22use std::path::{Path, PathBuf};
33
44use clap::{ArgMatches, Command, arg, crate_version};
5use mdbook::MDBook;
6use mdbook::errors::Result as Result3;
5use mdbook_driver::MDBook;
6use mdbook_driver::errors::Result as Result3;
77use mdbook_i18n_helpers::preprocessors::Gettext;
88use mdbook_spec::Spec;
99use mdbook_trpl::{Figure, Listing, Note};
1010
1111fn main() {
1212 let crate_version = concat!("v", crate_version!());
13 env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
13 let filter = tracing_subscriber::EnvFilter::builder()
14 .with_env_var("MDBOOK_LOG")
15 .with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())
16 .from_env_lossy();
17 tracing_subscriber::fmt()
18 .without_time()
19 .with_ansi(std::io::IsTerminal::is_terminal(&std::io::stderr()))
20 .with_writer(std::io::stderr)
21 .with_env_filter(filter)
22 .with_target(std::env::var_os("MDBOOK_LOG").is_some())
23 .init();
24
25 // env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
1426 let d_arg = arg!(-d --"dest-dir" <DEST_DIR>
1527"The output directory for your book\n(Defaults to ./book when omitted)")
1628 .required(false)
......@@ -82,12 +94,45 @@ fn main() {
8294 };
8395}
8496
85// Build command implementation
86pub fn build(args: &ArgMatches) -> Result3<()> {
97fn build(args: &ArgMatches) -> Result3<()> {
8798 let book_dir = get_book_dir(args);
88 let mut book = load_book(&book_dir)?;
99 let dest_dir = args.get_one::<PathBuf>("dest-dir");
100 let lang = args.get_one::<String>("lang");
101 let rust_root = args.get_one::<PathBuf>("rust-root");
102 let book = load_book(&book_dir, dest_dir, lang, rust_root.cloned())?;
103 book.build()
104}
105
106fn test(args: &ArgMatches) -> Result3<()> {
107 let book_dir = get_book_dir(args);
108 let mut book = load_book(&book_dir, None, None, None)?;
109 let library_paths = args
110 .try_get_one::<Vec<String>>("library-path")?
111 .map(|v| v.iter().map(|s| s.as_str()).collect::<Vec<&str>>())
112 .unwrap_or_default();
113 book.test(library_paths)
114}
115
116fn get_book_dir(args: &ArgMatches) -> PathBuf {
117 if let Some(p) = args.get_one::<PathBuf>("dir") {
118 // Check if path is relative from current dir, or absolute...
119 if p.is_relative() { env::current_dir().unwrap().join(p) } else { p.to_path_buf() }
120 } else {
121 env::current_dir().unwrap()
122 }
123}
124
125fn load_book(
126 book_dir: &Path,
127 dest_dir: Option<&PathBuf>,
128 lang: Option<&String>,
129 rust_root: Option<PathBuf>,
130) -> Result3<MDBook> {
131 let mut book = MDBook::load(book_dir)?;
132 book.config.set("output.html.input-404", "").unwrap();
133 book.config.set("output.html.hash-files", true).unwrap();
89134
90 if let Some(lang) = args.get_one::<String>("lang") {
135 if let Some(lang) = lang {
91136 let gettext = Gettext;
92137 book.with_preprocessor(gettext);
93138 book.config.set("book.language", lang).unwrap();
......@@ -96,7 +141,7 @@ pub fn build(args: &ArgMatches) -> Result3<()> {
96141 // Set this to allow us to catch bugs in advance.
97142 book.config.build.create_missing = false;
98143
99 if let Some(dest_dir) = args.get_one::<PathBuf>("dest-dir") {
144 if let Some(dest_dir) = dest_dir {
100145 book.config.build.build_dir = dest_dir.into();
101146 }
102147
......@@ -107,51 +152,22 @@ pub fn build(args: &ArgMatches) -> Result3<()> {
107152 // This should probably be fixed in mdbook to remove the existing
108153 // preprocessor, or this should modify the config and use
109154 // MDBook::load_with_config.
110 if book.config.get_preprocessor("trpl-note").is_some() {
155 if book.config.contains_key("preprocessor.trpl-note") {
111156 book.with_preprocessor(Note);
112157 }
113158
114 if book.config.get_preprocessor("trpl-listing").is_some() {
159 if book.config.contains_key("preprocessor.trpl-listing") {
115160 book.with_preprocessor(Listing);
116161 }
117162
118 if book.config.get_preprocessor("trpl-figure").is_some() {
163 if book.config.contains_key("preprocessor.trpl-figure") {
119164 book.with_preprocessor(Figure);
120165 }
121166
122 if book.config.get_preprocessor("spec").is_some() {
123 let rust_root = args.get_one::<PathBuf>("rust-root").cloned();
167 if book.config.contains_key("preprocessor.spec") {
124168 book.with_preprocessor(Spec::new(rust_root)?);
125169 }
126170
127 book.build()?;
128
129 Ok(())
130}
131
132fn test(args: &ArgMatches) -> Result3<()> {
133 let book_dir = get_book_dir(args);
134 let library_paths = args
135 .try_get_one::<Vec<String>>("library-path")?
136 .map(|v| v.iter().map(|s| s.as_str()).collect::<Vec<&str>>())
137 .unwrap_or_default();
138 let mut book = load_book(&book_dir)?;
139 book.test(library_paths)
140}
141
142fn get_book_dir(args: &ArgMatches) -> PathBuf {
143 if let Some(p) = args.get_one::<PathBuf>("dir") {
144 // Check if path is relative from current dir, or absolute...
145 if p.is_relative() { env::current_dir().unwrap().join(p) } else { p.to_path_buf() }
146 } else {
147 env::current_dir().unwrap()
148 }
149}
150
151fn load_book(book_dir: &Path) -> Result3<MDBook> {
152 let mut book = MDBook::load(book_dir)?;
153 book.config.set("output.html.input-404", "").unwrap();
154 book.config.set("output.html.hash-files", true).unwrap();
155171 Ok(book)
156172}
157173
......@@ -159,7 +175,7 @@ fn parse_library_paths(input: &str) -> Result<Vec<String>, String> {
159175 Ok(input.split(",").map(String::from).collect())
160176}
161177
162fn handle_error(error: mdbook::errors::Error) -> ! {
178fn handle_error(error: mdbook_driver::errors::Error) -> ! {
163179 eprintln!("Error: {}", error);
164180
165181 for cause in error.chain().skip(1) {
src/tools/tidy/src/deps.rs+37-17
......@@ -1,6 +1,7 @@
11//! Checks the licenses of third-party dependencies.
22
33use std::collections::{HashMap, HashSet};
4use std::fmt::{Display, Formatter};
45use std::fs::{File, read_dir};
56use std::io::Write;
67use std::path::Path;
......@@ -14,6 +15,25 @@ use crate::diagnostics::{RunningCheck, TidyCtx};
1415#[path = "../../../bootstrap/src/utils/proc_macro_deps.rs"]
1516mod proc_macro_deps;
1617
18#[derive(Clone, Copy)]
19struct ListLocation {
20 path: &'static str,
21 line: u32,
22}
23
24impl Display for ListLocation {
25 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
26 write!(f, "{}:{}", self.path, self.line)
27 }
28}
29
30/// Creates a [`ListLocation`] for the current location (with an additional offset to the actual list start);
31macro_rules! location {
32 (+ $offset:literal) => {
33 ListLocation { path: file!(), line: line!() + $offset }
34 };
35}
36
1737/// These are licenses that are allowed for all crates, including the runtime,
1838/// rustc, tools, etc.
1939#[rustfmt::skip]
......@@ -87,6 +107,8 @@ pub(crate) struct WorkspaceInfo<'a> {
87107 pub(crate) submodules: &'a [&'a str],
88108}
89109
110const WORKSPACE_LOCATION: ListLocation = location!(+4);
111
90112/// The workspaces to check for licensing and optionally permitted dependencies.
91113// FIXME auto detect all cargo workspaces
92114pub(crate) const WORKSPACES: &[WorkspaceInfo<'static>] = &[
......@@ -222,10 +244,14 @@ const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
222244
223245const EXCEPTIONS_RUSTBOOK: ExceptionList = &[
224246 // tidy-alphabetical-start
225 ("cssparser", "MPL-2.0"),
226 ("cssparser-macros", "MPL-2.0"),
227 ("dtoa-short", "MPL-2.0"),
228 ("mdbook", "MPL-2.0"),
247 ("font-awesome-as-a-crate", "CC-BY-4.0 AND MIT"),
248 ("mdbook-core", "MPL-2.0"),
249 ("mdbook-driver", "MPL-2.0"),
250 ("mdbook-html", "MPL-2.0"),
251 ("mdbook-markdown", "MPL-2.0"),
252 ("mdbook-preprocessor", "MPL-2.0"),
253 ("mdbook-renderer", "MPL-2.0"),
254 ("mdbook-summary", "MPL-2.0"),
229255 // tidy-alphabetical-end
230256];
231257
......@@ -242,19 +268,6 @@ const EXCEPTIONS_BOOTSTRAP: ExceptionList = &[];
242268
243269const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[];
244270
245#[derive(Clone, Copy)]
246struct ListLocation {
247 path: &'static str,
248 line: u32,
249}
250
251/// Creates a [`ListLocation`] for the current location (with an additional offset to the actual list start);
252macro_rules! location {
253 (+ $offset:literal) => {
254 ListLocation { path: file!(), line: line!() + $offset }
255 };
256}
257
258271const PERMITTED_RUSTC_DEPS_LOCATION: ListLocation = location!(+6);
259272
260273/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
......@@ -641,6 +654,13 @@ pub fn check(root: &Path, cargo: &Path, tidy_ctx: TidyCtx) {
641654 .other_options(vec!["--locked".to_owned()]);
642655 let metadata = t!(cmd.exec());
643656
657 // Check for packages which have been moved into a different workspace and not updated
658 let absolute_root =
659 if path == "." { root.to_path_buf() } else { t!(std::path::absolute(root.join(path))) };
660 let absolute_root_real = t!(std::path::absolute(&metadata.workspace_root));
661 if absolute_root_real != absolute_root {
662 check.error(format!("{path} is part of another workspace ({} != {}), remove from `WORKSPACES` ({WORKSPACE_LOCATION})", absolute_root.display(), absolute_root_real.display()));
663 }
644664 check_license_exceptions(&metadata, path, exceptions, &mut check);
645665 if let Some((crates, permitted_deps, location)) = crates_and_deps {
646666 let descr = crates.get(0).unwrap_or(&path);
tests/codegen-llvm/cffi/c-variadic-va_list.rs+3-3
......@@ -22,15 +22,15 @@ pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) {
2222
2323// CHECK-LABEL: use_foreign_c_variadic_1_1
2424pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) {
25 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef 42)
25 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef{{( signext)?}} 42)
2626 foreign_c_variadic_1(ap, 42i32);
2727}
2828pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
29 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef 2, i32 noundef 42)
29 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef{{( signext)?}} 2, i32 noundef{{( signext)?}} 42)
3030 foreign_c_variadic_1(ap, 2i32, 42i32);
3131}
3232
3333pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
34 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef 2, i32 noundef 42, i32 noundef 0)
34 // CHECK: call void ({{.*}}, ...) @foreign_c_variadic_1({{.*}} %ap, i32 noundef{{( signext)?}} 2, i32 noundef{{( signext)?}} 42, i32 noundef{{( signext)?}} 0)
3535 foreign_c_variadic_1(ap, 2i32, 42i32, 0i32);
3636}
triagebot.toml+11
......@@ -96,6 +96,17 @@ Thanks! <3
9696"""
9797label = "O-ARM"
9898
99[ping.loongarch]
100message = """\
101Hey LoongArch Group! This bug has been identified as a good "LoongArch candidate".
102In case it's useful, here are some [instructions] for tackling these sorts of
103bugs. Maybe take a look?
104Thanks! <3
105
106[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/loongarch.html
107"""
108label = "O-loongarch"
109
99110[ping.risc-v]
100111message = """\
101112Hey RISC-V Group! This bug has been identified as a good "RISC-V candidate".