Skip to content

Commit c0b8735

Browse files
committed
Auto merge of rust-lang#106833 - JohnTitor:rollup-z8398jk, r=JohnTitor
Rollup of 13 pull requests Successful merges: - rust-lang#104965 (reword Option::as_ref and Option::map examples) - rust-lang#105172 (Added error documentation for write_fmt) - rust-lang#106605 (rustdoc: fix outdated lint section of the book) - rust-lang#106670 (Check compiler docs in PR CI) - rust-lang#106692 (mv binary_heap.rs binary_heap/mod.rs) - rust-lang#106693 (rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggle) - rust-lang#106707 (Remove duplicate sha-1 dependency) - rust-lang#106762 (Add `AtomicPtr::as_mut_ptr`) - rust-lang#106766 (Remove dead code in rustdoc stripper) - rust-lang#106775 (Remove stale reference to the test suite location) - rust-lang#106799 (Stop having unused lifetimes on some `impl`s) - rust-lang#106816 (Update `rental` hack to work with remapped paths.) - rust-lang#106819 (rustdoc: remove unnecessary DOM class `h1.fqn`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents e9e0908 + caa1d47 commit c0b8735

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+487
-235
lines changed

Cargo.lock

+16-27
Original file line numberDiff line numberDiff line change
@@ -3014,29 +3014,29 @@ dependencies = [
30143014

30153015
[[package]]
30163016
name = "pest"
3017-
version = "2.3.0"
3017+
version = "2.5.2"
30183018
source = "registry+https://github.com/rust-lang/crates.io-index"
3019-
checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4"
3019+
checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4"
30203020
dependencies = [
30213021
"thiserror",
30223022
"ucd-trie",
30233023
]
30243024

30253025
[[package]]
30263026
name = "pest_derive"
3027-
version = "2.3.0"
3027+
version = "2.5.2"
30283028
source = "registry+https://github.com/rust-lang/crates.io-index"
3029-
checksum = "905708f7f674518498c1f8d644481440f476d39ca6ecae83319bba7c6c12da91"
3029+
checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603"
30303030
dependencies = [
30313031
"pest",
30323032
"pest_generator",
30333033
]
30343034

30353035
[[package]]
30363036
name = "pest_generator"
3037-
version = "2.3.0"
3037+
version = "2.5.2"
30383038
source = "registry+https://github.com/rust-lang/crates.io-index"
3039-
checksum = "5803d8284a629cc999094ecd630f55e91b561a1d1ba75e233b00ae13b91a69ad"
3039+
checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7"
30403040
dependencies = [
30413041
"pest",
30423042
"pest_meta",
@@ -3047,13 +3047,13 @@ dependencies = [
30473047

30483048
[[package]]
30493049
name = "pest_meta"
3050-
version = "2.3.0"
3050+
version = "2.5.2"
30513051
source = "registry+https://github.com/rust-lang/crates.io-index"
3052-
checksum = "1538eb784f07615c6d9a8ab061089c6c54a344c5b4301db51990ca1c241e8c04"
3052+
checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065"
30533053
dependencies = [
30543054
"once_cell",
30553055
"pest",
3056-
"sha-1",
3056+
"sha1",
30573057
]
30583058

30593059
[[package]]
@@ -4685,7 +4685,7 @@ dependencies = [
46854685
"rustc_macros",
46864686
"rustc_serialize",
46874687
"scoped-tls",
4688-
"sha-1",
4688+
"sha1",
46894689
"sha2",
46904690
"tracing",
46914691
"unicode-width",
@@ -5094,17 +5094,6 @@ dependencies = [
50945094
"serde",
50955095
]
50965096

5097-
[[package]]
5098-
name = "sha-1"
5099-
version = "0.10.0"
5100-
source = "registry+https://github.com/rust-lang/crates.io-index"
5101-
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
5102-
dependencies = [
5103-
"cfg-if",
5104-
"cpufeatures",
5105-
"digest",
5106-
]
5107-
51085097
[[package]]
51095098
name = "sha1"
51105099
version = "0.10.5"
@@ -5540,18 +5529,18 @@ checksum = "ceb05e71730d396f960f8f3901cdb41be2d339b303e9d7d3a07c5ff0536e671b"
55405529

55415530
[[package]]
55425531
name = "thiserror"
5543-
version = "1.0.33"
5532+
version = "1.0.38"
55445533
source = "registry+https://github.com/rust-lang/crates.io-index"
5545-
checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57"
5534+
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
55465535
dependencies = [
55475536
"thiserror-impl",
55485537
]
55495538

55505539
[[package]]
55515540
name = "thiserror-impl"
5552-
version = "1.0.33"
5541+
version = "1.0.38"
55535542
source = "registry+https://github.com/rust-lang/crates.io-index"
5554-
checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09"
5543+
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
55555544
dependencies = [
55565545
"proc-macro2",
55575546
"quote",
@@ -5832,9 +5821,9 @@ dependencies = [
58325821

58335822
[[package]]
58345823
name = "ucd-trie"
5835-
version = "0.1.3"
5824+
version = "0.1.5"
58365825
source = "registry+https://github.com/rust-lang/crates.io-index"
5837-
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
5826+
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
58385827

58395828
[[package]]
58405829
name = "ui_test"

compiler/rustc_expand/src/base.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ use rustc_span::edition::Edition;
3131
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
3232
use rustc_span::source_map::SourceMap;
3333
use rustc_span::symbol::{kw, sym, Ident, Symbol};
34-
use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP};
34+
use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
3535
use smallvec::{smallvec, SmallVec};
3636

3737
use std::iter;
38-
use std::path::PathBuf;
38+
use std::path::{Path, PathBuf};
3939
use std::rc::Rc;
4040

4141
pub(crate) use rustc_span::hygiene::MacroKind;
@@ -1423,8 +1423,10 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
14231423
if let [variant] = &*enum_def.variants {
14241424
if variant.ident.name == sym::Input {
14251425
let filename = sess.source_map().span_to_filename(item.ident.span);
1426-
if let FileName::Real(RealFileName::LocalPath(path)) = filename {
1427-
if let Some(c) = path
1426+
if let FileName::Real(real) = filename {
1427+
if let Some(c) = real
1428+
.local_path()
1429+
.unwrap_or(Path::new(""))
14281430
.components()
14291431
.flat_map(|c| c.as_os_str().to_str())
14301432
.find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental"))

compiler/rustc_span/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ scoped-tls = "1.0"
1515
unicode-width = "0.1.4"
1616
cfg-if = "1.0"
1717
tracing = "0.1"
18-
sha1 = { package = "sha-1", version = "0.10.0" }
18+
sha1 = "0.10.0"
1919
sha2 = "0.10.1"
2020
md5 = { package = "md-5", version = "0.10.0" }

library/core/src/fmt/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ pub trait Write {
174174
/// This method should generally not be invoked manually, but rather through
175175
/// the [`write!`] macro itself.
176176
///
177+
/// # Errors
178+
///
179+
/// This function will return an instance of [`Error`] on error. Please see
180+
/// [write_str](Write::write_str) for details.
181+
///
177182
/// # Examples
178183
///
179184
/// ```

library/core/src/option.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -652,13 +652,14 @@ impl<T> Option<T> {
652652
///
653653
/// # Examples
654654
///
655-
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving
656-
/// the original. The [`map`] method takes the `self` argument by value, consuming the original,
657-
/// so this technique uses `as_ref` to first take an `Option` to a reference
658-
/// to the value inside the original.
655+
/// Calculates the length of an <code>Option<[String]></code> as an <code>Option<[usize]></code>
656+
/// without moving the [`String`]. The [`map`] method takes the `self` argument by value,
657+
/// consuming the original, so this technique uses `as_ref` to first take an `Option` to a
658+
/// reference to the value inside the original.
659659
///
660660
/// [`map`]: Option::map
661661
/// [String]: ../../std/string/struct.String.html "String"
662+
/// [`String`]: ../../std/string/struct.String.html "String"
662663
///
663664
/// ```
664665
/// let text: Option<String> = Some("Hello, world!".to_string());
@@ -946,8 +947,8 @@ impl<T> Option<T> {
946947
///
947948
/// # Examples
948949
///
949-
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming
950-
/// the original:
950+
/// Calculates the length of an <code>Option<[String]></code> as an
951+
/// <code>Option<[usize]></code>, consuming the original:
951952
///
952953
/// [String]: ../../std/string/struct.String.html "String"
953954
/// ```

library/core/src/sync/atomic.rs

+38-2
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,42 @@ impl<T> AtomicPtr<T> {
17861786
// SAFETY: data races are prevented by atomic intrinsics.
17871787
unsafe { atomic_xor(self.p.get(), core::ptr::invalid_mut(val), order).cast() }
17881788
}
1789+
1790+
/// Returns a mutable pointer to the underlying pointer.
1791+
///
1792+
/// Doing non-atomic reads and writes on the resulting integer can be a data race.
1793+
/// This method is mostly useful for FFI, where the function signature may use
1794+
/// `*mut *mut T` instead of `&AtomicPtr<T>`.
1795+
///
1796+
/// Returning an `*mut` pointer from a shared reference to this atomic is safe because the
1797+
/// atomic types work with interior mutability. All modifications of an atomic change the value
1798+
/// through a shared reference, and can do so safely as long as they use atomic operations. Any
1799+
/// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
1800+
/// restriction: operations on it must be atomic.
1801+
///
1802+
/// # Examples
1803+
///
1804+
/// ```ignore (extern-declaration)
1805+
/// #![feature(atomic_mut_ptr)]
1806+
//// use std::sync::atomic::AtomicPtr;
1807+
///
1808+
/// extern "C" {
1809+
/// fn my_atomic_op(arg: *mut *mut u32);
1810+
/// }
1811+
///
1812+
/// let mut value = 17;
1813+
/// let atomic = AtomicPtr::new(&mut value);
1814+
///
1815+
/// // SAFETY: Safe as long as `my_atomic_op` is atomic.
1816+
/// unsafe {
1817+
/// my_atomic_op(atomic.as_mut_ptr());
1818+
/// }
1819+
/// ```
1820+
#[inline]
1821+
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
1822+
pub fn as_mut_ptr(&self) -> *mut *mut T {
1823+
self.p.get()
1824+
}
17891825
}
17901826

17911827
#[cfg(target_has_atomic_load_store = "8")]
@@ -2678,9 +2714,9 @@ macro_rules! atomic_int {
26782714
#[doc = concat!(" fn my_atomic_op(arg: *mut ", stringify!($int_type), ");")]
26792715
/// }
26802716
///
2681-
#[doc = concat!("let mut atomic = ", stringify!($atomic_type), "::new(1);")]
2717+
#[doc = concat!("let atomic = ", stringify!($atomic_type), "::new(1);")]
26822718
///
2683-
// SAFETY: Safe as long as `my_atomic_op` is atomic.
2719+
/// // SAFETY: Safe as long as `my_atomic_op` is atomic.
26842720
/// unsafe {
26852721
/// my_atomic_op(atomic.as_mut_ptr());
26862722
/// }

library/std/src/path.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -3177,33 +3177,33 @@ impl<'a> IntoIterator for &'a Path {
31773177
}
31783178

31793179
macro_rules! impl_cmp {
3180-
($lhs:ty, $rhs: ty) => {
3180+
(<$($life:lifetime),*> $lhs:ty, $rhs: ty) => {
31813181
#[stable(feature = "partialeq_path", since = "1.6.0")]
3182-
impl<'a, 'b> PartialEq<$rhs> for $lhs {
3182+
impl<$($life),*> PartialEq<$rhs> for $lhs {
31833183
#[inline]
31843184
fn eq(&self, other: &$rhs) -> bool {
31853185
<Path as PartialEq>::eq(self, other)
31863186
}
31873187
}
31883188

31893189
#[stable(feature = "partialeq_path", since = "1.6.0")]
3190-
impl<'a, 'b> PartialEq<$lhs> for $rhs {
3190+
impl<$($life),*> PartialEq<$lhs> for $rhs {
31913191
#[inline]
31923192
fn eq(&self, other: &$lhs) -> bool {
31933193
<Path as PartialEq>::eq(self, other)
31943194
}
31953195
}
31963196

31973197
#[stable(feature = "cmp_path", since = "1.8.0")]
3198-
impl<'a, 'b> PartialOrd<$rhs> for $lhs {
3198+
impl<$($life),*> PartialOrd<$rhs> for $lhs {
31993199
#[inline]
32003200
fn partial_cmp(&self, other: &$rhs) -> Option<cmp::Ordering> {
32013201
<Path as PartialOrd>::partial_cmp(self, other)
32023202
}
32033203
}
32043204

32053205
#[stable(feature = "cmp_path", since = "1.8.0")]
3206-
impl<'a, 'b> PartialOrd<$lhs> for $rhs {
3206+
impl<$($life),*> PartialOrd<$lhs> for $rhs {
32073207
#[inline]
32083208
fn partial_cmp(&self, other: &$lhs) -> Option<cmp::Ordering> {
32093209
<Path as PartialOrd>::partial_cmp(self, other)
@@ -3212,40 +3212,40 @@ macro_rules! impl_cmp {
32123212
};
32133213
}
32143214

3215-
impl_cmp!(PathBuf, Path);
3216-
impl_cmp!(PathBuf, &'a Path);
3217-
impl_cmp!(Cow<'a, Path>, Path);
3218-
impl_cmp!(Cow<'a, Path>, &'b Path);
3219-
impl_cmp!(Cow<'a, Path>, PathBuf);
3215+
impl_cmp!(<> PathBuf, Path);
3216+
impl_cmp!(<'a> PathBuf, &'a Path);
3217+
impl_cmp!(<'a> Cow<'a, Path>, Path);
3218+
impl_cmp!(<'a, 'b> Cow<'a, Path>, &'b Path);
3219+
impl_cmp!(<'a> Cow<'a, Path>, PathBuf);
32203220

32213221
macro_rules! impl_cmp_os_str {
3222-
($lhs:ty, $rhs: ty) => {
3222+
(<$($life:lifetime),*> $lhs:ty, $rhs: ty) => {
32233223
#[stable(feature = "cmp_path", since = "1.8.0")]
3224-
impl<'a, 'b> PartialEq<$rhs> for $lhs {
3224+
impl<$($life),*> PartialEq<$rhs> for $lhs {
32253225
#[inline]
32263226
fn eq(&self, other: &$rhs) -> bool {
32273227
<Path as PartialEq>::eq(self, other.as_ref())
32283228
}
32293229
}
32303230

32313231
#[stable(feature = "cmp_path", since = "1.8.0")]
3232-
impl<'a, 'b> PartialEq<$lhs> for $rhs {
3232+
impl<$($life),*> PartialEq<$lhs> for $rhs {
32333233
#[inline]
32343234
fn eq(&self, other: &$lhs) -> bool {
32353235
<Path as PartialEq>::eq(self.as_ref(), other)
32363236
}
32373237
}
32383238

32393239
#[stable(feature = "cmp_path", since = "1.8.0")]
3240-
impl<'a, 'b> PartialOrd<$rhs> for $lhs {
3240+
impl<$($life),*> PartialOrd<$rhs> for $lhs {
32413241
#[inline]
32423242
fn partial_cmp(&self, other: &$rhs) -> Option<cmp::Ordering> {
32433243
<Path as PartialOrd>::partial_cmp(self, other.as_ref())
32443244
}
32453245
}
32463246

32473247
#[stable(feature = "cmp_path", since = "1.8.0")]
3248-
impl<'a, 'b> PartialOrd<$lhs> for $rhs {
3248+
impl<$($life),*> PartialOrd<$lhs> for $rhs {
32493249
#[inline]
32503250
fn partial_cmp(&self, other: &$lhs) -> Option<cmp::Ordering> {
32513251
<Path as PartialOrd>::partial_cmp(self.as_ref(), other)
@@ -3254,20 +3254,20 @@ macro_rules! impl_cmp_os_str {
32543254
};
32553255
}
32563256

3257-
impl_cmp_os_str!(PathBuf, OsStr);
3258-
impl_cmp_os_str!(PathBuf, &'a OsStr);
3259-
impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
3260-
impl_cmp_os_str!(PathBuf, OsString);
3261-
impl_cmp_os_str!(Path, OsStr);
3262-
impl_cmp_os_str!(Path, &'a OsStr);
3263-
impl_cmp_os_str!(Path, Cow<'a, OsStr>);
3264-
impl_cmp_os_str!(Path, OsString);
3265-
impl_cmp_os_str!(&'a Path, OsStr);
3266-
impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
3267-
impl_cmp_os_str!(&'a Path, OsString);
3268-
impl_cmp_os_str!(Cow<'a, Path>, OsStr);
3269-
impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
3270-
impl_cmp_os_str!(Cow<'a, Path>, OsString);
3257+
impl_cmp_os_str!(<> PathBuf, OsStr);
3258+
impl_cmp_os_str!(<'a> PathBuf, &'a OsStr);
3259+
impl_cmp_os_str!(<'a> PathBuf, Cow<'a, OsStr>);
3260+
impl_cmp_os_str!(<> PathBuf, OsString);
3261+
impl_cmp_os_str!(<> Path, OsStr);
3262+
impl_cmp_os_str!(<'a> Path, &'a OsStr);
3263+
impl_cmp_os_str!(<'a> Path, Cow<'a, OsStr>);
3264+
impl_cmp_os_str!(<> Path, OsString);
3265+
impl_cmp_os_str!(<'a> &'a Path, OsStr);
3266+
impl_cmp_os_str!(<'a, 'b> &'a Path, Cow<'b, OsStr>);
3267+
impl_cmp_os_str!(<'a> &'a Path, OsString);
3268+
impl_cmp_os_str!(<'a> Cow<'a, Path>, OsStr);
3269+
impl_cmp_os_str!(<'a, 'b> Cow<'a, Path>, &'b OsStr);
3270+
impl_cmp_os_str!(<'a> Cow<'a, Path>, OsString);
32713271

32723272
#[stable(since = "1.7.0", feature = "strip_prefix")]
32733273
impl fmt::Display for StripPrefixError {

src/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
This directory contains the source code of the rust project, including:
1+
This directory contains some source code for the Rust project, including:
22

3-
- The test suite
43
- The bootstrapping build system
5-
- Various submodules for tools, like cargo, etc.
4+
- Various submodules for tools, like cargo, tidy, etc.
65

76
For more information on how various parts of the compiler work, see the [rustc dev guide].
87

src/ci/docker/host-x86_64/mingw-check/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
4545
python3 ../x.py test --stage 0 src/tools/compiletest && \
4646
python3 ../x.py test --stage 0 core alloc std test proc_macro && \
4747
# Build both public and internal documentation.
48+
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 0 compiler && \
4849
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 0 library/test && \
4950
/scripts/validate-toolstate.sh && \
5051
/scripts/validate-error-codes.sh && \

src/doc/rustdoc/src/lints.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ typo mistakes for some common attributes.
261261

262262
## `invalid_html_tags`
263263

264-
This lint is **allowed by default** and is **nightly-only**. It detects unclosed
264+
This lint **warns by default**. It detects unclosed
265265
or invalid HTML tags. For example:
266266

267267
```rust

0 commit comments

Comments
 (0)