Skip to content

Rollup of 11 pull requests #89739

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

Merged
merged 24 commits into from
Oct 10, 2021
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e7faaff
Fix documentation in Cell
joshlf Aug 26, 2021
138ebd1
Improve docs for int_log
Sep 7, 2021
f531b81
docs: `std::hash::Hash` should ensure prefix-free data
pierwill Oct 1, 2021
2a5dcd5
fix: edit description of "prefix-free"
pierwill Oct 1, 2021
d26e192
Don't rebuild GUI test crates every time you run test src/test/rustdo…
GuillaumeGomez Oct 4, 2021
1433878
Add feature gate to non_exhaustive_omitted_patterns lint
DevinR528 Oct 1, 2021
0182566
Cfg hide no_global_oom_handling and no_fp_fmt_parse
nbdd0121 Oct 9, 2021
749194d
Update library/core/src/hash/mod.rs
pierwill Oct 9, 2021
7b5bedf
Fix ABNF of inline asm options
nbdd0121 Oct 9, 2021
475e992
Add #[must_use] to is_condition tests
jkugelman Oct 10, 2021
fec9514
Add #[must_use] to char escape methods
jkugelman Oct 10, 2021
bc9d13e
Add #[must_use] to math and bit manipulation methods
jkugelman Oct 10, 2021
09dd213
Stabilize proc_macro::is_available
bjorn3 Oct 10, 2021
fd5bed7
Rollup merge of #88374 - joshlf:patch-2, r=JohnTitor
matthiaskrgr Oct 10, 2021
4473b94
Rollup merge of #88713 - falk-hueffner:int-log10-documentation-fixes,…
matthiaskrgr Oct 10, 2021
cfa5391
Rollup merge of #89428 - DevinR528:reachable-featuregate, r=Nadrieril…
matthiaskrgr Oct 10, 2021
06cfd0a
Rollup merge of #89438 - pierwill:prefix-free-hash, r=Amanieu
matthiaskrgr Oct 10, 2021
f1d0ce7
Rollup merge of #89520 - GuillaumeGomez:cache-rustdoc-gui-test, r=Mar…
matthiaskrgr Oct 10, 2021
ce6097d
Rollup merge of #89705 - nbdd0121:doc, r=GuillaumeGomez
matthiaskrgr Oct 10, 2021
8aec76c
Rollup merge of #89713 - nbdd0121:doc2, r=Amanieu
matthiaskrgr Oct 10, 2021
0c04b1f
Rollup merge of #89718 - jkugelman:must-use-is_condition-tests, r=jos…
matthiaskrgr Oct 10, 2021
758a901
Rollup merge of #89719 - jkugelman:must-use-char-escape-methods, r=jo…
matthiaskrgr Oct 10, 2021
c8b5a7b
Rollup merge of #89720 - jkugelman:must-use-math-operations, r=joshtr…
matthiaskrgr Oct 10, 2021
4d89488
Rollup merge of #89735 - bjorn3:stabilize_proc_macro_is_available, r=…
matthiaskrgr Oct 10, 2021
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
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
@@ -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
// -------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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)]
@@ -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! {
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -893,6 +893,7 @@ symbols! {
nomem,
non_ascii_idents,
non_exhaustive,
non_exhaustive_omitted_patterns_lint,
non_modrs_mods,
none_error,
nontemporal_store,
3 changes: 3 additions & 0 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
1 change: 1 addition & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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"
))
)]
2 changes: 1 addition & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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)
@@ -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 {
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
12 changes: 12 additions & 0 deletions library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
@@ -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 {
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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",
Loading