Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #106833

Merged
merged 29 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
74e7709
reword Option::as_ref and Option::map examples
zacklukem Nov 26, 2022
123e203
add link for string to as_ref docs
zacklukem Nov 27, 2022
c466be0
Added error documentation for write_fmt
alexs-sh Dec 2, 2022
6dd1086
rustdoc: fix outdated lint section of the book
notriddle Jan 8, 2023
1300c8d
Check compiler docs in PR CI
albertlarsan68 Jan 10, 2023
1a87ed9
mv binary_heap.rs binary_heap/mod.rs
eggyal Jan 10, 2023
bb60a76
Remove duplicate sha-1 dependency
ehuss Jan 10, 2023
a513c84
Add `AtomicPtr::as_mut_ptr`
WaffleLapkin Jan 12, 2023
f1a63bc
Remove unused `mut` from a doctest
WaffleLapkin Jan 12, 2023
22b4c68
Make `// SAFETY` comment part of the doctest, and not surrounding code
WaffleLapkin Jan 12, 2023
0482a48
Remove dead code in rustdoc stripper
GuillaumeGomez Jan 12, 2023
4949fb0
Stop having unused lifetimes on some `impl`s
scottmcm Jan 13, 2023
184057b
Remove stale reference to the test suite location
albertlarsan68 Jan 12, 2023
39b90a5
rustdoc: remove unnecessary DOM class `h1.fqn`
notriddle Jan 13, 2023
1d328de
rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-t…
notriddle Jan 10, 2023
496edf9
Update `rental` hack to work with remapped paths.
TimNN Jan 6, 2023
6702f20
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
Jan 14, 2023
6d8ac83
Rollup merge of #105172 - alexs-sh:issue-98861-fix-next, r=scottmcm
Jan 14, 2023
b6b4429
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=Gu…
Jan 14, 2023
233169f
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-…
Jan 14, 2023
feac18c
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs…
Jan 14, 2023
1584667
Rollup merge of #106693 - notriddle:notriddle/toggle-trunc, r=Guillau…
Jan 14, 2023
6486b02
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
Jan 14, 2023
9b502a4
Rollup merge of #106762 - WaffleLapkin:atomicptr+as_mut_ptr, r=m-ou-se
Jan 14, 2023
96d4d49
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=not…
Jan 14, 2023
5ff2867
Rollup merge of #106775 - albertlarsan68:patch-1, r=Mark-Simulacrum
Jan 14, 2023
a05d06f
Rollup merge of #106799 - scottmcm:remove-unused-generics, r=cuviper
Jan 14, 2023
7d02116
Rollup merge of #106816 - TimNN:rental-remap, r=oli-obj
Jan 14, 2023
caa1d47
Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeG…
Jan 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3013,29 +3013,29 @@ dependencies = [

[[package]]
name = "pest"
version = "2.3.0"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4"
checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4"
dependencies = [
"thiserror",
"ucd-trie",
]

[[package]]
name = "pest_derive"
version = "2.3.0"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "905708f7f674518498c1f8d644481440f476d39ca6ecae83319bba7c6c12da91"
checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603"
dependencies = [
"pest",
"pest_generator",
]

[[package]]
name = "pest_generator"
version = "2.3.0"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5803d8284a629cc999094ecd630f55e91b561a1d1ba75e233b00ae13b91a69ad"
checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7"
dependencies = [
"pest",
"pest_meta",
Expand All @@ -3046,13 +3046,13 @@ dependencies = [

[[package]]
name = "pest_meta"
version = "2.3.0"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1538eb784f07615c6d9a8ab061089c6c54a344c5b4301db51990ca1c241e8c04"
checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065"
dependencies = [
"once_cell",
"pest",
"sha-1",
"sha1",
]

[[package]]
Expand Down Expand Up @@ -4684,7 +4684,7 @@ dependencies = [
"rustc_macros",
"rustc_serialize",
"scoped-tls",
"sha-1",
"sha1",
"sha2",
"tracing",
"unicode-width",
Expand Down Expand Up @@ -5093,17 +5093,6 @@ dependencies = [
"serde",
]

[[package]]
name = "sha-1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]

[[package]]
name = "sha1"
version = "0.10.5"
Expand Down Expand Up @@ -5529,18 +5518,18 @@ checksum = "ceb05e71730d396f960f8f3901cdb41be2d339b303e9d7d3a07c5ff0536e671b"

[[package]]
name = "thiserror"
version = "1.0.33"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]

[[package]]
name = "thiserror-impl"
version = "1.0.33"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
Expand Down Expand Up @@ -5821,9 +5810,9 @@ dependencies = [

[[package]]
name = "ucd-trie"
version = "0.1.3"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"

[[package]]
name = "ui_test"
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ use rustc_span::edition::Edition;
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP};
use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
use smallvec::{smallvec, SmallVec};

use std::iter;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::rc::Rc;

pub(crate) use rustc_span::hygiene::MacroKind;
Expand Down Expand Up @@ -1423,8 +1423,10 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
if let [variant] = &*enum_def.variants {
if variant.ident.name == sym::Input {
let filename = sess.source_map().span_to_filename(item.ident.span);
if let FileName::Real(RealFileName::LocalPath(path)) = filename {
if let Some(c) = path
if let FileName::Real(real) = filename {
if let Some(c) = real
.local_path()
.unwrap_or(Path::new(""))
.components()
.flat_map(|c| c.as_os_str().to_str())
.find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental"))
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ scoped-tls = "1.0"
unicode-width = "0.1.4"
cfg-if = "1.0"
tracing = "0.1"
sha1 = { package = "sha-1", version = "0.10.0" }
sha1 = "0.10.0"
sha2 = "0.10.1"
md5 = { package = "md-5", version = "0.10.0" }
5 changes: 5 additions & 0 deletions library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ pub trait Write {
/// This method should generally not be invoked manually, but rather through
/// the [`write!`] macro itself.
///
/// # Errors
///
/// This function will return an instance of [`Error`] on error. Please see
/// [write_str](Write::write_str) for details.
///
/// # Examples
///
/// ```
Expand Down
13 changes: 7 additions & 6 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,14 @@ impl<T> Option<T> {
///
/// # Examples
///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving
/// the original. The [`map`] method takes the `self` argument by value, consuming the original,
/// so this technique uses `as_ref` to first take an `Option` to a reference
/// to the value inside the original.
/// Calculates the length of an <code>Option<[String]></code> as an <code>Option<[usize]></code>
/// without moving the [`String`]. The [`map`] method takes the `self` argument by value,
/// consuming the original, so this technique uses `as_ref` to first take an `Option` to a
/// reference to the value inside the original.
///
/// [`map`]: Option::map
/// [String]: ../../std/string/struct.String.html "String"
/// [`String`]: ../../std/string/struct.String.html "String"
///
/// ```
/// let text: Option<String> = Some("Hello, world!".to_string());
Expand Down Expand Up @@ -946,8 +947,8 @@ impl<T> Option<T> {
///
/// # Examples
///
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming
/// the original:
/// Calculates the length of an <code>Option<[String]></code> as an
/// <code>Option<[usize]></code>, consuming the original:
///
/// [String]: ../../std/string/struct.String.html "String"
/// ```
Expand Down
40 changes: 38 additions & 2 deletions library/core/src/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,42 @@ impl<T> AtomicPtr<T> {
// SAFETY: data races are prevented by atomic intrinsics.
unsafe { atomic_xor(self.p.get(), core::ptr::invalid_mut(val), order).cast() }
}

/// Returns a mutable pointer to the underlying pointer.
///
/// Doing non-atomic reads and writes on the resulting integer can be a data race.
/// This method is mostly useful for FFI, where the function signature may use
/// `*mut *mut T` instead of `&AtomicPtr<T>`.
///
/// Returning an `*mut` pointer from a shared reference to this atomic is safe because the
/// atomic types work with interior mutability. All modifications of an atomic change the value
/// through a shared reference, and can do so safely as long as they use atomic operations. Any
/// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same
/// restriction: operations on it must be atomic.
///
/// # Examples
///
/// ```ignore (extern-declaration)
/// #![feature(atomic_mut_ptr)]
//// use std::sync::atomic::AtomicPtr;
///
/// extern "C" {
/// fn my_atomic_op(arg: *mut *mut u32);
/// }
///
/// let mut value = 17;
/// let atomic = AtomicPtr::new(&mut value);
///
/// // SAFETY: Safe as long as `my_atomic_op` is atomic.
/// unsafe {
/// my_atomic_op(atomic.as_mut_ptr());
/// }
/// ```
#[inline]
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
pub fn as_mut_ptr(&self) -> *mut *mut T {
self.p.get()
}
}

#[cfg(target_has_atomic_load_store = "8")]
Expand Down Expand Up @@ -2678,9 +2714,9 @@ macro_rules! atomic_int {
#[doc = concat!(" fn my_atomic_op(arg: *mut ", stringify!($int_type), ");")]
/// }
///
#[doc = concat!("let mut atomic = ", stringify!($atomic_type), "::new(1);")]
#[doc = concat!("let atomic = ", stringify!($atomic_type), "::new(1);")]
///
// SAFETY: Safe as long as `my_atomic_op` is atomic.
/// // SAFETY: Safe as long as `my_atomic_op` is atomic.
/// unsafe {
/// my_atomic_op(atomic.as_mut_ptr());
/// }
Expand Down
58 changes: 29 additions & 29 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3177,33 +3177,33 @@ impl<'a> IntoIterator for &'a Path {
}

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

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

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

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

impl_cmp!(PathBuf, Path);
impl_cmp!(PathBuf, &'a Path);
impl_cmp!(Cow<'a, Path>, Path);
impl_cmp!(Cow<'a, Path>, &'b Path);
impl_cmp!(Cow<'a, Path>, PathBuf);
impl_cmp!(<> PathBuf, Path);
impl_cmp!(<'a> PathBuf, &'a Path);
impl_cmp!(<'a> Cow<'a, Path>, Path);
impl_cmp!(<'a, 'b> Cow<'a, Path>, &'b Path);
impl_cmp!(<'a> Cow<'a, Path>, PathBuf);

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

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

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

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

impl_cmp_os_str!(PathBuf, OsStr);
impl_cmp_os_str!(PathBuf, &'a OsStr);
impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
impl_cmp_os_str!(PathBuf, OsString);
impl_cmp_os_str!(Path, OsStr);
impl_cmp_os_str!(Path, &'a OsStr);
impl_cmp_os_str!(Path, Cow<'a, OsStr>);
impl_cmp_os_str!(Path, OsString);
impl_cmp_os_str!(&'a Path, OsStr);
impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
impl_cmp_os_str!(&'a Path, OsString);
impl_cmp_os_str!(Cow<'a, Path>, OsStr);
impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
impl_cmp_os_str!(Cow<'a, Path>, OsString);
impl_cmp_os_str!(<> PathBuf, OsStr);
impl_cmp_os_str!(<'a> PathBuf, &'a OsStr);
impl_cmp_os_str!(<'a> PathBuf, Cow<'a, OsStr>);
impl_cmp_os_str!(<> PathBuf, OsString);
impl_cmp_os_str!(<> Path, OsStr);
impl_cmp_os_str!(<'a> Path, &'a OsStr);
impl_cmp_os_str!(<'a> Path, Cow<'a, OsStr>);
impl_cmp_os_str!(<> Path, OsString);
impl_cmp_os_str!(<'a> &'a Path, OsStr);
impl_cmp_os_str!(<'a, 'b> &'a Path, Cow<'b, OsStr>);
impl_cmp_os_str!(<'a> &'a Path, OsString);
impl_cmp_os_str!(<'a> Cow<'a, Path>, OsStr);
impl_cmp_os_str!(<'a, 'b> Cow<'a, Path>, &'b OsStr);
impl_cmp_os_str!(<'a> Cow<'a, Path>, OsString);

#[stable(since = "1.7.0", feature = "strip_prefix")]
impl fmt::Display for StripPrefixError {
Expand Down
5 changes: 2 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
This directory contains the source code of the rust project, including:
This directory contains some source code for the Rust project, including:

- The test suite
- The bootstrapping build system
- Various submodules for tools, like cargo, etc.
- Various submodules for tools, like cargo, tidy, etc.

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

Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/mingw-check/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
python3 ../x.py test --stage 0 src/tools/compiletest && \
python3 ../x.py test --stage 0 core alloc std test proc_macro && \
# Build both public and internal documentation.
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 0 compiler && \
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 0 library/test && \
/scripts/validate-toolstate.sh && \
/scripts/validate-error-codes.sh && \
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ typo mistakes for some common attributes.

## `invalid_html_tags`

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

```rust
Expand Down
Loading