Skip to content

Commit 07133ac

Browse files
committed
Auto merge of #59991 - Centril:rollup-bqxt4w3, r=Centril
Rollup of 6 pull requests Successful merges: - #59648 (Add must_use annotations to Result::is_ok and is_err) - #59748 (Add summary and reference to Rust trademark guide) - #59779 (Uplift `get_def_path` from Clippy) - #59955 (bump stdsimd; make intra_doc_link_resolution_failure an error again; make lints more consistent) - #59978 (rustdoc: Remove default keyword from re-exported trait methods) - #59989 (Fix links to Atomic* in RELEASES.md) Failed merges: r? @ghost
2 parents 9217fe0 + 6434fe9 commit 07133ac

File tree

21 files changed

+155
-48
lines changed

21 files changed

+155
-48
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,19 @@ BSD-like licenses.
261261

262262
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
263263
[COPYRIGHT](COPYRIGHT) for details.
264+
265+
## Trademark
266+
[trademark]: #trademark
267+
268+
The Rust programming language is an open source, community project governed
269+
by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
270+
which owns and protects the Rust and Cargo trademarks and logos
271+
(the “Rust Trademarks”).
272+
273+
If you want to use these names or brands, please read the [media guide][media-guide].
274+
275+
Third-party logos may be subject to third-party copyrights and trademarks. See
276+
[Licenses][policies-licenses] for details.
277+
278+
[media-guide]: https://www.rust-lang.org/policies/media-guide
279+
[policies-licenses]: https://www.rust-lang.org/policies/licenses

RELEASES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ Compatibility Notes
113113
[56470]: https://github.com/rust-lang/rust/pull/56470/
114114
[cargo/6654]: https://github.com/rust-lang/cargo/pull/6654/
115115
[`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id
116-
[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id
117-
[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html
118-
[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html
119-
[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html
120-
[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html
121-
[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html
122-
[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html
123-
[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html
124-
[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html
116+
[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#method.type_id
117+
[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI16.html
118+
[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI32.html
119+
[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI64.html
120+
[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI8.html
121+
[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU16.html
122+
[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.html
123+
[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU64.html
124+
[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU8.html
125125
[`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html
126126
[`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
127127
[`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html

src/liballoc/borrow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
3232
/// from any borrow of a given type.
3333
#[stable(feature = "rust1", since = "1.0.0")]
3434
pub trait ToOwned {
35+
/// The resulting type after obtaining ownership.
3536
#[stable(feature = "rust1", since = "1.0.0")]
3637
type Owned: Borrow<Self>;
3738

src/liballoc/boxed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
760760
#[unstable(feature = "fnbox",
761761
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
762762
pub trait FnBox<A>: FnOnce<A> {
763+
/// Performs the call operation.
763764
fn call_box(self: Box<Self>, args: A) -> Self::Output;
764765
}
765766

src/liballoc/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@
5858
#![no_std]
5959
#![needs_allocator]
6060

61-
#![deny(rust_2018_idioms)]
62-
#![allow(explicit_outlives_requirements)]
63-
6461
#![warn(deprecated_in_future)]
65-
#![warn(intra_doc_link_resolution_failure)]
62+
#![warn(missing_docs)]
6663
#![warn(missing_debug_implementations)]
64+
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
65+
66+
#![deny(rust_2018_idioms)]
67+
#![allow(explicit_outlives_requirements)]
6768

6869
#![cfg_attr(not(test), feature(generator_trait))]
6970
#![cfg_attr(test, feature(test))]

src/liballoc/slice.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,16 @@ pub trait SliceConcatExt<T: ?Sized> {
570570
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
571571
fn join(&self, sep: &T) -> Self::Output;
572572

573+
/// Flattens a slice of `T` into a single value `Self::Output`, placing a
574+
/// given separator between each.
575+
///
576+
/// # Examples
577+
///
578+
/// ```
579+
/// # #![allow(deprecated)]
580+
/// assert_eq!(["hello", "world"].connect(" "), "hello world");
581+
/// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
582+
/// ```
573583
#[stable(feature = "rust1", since = "1.0.0")]
574584
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
575585
fn connect(&self, sep: &T) -> Self::Output;

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060

6161
#![warn(deprecated_in_future)]
6262
#![warn(missing_docs)]
63-
#![warn(intra_doc_link_resolution_failure)]
6463
#![warn(missing_debug_implementations)]
64+
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
6565

6666
#![feature(allow_internal_unstable)]
6767
#![feature(arbitrary_self_types)]

src/libcore/option.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ impl<T> Option<T> {
178178
/// ```
179179
///
180180
/// [`Some`]: #variant.Some
181+
#[must_use]
181182
#[inline]
182183
#[stable(feature = "rust1", since = "1.0.0")]
183184
pub fn is_some(&self) -> bool {
@@ -200,6 +201,7 @@ impl<T> Option<T> {
200201
/// ```
201202
///
202203
/// [`None`]: #variant.None
204+
#[must_use]
203205
#[inline]
204206
#[stable(feature = "rust1", since = "1.0.0")]
205207
pub fn is_none(&self) -> bool {

src/libcore/result.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ impl<T, E> Result<T, E> {
277277
/// let x: Result<i32, &str> = Err("Some error message");
278278
/// assert_eq!(x.is_ok(), false);
279279
/// ```
280+
#[must_use]
280281
#[inline]
281282
#[stable(feature = "rust1", since = "1.0.0")]
282283
pub fn is_ok(&self) -> bool {
@@ -301,6 +302,7 @@ impl<T, E> Result<T, E> {
301302
/// let x: Result<i32, &str> = Err("Some error message");
302303
/// assert_eq!(x.is_err(), true);
303304
/// ```
305+
#[must_use]
304306
#[inline]
305307
#[stable(feature = "rust1", since = "1.0.0")]
306308
pub fn is_err(&self) -> bool {

src/librustc/lint/context.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,31 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
755755
}
756756

757757
/// Check if a `DefId`'s path matches the given absolute type path usage.
758+
///
759+
/// # Examples
760+
/// ```rust,ignore (no `cx` or `def_id` available)
761+
/// if cx.match_def_path(def_id, &["core", "option", "Option"]) {
762+
/// // The given `def_id` is that of an `Option` type
763+
/// }
764+
/// ```
758765
// Uplifted from rust-lang/rust-clippy
759-
pub fn match_path(&self, def_id: DefId, path: &[&str]) -> bool {
766+
pub fn match_def_path(&self, def_id: DefId, path: &[&str]) -> bool {
767+
let names = self.get_def_path(def_id);
768+
769+
names.len() == path.len() && names.into_iter().zip(path.iter()).all(|(a, &b)| *a == *b)
770+
}
771+
772+
/// Gets the absolute path of `def_id` as a vector of `&str`.
773+
///
774+
/// # Examples
775+
/// ```rust,ignore (no `cx` or `def_id` available)
776+
/// let def_path = cx.get_def_path(def_id);
777+
/// if let &["core", "option", "Option"] = &def_path[..] {
778+
/// // The given `def_id` is that of an `Option` type
779+
/// }
780+
/// ```
781+
// Uplifted from rust-lang/rust-clippy
782+
pub fn get_def_path(&self, def_id: DefId) -> Vec<LocalInternedString> {
760783
pub struct AbsolutePathPrinter<'a, 'tcx> {
761784
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
762785
}
@@ -856,10 +879,9 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
856879
}
857880
}
858881

859-
let names = AbsolutePathPrinter { tcx: self.tcx }.print_def_path(def_id, &[]).unwrap();
860-
861-
names.len() == path.len()
862-
&& names.into_iter().zip(path.iter()).all(|(a, &b)| *a == *b)
882+
AbsolutePathPrinter { tcx: self.tcx }
883+
.print_def_path(def_id, &[])
884+
.unwrap()
863885
}
864886
}
865887

0 commit comments

Comments
 (0)