Skip to content

Commit 81117ff

Browse files
committed
Auto merge of #89847 - JohnTitor:rollup-xfymeo4, r=JohnTitor
Rollup of 12 pull requests Successful merges: - #89768 (add some more testcases) - #89777 (Edit explanation of test for nested type ascriptions) - #89781 (Add missing words in `Infallible` docs) - #89782 (Improve CJK font in rustdoc) - #89794 (Add #[must_use] to to_value conversions) - #89814 (Fix uppercase/lowercase error) - #89816 (Fix invalid rules in .gitignore) - #89817 (Add #[inline] to int log10 functions.) - #89818 (Use Option::map_or instead of open coding it) - #89828 (Fix config.toml overflow-checks options) - #89840 (fix the stage0 tools config file path in `config.toml.example`) - #89845 (Add davidtwco to the `.mailmap`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5728bd6 + e21f892 commit 81117ff

29 files changed

+278
-25
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ __pycache__/
6969
*$py.class
7070

7171
## Node
72-
**node_modules
73-
**package-lock.json
72+
node_modules
73+
package-lock.json
7474

7575
## Rustdoc GUI tests
7676
src/test/rustdoc-gui/src/**.lock

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Daniel Ramos <[email protected]>
7272
David Klein <[email protected]>
7373
7474
David Ross <[email protected]>
75+
7576
7677
Derek Chiang <[email protected]> Derek Chiang (Enchi Jiang) <[email protected]>
7778
Diggory Hardy <[email protected]> Diggory Hardy <[email protected]>

compiler/rustc_index/src/bit_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ impl<T: Idx> GrowableBitSet<T> {
841841
#[inline]
842842
pub fn contains(&self, elem: T) -> bool {
843843
let (word_index, mask) = word_index_and_mask(elem);
844-
if let Some(word) = self.bit_set.words.get(word_index) { (word & mask) != 0 } else { false }
844+
self.bit_set.words.get(word_index).map_or(false, |word| (word & mask) != 0)
845845
}
846846
}
847847

config.toml.example

+15-3
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ changelog-seen = 2
202202
# You can use "$ROOT" to indicate the root of the git repository.
203203
#build-dir = "build"
204204

205-
# Instead of downloading the src/stage0.txt version of Cargo specified, use
205+
# Instead of downloading the src/stage0.json version of Cargo specified, use
206206
# this Cargo binary instead to build all Rust code
207207
#cargo = "/path/to/cargo"
208208

209-
# Instead of downloading the src/stage0.txt version of the compiler
209+
# Instead of downloading the src/stage0.json version of the compiler
210210
# specified, use this rustc binary instead as the stage0 snapshot compiler.
211211
#rustc = "/path/to/rustc"
212212

213-
# Instead of download the src/stage0.txt version of rustfmt specified,
213+
# Instead of download the src/stage0.json version of rustfmt specified,
214214
# use this rustfmt binary instead as the stage0 snapshot rustfmt.
215215
#rustfmt = "/path/to/rustfmt"
216216

@@ -423,6 +423,18 @@ changelog-seen = 2
423423
# set this value to `true`.
424424
#debug-logging = rust.debug-assertions (boolean)
425425

426+
# Whether or not overflow checks are enabled for the compiler and standard
427+
# library.
428+
#
429+
# Defaults to rust.debug value
430+
#overflow-checks = rust.debug (boolean)
431+
432+
# Whether or not overflow checks are enabled for the standard library.
433+
# Overrides the `overflow-checks` option, if defined.
434+
#
435+
# Defaults to rust.overflow-checks value
436+
#overflow-checks-std = rust.overflow-checks (boolean)
437+
426438
# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
427439
# `0` - no debug info
428440
# `1` - line tables only - sufficient to generate backtraces that include line

library/alloc/src/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ impl str {
538538
/// [`make_ascii_uppercase`]: str::make_ascii_uppercase
539539
/// [`to_uppercase`]: #method.to_uppercase
540540
#[cfg(not(no_global_oom_handling))]
541-
#[must_use = "to uppercase the value in-place, use `make_ascii_lowercase()`"]
541+
#[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"]
542542
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
543543
#[inline]
544544
pub fn to_ascii_uppercase(&self) -> String {

library/core/src/char/methods.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,11 @@ impl char {
328328
///
329329
/// ```should_panic
330330
/// // this panics
331-
/// '1'.to_digit(37);
331+
/// let _ = '1'.to_digit(37);
332332
/// ```
333333
#[stable(feature = "rust1", since = "1.0.0")]
334+
#[must_use = "this returns the result of the operation, \
335+
without modifying the original"]
334336
#[inline]
335337
pub fn to_digit(self, radix: u32) -> Option<u32> {
336338
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");

library/core/src/convert/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ impl AsMut<str> for str {
664664
///
665665
/// However there is one case where `!` syntax can be used
666666
/// before `!` is stabilized as a full-fledged type: in the position of a function’s return type.
667-
/// Specifically, it is possible implementations for two different function pointer types:
667+
/// Specifically, it is possible to have implementations for two different function pointer types:
668668
///
669669
/// ```
670670
/// trait MyTrait {}

library/core/src/num/int_log10.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mod unchecked {
22
// 0 < val <= u8::MAX
3+
#[inline]
34
pub const fn u8(val: u8) -> u32 {
45
let val = val as u32;
56

@@ -20,6 +21,7 @@ mod unchecked {
2021
}
2122

2223
// 0 < val < 100_000
24+
#[inline]
2325
const fn less_than_5(val: u32) -> u32 {
2426
// Similar to u8, when adding one of these constants to val,
2527
// we get two possible bit patterns above the low 17 bits,
@@ -40,11 +42,13 @@ mod unchecked {
4042
}
4143

4244
// 0 < val <= u16::MAX
45+
#[inline]
4346
pub const fn u16(val: u16) -> u32 {
4447
less_than_5(val as u32)
4548
}
4649

4750
// 0 < val <= u32::MAX
51+
#[inline]
4852
pub const fn u32(mut val: u32) -> u32 {
4953
let mut log = 0;
5054
if val >= 100_000 {
@@ -55,6 +59,7 @@ mod unchecked {
5559
}
5660

5761
// 0 < val <= u64::MAX
62+
#[inline]
5863
pub const fn u64(mut val: u64) -> u32 {
5964
let mut log = 0;
6065
if val >= 10_000_000_000 {
@@ -69,6 +74,7 @@ mod unchecked {
6974
}
7075

7176
// 0 < val <= u128::MAX
77+
#[inline]
7278
pub const fn u128(mut val: u128) -> u32 {
7379
let mut log = 0;
7480
if val >= 100_000_000_000_000_000_000_000_000_000_000 {
@@ -84,33 +90,39 @@ mod unchecked {
8490
}
8591

8692
// 0 < val <= i8::MAX
93+
#[inline]
8794
pub const fn i8(val: i8) -> u32 {
8895
u8(val as u8)
8996
}
9097

9198
// 0 < val <= i16::MAX
99+
#[inline]
92100
pub const fn i16(val: i16) -> u32 {
93101
u16(val as u16)
94102
}
95103

96104
// 0 < val <= i32::MAX
105+
#[inline]
97106
pub const fn i32(val: i32) -> u32 {
98107
u32(val as u32)
99108
}
100109

101110
// 0 < val <= i64::MAX
111+
#[inline]
102112
pub const fn i64(val: i64) -> u32 {
103113
u64(val as u64)
104114
}
105115

106116
// 0 < val <= i128::MAX
117+
#[inline]
107118
pub const fn i128(val: i128) -> u32 {
108119
u128(val as u128)
109120
}
110121
}
111122

112123
macro_rules! impl_checked {
113124
($T:ident) => {
125+
#[inline]
114126
pub const fn $T(val: $T) -> Option<u32> {
115127
if val > 0 { Some(unchecked::$T(val)) } else { None }
116128
}

library/core/src/ptr/non_null.rs

+4
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ impl<T: ?Sized> NonNull<T> {
242242
/// The pointer can be later reconstructed with [`NonNull::from_raw_parts`].
243243
#[unstable(feature = "ptr_metadata", issue = "81513")]
244244
#[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")]
245+
#[must_use = "this returns the result of the operation, \
246+
without modifying the original"]
245247
#[inline]
246248
pub const fn to_raw_parts(self) -> (NonNull<()>, <T as super::Pointee>::Metadata) {
247249
(self.cast(), super::metadata(self.as_ptr()))
@@ -386,6 +388,8 @@ impl<T: ?Sized> NonNull<T> {
386388
/// ```
387389
#[stable(feature = "nonnull_cast", since = "1.27.0")]
388390
#[rustc_const_stable(feature = "const_nonnull_cast", since = "1.36.0")]
391+
#[must_use = "this returns the result of the operation, \
392+
without modifying the original"]
389393
#[inline]
390394
pub const fn cast<U>(self) -> NonNull<U> {
391395
// SAFETY: `self` is a `NonNull` pointer which is necessarily non-null

library/std/src/ffi/c_str.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,8 @@ impl CStr {
13421342
/// assert_eq!(cstr.to_bytes(), b"foo");
13431343
/// ```
13441344
#[inline]
1345+
#[must_use = "this returns the result of the operation, \
1346+
without modifying the original"]
13451347
#[stable(feature = "rust1", since = "1.0.0")]
13461348
pub fn to_bytes(&self) -> &[u8] {
13471349
let bytes = self.to_bytes_with_nul();
@@ -1367,6 +1369,8 @@ impl CStr {
13671369
/// assert_eq!(cstr.to_bytes_with_nul(), b"foo\0");
13681370
/// ```
13691371
#[inline]
1372+
#[must_use = "this returns the result of the operation, \
1373+
without modifying the original"]
13701374
#[stable(feature = "rust1", since = "1.0.0")]
13711375
pub fn to_bytes_with_nul(&self) -> &[u8] {
13721376
unsafe { &*(&self.inner as *const [c_char] as *const [u8]) }
@@ -1437,6 +1441,8 @@ impl CStr {
14371441
/// Cow::Owned(String::from("Hello �World")) as Cow<'_, str>
14381442
/// );
14391443
/// ```
1444+
#[must_use = "this returns the result of the operation, \
1445+
without modifying the original"]
14401446
#[stable(feature = "cstr_to_str", since = "1.4.0")]
14411447
pub fn to_string_lossy(&self) -> Cow<'_, str> {
14421448
String::from_utf8_lossy(self.to_bytes())

library/std/src/ffi/os_str.rs

+6
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ impl OsStr {
576576
/// assert_eq!(os_str.to_str(), Some("foo"));
577577
/// ```
578578
#[stable(feature = "rust1", since = "1.0.0")]
579+
#[must_use = "this returns the result of the operation, \
580+
without modifying the original"]
579581
#[inline]
580582
pub fn to_str(&self) -> Option<&str> {
581583
self.inner.to_str()
@@ -627,6 +629,8 @@ impl OsStr {
627629
/// }
628630
/// ```
629631
#[stable(feature = "rust1", since = "1.0.0")]
632+
#[must_use = "this returns the result of the operation, \
633+
without modifying the original"]
630634
#[inline]
631635
pub fn to_string_lossy(&self) -> Cow<'_, str> {
632636
self.inner.to_string_lossy()
@@ -644,6 +648,8 @@ impl OsStr {
644648
/// assert_eq!(os_string, OsString::from("foo"));
645649
/// ```
646650
#[stable(feature = "rust1", since = "1.0.0")]
651+
#[must_use = "this returns the result of the operation, \
652+
without modifying the original"]
647653
#[inline]
648654
pub fn to_os_string(&self) -> OsString {
649655
OsString { inner: self.inner.to_owned() }

library/std/src/net/ip.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ impl IpAddr {
426426
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).to_canonical().is_loopback(), true);
427427
/// ```
428428
#[inline]
429+
#[must_use = "this returns the result of the operation, \
430+
without modifying the original"]
429431
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
430432
#[unstable(feature = "ip", issue = "27709")]
431433
pub const fn to_canonical(&self) -> IpAddr {
@@ -901,6 +903,8 @@ impl Ipv4Addr {
901903
/// ```
902904
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
903905
#[stable(feature = "rust1", since = "1.0.0")]
906+
#[must_use = "this returns the result of the operation, \
907+
without modifying the original"]
904908
#[inline]
905909
pub const fn to_ipv6_compatible(&self) -> Ipv6Addr {
906910
let [a, b, c, d] = self.octets();
@@ -926,6 +930,8 @@ impl Ipv4Addr {
926930
/// ```
927931
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
928932
#[stable(feature = "rust1", since = "1.0.0")]
933+
#[must_use = "this returns the result of the operation, \
934+
without modifying the original"]
929935
#[inline]
930936
pub const fn to_ipv6_mapped(&self) -> Ipv6Addr {
931937
let [a, b, c, d] = self.octets();
@@ -1648,6 +1654,8 @@ impl Ipv6Addr {
16481654
/// ```
16491655
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
16501656
#[unstable(feature = "ip", issue = "27709")]
1657+
#[must_use = "this returns the result of the operation, \
1658+
without modifying the original"]
16511659
#[inline]
16521660
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
16531661
match self.octets() {
@@ -1685,6 +1693,8 @@ impl Ipv6Addr {
16851693
/// ```
16861694
#[rustc_const_stable(feature = "const_ipv6", since = "1.50.0")]
16871695
#[stable(feature = "rust1", since = "1.0.0")]
1696+
#[must_use = "this returns the result of the operation, \
1697+
without modifying the original"]
16881698
#[inline]
16891699
pub const fn to_ipv4(&self) -> Option<Ipv4Addr> {
16901700
if let [0, 0, 0, 0, 0, 0 | 0xffff, ab, cd] = self.segments() {
@@ -1708,9 +1718,11 @@ impl Ipv6Addr {
17081718
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).is_loopback(), false);
17091719
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).to_canonical().is_loopback(), true);
17101720
/// ```
1711-
#[inline]
17121721
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
17131722
#[unstable(feature = "ip", issue = "27709")]
1723+
#[must_use = "this returns the result of the operation, \
1724+
without modifying the original"]
1725+
#[inline]
17141726
pub const fn to_canonical(&self) -> IpAddr {
17151727
if let Some(mapped) = self.to_ipv4_mapped() {
17161728
return IpAddr::V4(mapped);

library/std/src/path.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,8 @@ impl Path {
19521952
/// assert_eq!(path.to_str(), Some("foo.txt"));
19531953
/// ```
19541954
#[stable(feature = "rust1", since = "1.0.0")]
1955+
#[must_use = "this returns the result of the operation, \
1956+
without modifying the original"]
19551957
#[inline]
19561958
pub fn to_str(&self) -> Option<&str> {
19571959
self.inner.to_str()
@@ -1978,6 +1980,8 @@ impl Path {
19781980
/// Had `path` contained invalid unicode, the `to_string_lossy` call might
19791981
/// have returned `"fo�.txt"`.
19801982
#[stable(feature = "rust1", since = "1.0.0")]
1983+
#[must_use = "this returns the result of the operation, \
1984+
without modifying the original"]
19811985
#[inline]
19821986
pub fn to_string_lossy(&self) -> Cow<'_, str> {
19831987
self.inner.to_string_lossy()
@@ -1994,6 +1998,8 @@ impl Path {
19941998
/// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
19951999
/// ```
19962000
#[rustc_conversion_suggestion]
2001+
#[must_use = "this returns the result of the operation, \
2002+
without modifying the original"]
19972003
#[stable(feature = "rust1", since = "1.0.0")]
19982004
pub fn to_path_buf(&self) -> PathBuf {
19992005
PathBuf::from(self.inner.to_os_string())

src/bootstrap/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ impl Config {
982982
config.rust_debug_assertions_std =
983983
debug_assertions_std.unwrap_or(config.rust_debug_assertions);
984984
config.rust_overflow_checks = overflow_checks.unwrap_or(default);
985-
config.rust_overflow_checks_std = overflow_checks_std.unwrap_or(default);
985+
config.rust_overflow_checks_std =
986+
overflow_checks_std.unwrap_or(config.rust_overflow_checks);
986987

987988
config.rust_debug_logging = debug_logging.unwrap_or(config.rust_debug_assertions);
988989

src/bootstrap/configure.py

+2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def v(*args):
7575
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
7676
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface")
7777
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
78+
o("debug-assertions-std", "rust.debug-assertions-std", "build the standard library with debugging assertions")
7879
o("overflow-checks", "rust.overflow-checks", "build with overflow checks")
80+
o("overflow-checks-std", "rust.overflow-checks-std", "build the standard library with overflow checks")
7981
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata")
8082
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
8183
v("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")

src/librustdoc/html/render/write_shared.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| {
3939
"SourceCodePro-Semibold.ttf.woff" => static_files::source_code_pro::SEMIBOLD,
4040
"SourceCodePro-It.ttf.woff" => static_files::source_code_pro::ITALIC,
4141
"SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE,
42-
"noto-sans-kr-v13-korean-regular.woff" => static_files::noto_sans_kr::REGULAR,
43-
"noto-sans-kr-v13-korean-regular-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
42+
"noto-sans-kr-regular.woff2" => static_files::noto_sans_kr::REGULAR2,
43+
"noto-sans-kr-regular.woff" => static_files::noto_sans_kr::REGULAR,
44+
"noto-sans-kr-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
4445
"LICENSE-MIT.txt" => static_files::LICENSE_MIT,
4546
"LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
4647
"COPYRIGHT.txt" => static_files::COPYRIGHT,

src/librustdoc/html/static/css/rustdoc.css

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@
7575
font-display: swap;
7676
}
7777

78-
/* Avoid using legacy CJK serif fonts in Windows like Batang */
78+
/* Avoid using legacy CJK serif fonts in Windows like Batang. */
7979
@font-face {
8080
font-family: 'Noto Sans KR';
81-
src: url("noto-sans-kr-v13-korean-regular.woff") format("woff");
81+
src: url("noto-sans-kr-regular.woff2") format("woff2"),
82+
url("noto-sans-kr-regular.woff") format("woff");
8283
font-display: swap;
83-
unicode-range: U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
84+
unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
8485
}
8586

8687
* {
Binary file not shown.

0 commit comments

Comments
 (0)