Skip to content

Commit

Permalink
Auto merge of rust-lang#89739 - matthiaskrgr:rollup-kskwqy5, r=matthi…
Browse files Browse the repository at this point in the history
…askrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#88374 (Fix documentation in Cell)
 - rust-lang#88713 (Improve docs for int_log)
 - rust-lang#89428 (Feature gate the non_exhaustive_omitted_patterns lint)
 - rust-lang#89438 (docs: `std::hash::Hash` should ensure prefix-free data)
 - rust-lang#89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui)
 - rust-lang#89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse)
 - rust-lang#89713 (Fix ABNF of inline asm options)
 - rust-lang#89718 (Add #[must_use] to is_condition tests)
 - rust-lang#89719 (Add #[must_use] to char escape methods)
 - rust-lang#89720 (Add #[must_use] to math and bit manipulation methods)
 - rust-lang#89735 (Stabilize proc_macro::is_available)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Oct 10, 2021
2 parents 68dfa07 + 4d89488 commit 41dfaaa
Show file tree
Hide file tree
Showing 28 changed files with 518 additions and 71 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ declare_features! (
/// Allows `#[doc(cfg_hide(...))]`.
(active, doc_cfg_hide, "1.57.0", Some(43781), None),

/// Allows using the `non_exhaustive_omitted_patterns` lint.
(active, non_exhaustive_omitted_patterns_lint, "1.57.0", Some(89554), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
use rustc_span::edition::Edition;
use rustc_span::symbol::sym;

declare_lint! {
/// The `forbidden_lint_groups` lint detects violations of
Expand Down Expand Up @@ -3476,6 +3477,8 @@ declare_lint! {
/// }
///
/// // in crate B
/// #![feature(non_exhaustive_omitted_patterns_lint)]
///
/// match Bar::A {
/// Bar::A => {},
/// #[warn(non_exhaustive_omitted_patterns)]
Expand Down Expand Up @@ -3512,6 +3515,7 @@ declare_lint! {
pub NON_EXHAUSTIVE_OMITTED_PATTERNS,
Allow,
"detect when patterns of types marked `non_exhaustive` are missed",
@feature_gate = sym::non_exhaustive_omitted_patterns_lint;
}

declare_lint! {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ symbols! {
nomem,
non_ascii_idents,
non_exhaustive,
non_exhaustive_omitted_patterns_lint,
non_modrs_mods,
none_error,
nontemporal_store,
Expand Down
3 changes: 3 additions & 0 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ impl<T> BTreeSet<T> {
/// b.insert(1);
/// assert_eq!(a.is_disjoint(&b), false);
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_disjoint(&self, other: &BTreeSet<T>) -> bool
where
Expand All @@ -559,6 +560,7 @@ impl<T> BTreeSet<T> {
/// set.insert(4);
/// assert_eq!(set.is_subset(&sup), false);
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_subset(&self, other: &BTreeSet<T>) -> bool
where
Expand Down Expand Up @@ -638,6 +640,7 @@ impl<T> BTreeSet<T> {
/// set.insert(2);
/// assert_eq!(set.is_superset(&sub), true);
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_superset(&self, other: &BTreeSet<T>) -> bool
where
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
not(test),
not(any(test, bootstrap)),
any(not(feature = "miri-test-libstd"), test, doctest),
no_global_oom_handling,
target_has_atomic = "ptr"
))
)]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl<T> Cell<T> {
drop(old);
}

/// Swaps the values of two Cells.
/// Swaps the values of two `Cell`s.
/// Difference with `std::mem::swap` is that this function doesn't require `&mut` reference.
///
/// # Examples
Expand Down
25 changes: 25 additions & 0 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ impl char {
/// ```
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
/// ```
#[must_use = "this returns the escaped char as an iterator, \
without modifying the original"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn escape_unicode(self) -> EscapeUnicode {
Expand Down Expand Up @@ -453,6 +455,8 @@ impl char {
/// ```
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
/// ```
#[must_use = "this returns the escaped char as an iterator, \
without modifying the original"]
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[inline]
pub fn escape_debug(self) -> EscapeDebug {
Expand Down Expand Up @@ -507,6 +511,8 @@ impl char {
/// ```
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
/// ```
#[must_use = "this returns the escaped char as an iterator, \
without modifying the original"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn escape_default(self) -> EscapeDefault {
Expand Down Expand Up @@ -692,6 +698,7 @@ impl char {
/// // love is many things, but it is not alphabetic
/// assert!(!c.is_alphabetic());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_alphabetic(self) -> bool {
Expand Down Expand Up @@ -724,6 +731,7 @@ impl char {
/// assert!(!'中'.is_lowercase());
/// assert!(!' '.is_lowercase());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_lowercase(self) -> bool {
Expand Down Expand Up @@ -756,6 +764,7 @@ impl char {
/// assert!(!'中'.is_uppercase());
/// assert!(!' '.is_uppercase());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_uppercase(self) -> bool {
Expand Down Expand Up @@ -784,6 +793,7 @@ impl char {
///
/// assert!(!'越'.is_whitespace());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_whitespace(self) -> bool {
Expand Down Expand Up @@ -812,6 +822,7 @@ impl char {
/// assert!('و'.is_alphanumeric());
/// assert!('藏'.is_alphanumeric());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_alphanumeric(self) -> bool {
Expand All @@ -837,6 +848,7 @@ impl char {
/// assert!('œ'.is_control());
/// assert!(!'q'.is_control());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_control(self) -> bool {
Expand All @@ -852,6 +864,7 @@ impl char {
/// [uax29]: https://www.unicode.org/reports/tr29/
/// [ucd]: https://www.unicode.org/reports/tr44/
/// [`DerivedCoreProperties.txt`]: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
#[must_use]
#[inline]
pub(crate) fn is_grapheme_extended(self) -> bool {
unicode::Grapheme_Extend(self)
Expand Down Expand Up @@ -881,6 +894,7 @@ impl char {
/// assert!(!'و'.is_numeric());
/// assert!(!'藏'.is_numeric());
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_numeric(self) -> bool {
Expand Down Expand Up @@ -1060,6 +1074,7 @@ impl char {
/// assert!(ascii.is_ascii());
/// assert!(!non_ascii.is_ascii());
/// ```
#[must_use]
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.32.0")]
#[inline]
Expand Down Expand Up @@ -1237,6 +1252,7 @@ impl char {
/// assert!(!lf.is_ascii_alphabetic());
/// assert!(!esc.is_ascii_alphabetic());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1270,6 +1286,7 @@ impl char {
/// assert!(!lf.is_ascii_uppercase());
/// assert!(!esc.is_ascii_uppercase());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1303,6 +1320,7 @@ impl char {
/// assert!(!lf.is_ascii_lowercase());
/// assert!(!esc.is_ascii_lowercase());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1339,6 +1357,7 @@ impl char {
/// assert!(!lf.is_ascii_alphanumeric());
/// assert!(!esc.is_ascii_alphanumeric());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1372,6 +1391,7 @@ impl char {
/// assert!(!lf.is_ascii_digit());
/// assert!(!esc.is_ascii_digit());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1408,6 +1428,7 @@ impl char {
/// assert!(!lf.is_ascii_hexdigit());
/// assert!(!esc.is_ascii_hexdigit());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1445,6 +1466,7 @@ impl char {
/// assert!(!lf.is_ascii_punctuation());
/// assert!(!esc.is_ascii_punctuation());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1478,6 +1500,7 @@ impl char {
/// assert!(!lf.is_ascii_graphic());
/// assert!(!esc.is_ascii_graphic());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1528,6 +1551,7 @@ impl char {
/// assert!(lf.is_ascii_whitespace());
/// assert!(!esc.is_ascii_whitespace());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down Expand Up @@ -1563,6 +1587,7 @@ impl char {
/// assert!(lf.is_ascii_control());
/// assert!(esc.is_ascii_control());
/// ```
#[must_use]
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
#[inline]
Expand Down
12 changes: 12 additions & 0 deletions library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,21 @@ mod sip;
/// Thankfully, you won't need to worry about upholding this property when
/// deriving both [`Eq`] and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
///
/// ## Prefix collisions
///
/// Implementations of `hash` should ensure that the data they
/// pass to the `Hasher` are prefix-free. That is,
/// unequal values should cause two different sequences of values to be written,
/// and neither of the two sequences should be a prefix of the other.
///
/// For example, the standard implementation of [`Hash` for `&str`][impl] passes an extra
/// `0xFF` byte to the `Hasher` so that the values `("ab", "c")` and `("a",
/// "bc")` hash differently.
///
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
/// [`hash`]: Hash::hash
/// [impl]: ../../std/primitive.str.html#impl-Hash
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Hash"]
pub trait Hash {
Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
doc(cfg_hide(
not(test),
any(not(feature = "miri-test-libstd"), test, doctest),
no_fp_fmt_parse,
target_pointer_width = "16",
target_pointer_width = "32",
target_pointer_width = "64",
Expand Down
Loading

0 comments on commit 41dfaaa

Please sign in to comment.