diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index ec2c703ad495d..a2fadb13a5741 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -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 // ------------------------------------------------------------------------- diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 7a51e1e321a2a..a93d18950dba9 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -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! { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 0e30e154ee57c..9551120ca5522 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -893,6 +893,7 @@ symbols! { nomem, non_ascii_idents, non_exhaustive, + non_exhaustive_omitted_patterns_lint, non_modrs_mods, none_error, nontemporal_store, diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 16150ceeb62c1..f4c1010098256 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -534,6 +534,7 @@ impl BTreeSet { /// 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) -> bool where @@ -559,6 +560,7 @@ impl BTreeSet { /// 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) -> bool where @@ -638,6 +640,7 @@ impl BTreeSet { /// 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) -> bool where diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index dd04f782f940a..89ab11fb97e10 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -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" )) )] diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index b3af1f1ffb592..45f7540d314be 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -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] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index e10d01b58b017..7bc641c52767d 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -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", diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index c47a2e8b05c4b..d3dd710f7c05f 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -436,6 +436,7 @@ impl f32 { /// assert!(nan.is_nan()); /// assert!(!f.is_nan()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -467,6 +468,7 @@ impl f32 { /// assert!(inf.is_infinite()); /// assert!(neg_inf.is_infinite()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -488,6 +490,7 @@ impl f32 { /// assert!(!inf.is_finite()); /// assert!(!neg_inf.is_finite()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -515,6 +518,7 @@ impl f32 { /// assert!(lower_than_min.is_subnormal()); /// ``` /// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number + #[must_use] #[stable(feature = "is_subnormal", since = "1.53.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -541,6 +545,7 @@ impl f32 { /// assert!(!lower_than_min.is_normal()); /// ``` /// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -587,6 +592,7 @@ impl f32 { /// assert!(f.is_sign_positive()); /// assert!(!g.is_sign_positive()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -604,6 +610,7 @@ impl f32 { /// assert!(!f.is_sign_negative()); /// assert!(g.is_sign_negative()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index cfcc08b9addeb..233c7b7e8de82 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -435,6 +435,7 @@ impl f64 { /// assert!(nan.is_nan()); /// assert!(!f.is_nan()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -466,6 +467,7 @@ impl f64 { /// assert!(inf.is_infinite()); /// assert!(neg_inf.is_infinite()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -487,6 +489,7 @@ impl f64 { /// assert!(!inf.is_finite()); /// assert!(!neg_inf.is_finite()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -514,6 +517,7 @@ impl f64 { /// assert!(lower_than_min.is_subnormal()); /// ``` /// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number + #[must_use] #[stable(feature = "is_subnormal", since = "1.53.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -540,6 +544,7 @@ impl f64 { /// assert!(!lower_than_min.is_normal()); /// ``` /// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -586,6 +591,7 @@ impl f64 { /// assert!(f.is_sign_positive()); /// assert!(!g.is_sign_positive()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -593,6 +599,7 @@ impl f64 { !self.is_sign_negative() } + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "renamed to is_sign_positive")] #[inline] @@ -611,6 +618,7 @@ impl f64 { /// assert!(!f.is_sign_negative()); /// assert!(g.is_sign_negative()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_float_classify", issue = "72505")] #[inline] @@ -618,6 +626,7 @@ impl f64 { self.to_bits() & 0x8000_0000_0000_0000 != 0 } + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "renamed to is_sign_negative")] #[inline] diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 12dda61400f2a..1eff6f9613019 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2199,7 +2199,8 @@ macro_rules! int_impl { } } - /// Returns the logarithm of the number with respect to an arbitrary base. + /// Returns the logarithm of the number with respect to an arbitrary base, + /// rounded down. /// /// This method might not be optimized owing to implementation details; /// `log2` can produce results more efficiently for base 2, and `log10` @@ -2208,8 +2209,8 @@ macro_rules! int_impl { /// # Panics /// /// When the number is zero, or if the base is not at least 2; it - /// panics in debug mode and the return value is wrapped to 0 in release - /// mode (the only situation in which the method can return 0). + /// panics in debug mode and the return value is 0 in release + /// mode. /// /// # Examples /// @@ -2237,13 +2238,12 @@ macro_rules! int_impl { } } - /// Returns the base 2 logarithm of the number. + /// Returns the base 2 logarithm of the number, rounded down. /// /// # Panics /// /// When the number is zero it panics in debug mode and the return value - /// is wrapped to 0 in release mode (the only situation in which the - /// method can return 0). + /// is 0 in release mode. /// /// # Examples /// @@ -2271,13 +2271,12 @@ macro_rules! int_impl { } } - /// Returns the base 10 logarithm of the number. + /// Returns the base 10 logarithm of the number, rounded down. /// /// # Panics /// /// When the number is zero it panics in debug mode and the return value - /// is wrapped to 0 in release mode (the only situation in which the - /// method can return 0). + /// is 0 in release mode. /// /// # Example /// @@ -2305,7 +2304,8 @@ macro_rules! int_impl { } } - /// Returns the logarithm of the number with respect to an arbitrary base. + /// Returns the logarithm of the number with respect to an arbitrary base, + /// rounded down. /// /// Returns `None` if the number is negative or zero, or if the base is not at least 2. /// @@ -2345,7 +2345,7 @@ macro_rules! int_impl { } } - /// Returns the base 2 logarithm of the number. + /// Returns the base 2 logarithm of the number, rounded down. /// /// Returns `None` if the number is negative or zero. /// @@ -2369,7 +2369,7 @@ macro_rules! int_impl { } } - /// Returns the base 10 logarithm of the number. + /// Returns the base 10 logarithm of the number, rounded down. /// /// Returns `None` if the number is negative or zero. /// @@ -2502,6 +2502,7 @@ macro_rules! int_impl { #[doc = concat!("assert!(10", stringify!($SelfT), ".is_positive());")] #[doc = concat!("assert!(!(-10", stringify!($SelfT), ").is_positive());")] /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")] #[inline(always)] @@ -2518,6 +2519,7 @@ macro_rules! int_impl { #[doc = concat!("assert!((-10", stringify!($SelfT), ").is_negative());")] #[doc = concat!("assert!(!10", stringify!($SelfT), ".is_negative());")] /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")] #[inline(always)] diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 44918a711d470..18ebf1cbb1063 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -259,6 +259,7 @@ impl u8 { /// 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.43.0")] #[inline] @@ -419,6 +420,7 @@ impl u8 { /// 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] @@ -452,6 +454,7 @@ impl u8 { /// 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] @@ -485,6 +488,7 @@ impl u8 { /// 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] @@ -521,6 +525,7 @@ impl u8 { /// 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] @@ -554,6 +559,7 @@ impl u8 { /// 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] @@ -590,6 +596,7 @@ impl u8 { /// 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] @@ -627,6 +634,7 @@ impl u8 { /// 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] @@ -660,6 +668,7 @@ impl u8 { /// 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] @@ -710,6 +719,7 @@ impl u8 { /// 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] @@ -745,6 +755,7 @@ impl u8 { /// 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] diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index e44597279baf2..c1e768655e094 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -878,6 +878,7 @@ macro_rules! nonzero_unsigned_is_power_of_two { #[doc = concat!("let ten = std::num::", stringify!($Ty), "::new(10).unwrap();")] /// assert!(!ten.is_power_of_two()); /// ``` + #[must_use] #[unstable(feature = "nonzero_is_power_of_two", issue = "81106")] #[inline] pub const fn is_power_of_two(self) -> bool { diff --git a/library/core/src/num/saturating.rs b/library/core/src/num/saturating.rs index f6dd3603c4914..af7b9c63fd207 100644 --- a/library/core/src/num/saturating.rs +++ b/library/core/src/num/saturating.rs @@ -847,6 +847,7 @@ macro_rules! saturating_int_impl_signed { #[doc = concat!("assert!(Saturating(10", stringify!($t), ").is_positive());")] #[doc = concat!("assert!(!Saturating(-10", stringify!($t), ").is_positive());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "saturating_int_impl", issue = "87920")] pub const fn is_positive(self) -> bool { @@ -867,6 +868,7 @@ macro_rules! saturating_int_impl_signed { #[doc = concat!("assert!(Saturating(-10", stringify!($t), ").is_negative());")] #[doc = concat!("assert!(!Saturating(10", stringify!($t), ").is_negative());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "saturating_int_impl", issue = "87920")] pub const fn is_negative(self) -> bool { @@ -925,6 +927,7 @@ macro_rules! saturating_int_impl_unsigned { #[doc = concat!("assert!(Saturating(16", stringify!($t), ").is_power_of_two());")] #[doc = concat!("assert!(!Saturating(10", stringify!($t), ").is_power_of_two());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "saturating_int_impl", issue = "87920")] pub fn is_power_of_two(self) -> bool { diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 25cd582bb67d7..8cd5b2c6dc0c1 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -658,7 +658,8 @@ macro_rules! uint_impl { } } - /// Returns the logarithm of the number with respect to an arbitrary base. + /// Returns the logarithm of the number with respect to an arbitrary base, + /// rounded down. /// /// This method might not be optimized owing to implementation details; /// `log2` can produce results more efficiently for base 2, and `log10` @@ -667,8 +668,7 @@ macro_rules! uint_impl { /// # Panics /// /// When the number is negative, zero, or if the base is not at least 2; - /// it panics in debug mode and the return value is wrapped to 0 in - /// release mode (the only situation in which the method can return 0). + /// it panics in debug mode and the return value is 0 in release mode. /// /// # Examples /// @@ -696,13 +696,12 @@ macro_rules! uint_impl { } } - /// Returns the base 2 logarithm of the number. + /// Returns the base 2 logarithm of the number, rounded down. /// /// # Panics /// /// When the number is negative or zero it panics in debug mode and - /// the return value is wrapped to 0 in release mode (the only situation in - /// which the method can return 0). + /// the return value is 0 in release mode. /// /// # Examples /// @@ -730,13 +729,12 @@ macro_rules! uint_impl { } } - /// Returns the base 10 logarithm of the number. + /// Returns the base 10 logarithm of the number, rounded down. /// /// # Panics /// /// When the number is negative or zero it panics in debug mode and the - /// return value is wrapped to 0 in release mode (the only situation in - /// which the method can return 0). + /// return value is 0 in release mode. /// /// # Example /// @@ -764,7 +762,8 @@ macro_rules! uint_impl { } } - /// Returns the logarithm of the number with respect to an arbitrary base. + /// Returns the logarithm of the number with respect to an arbitrary base, + /// rounded down. /// /// Returns `None` if the number is zero, or if the base is not at least 2. /// @@ -804,7 +803,7 @@ macro_rules! uint_impl { } } - /// Returns the base 2 logarithm of the number. + /// Returns the base 2 logarithm of the number, rounded down. /// /// Returns `None` if the number is zero. /// @@ -828,7 +827,7 @@ macro_rules! uint_impl { } } - /// Returns the base 10 logarithm of the number. + /// Returns the base 10 logarithm of the number, rounded down. /// /// Returns `None` if the number is zero. /// @@ -2087,6 +2086,7 @@ macro_rules! uint_impl { #[doc = concat!("assert!(16", stringify!($SelfT), ".is_power_of_two());")] #[doc = concat!("assert!(!10", stringify!($SelfT), ".is_power_of_two());")] /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_is_power_of_two", since = "1.32.0")] #[inline(always)] @@ -2120,7 +2120,7 @@ macro_rules! uint_impl { /// Returns the smallest power of two greater than or equal to `self`. /// /// When return value overflows (i.e., `self > (1 << (N-1))` for type - /// `uN`), it panics in debug mode and return value is wrapped to 0 in + /// `uN`), it panics in debug mode and the return value is wrapped to 0 in /// release mode (the only situation in which method can return 0). /// /// # Examples diff --git a/library/core/src/num/wrapping.rs b/library/core/src/num/wrapping.rs index b078cdf5479d7..beb413bbddca4 100644 --- a/library/core/src/num/wrapping.rs +++ b/library/core/src/num/wrapping.rs @@ -844,6 +844,7 @@ macro_rules! wrapping_int_impl_signed { #[doc = concat!("assert!(Wrapping(10", stringify!($t), ").is_positive());")] #[doc = concat!("assert!(!Wrapping(-10", stringify!($t), ").is_positive());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] pub const fn is_positive(self) -> bool { @@ -864,6 +865,7 @@ macro_rules! wrapping_int_impl_signed { #[doc = concat!("assert!(Wrapping(-10", stringify!($t), ").is_negative());")] #[doc = concat!("assert!(!Wrapping(10", stringify!($t), ").is_negative());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] pub const fn is_negative(self) -> bool { @@ -911,6 +913,7 @@ macro_rules! wrapping_int_impl_unsigned { #[doc = concat!("assert!(Wrapping(16", stringify!($t), ").is_power_of_two());")] #[doc = concat!("assert!(!Wrapping(10", stringify!($t), ").is_power_of_two());")] /// ``` + #[must_use] #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] pub fn is_power_of_two(self) -> bool { diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index f25ab52cfa0d0..b5d151e479f8d 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -188,6 +188,7 @@ impl str { /// // third byte of `老` /// assert!(!s.is_char_boundary(8)); /// ``` + #[must_use] #[stable(feature = "is_char_boundary", since = "1.9.0")] #[inline] pub fn is_char_boundary(&self, index: usize) -> bool { diff --git a/library/core/src/time.rs b/library/core/src/time.rs index d1533b8d67a6b..949a3e68f2b6a 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -291,6 +291,7 @@ impl Duration { /// assert!(!Duration::from_nanos(1).is_zero()); /// assert!(!Duration::from_secs(1).is_zero()); /// ``` + #[must_use] #[stable(feature = "duration_zero", since = "1.53.0")] #[rustc_const_stable(feature = "duration_zero", since = "1.53.0")] #[inline] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 68fbbb22c0898..8594fa42266b4 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -898,7 +898,7 @@ impl Step for RustdocGUI { let out_dir = builder.test_out(self.target).join("rustdoc-gui"); // We remove existing folder to be sure there won't be artifacts remaining. - let _ = fs::remove_dir_all(&out_dir); + builder.clear_if_dirty(&out_dir, &builder.rustdoc(self.compiler)); let src_path = builder.build.src.join("src/test/rustdoc-gui/src"); // We generate docs for the libraries present in the rustdoc-gui's src folder. diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs new file mode 100644 index 0000000000000..2a34ed4d4f644 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs @@ -0,0 +1,31 @@ +#![deny(non_exhaustive_omitted_patterns)] +//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable +//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable +#![allow(non_exhaustive_omitted_patterns)] +//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable +//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable + +fn main() { + enum Foo { + A, B, C, + } + + #[allow(non_exhaustive_omitted_patterns)] + match Foo::A { + Foo::A => {} + Foo::B => {} + } + //~^^^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable + //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable + //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable + //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable + + match Foo::A { + Foo::A => {} + Foo::B => {} + #[warn(non_exhaustive_omitted_patterns)] + _ => {} + } + //~^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable + //~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable +} diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr new file mode 100644 index 0000000000000..691f64cf0addd --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -0,0 +1,93 @@ +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1 + | +LL | #![deny(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1 + | +LL | #![allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5 + | +LL | #[allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5 + | +LL | #[allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9 + | +LL | #[warn(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1 + | +LL | #![deny(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1 + | +LL | #![allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5 + | +LL | #[allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5 + | +LL | #[allow(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9 + | +LL | #[warn(non_exhaustive_omitted_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #89554 for more information + = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable + +error: aborting due to 10 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.rs b/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.rs index c196ded404ddc..ce1b5c7c377a4 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.rs @@ -1,5 +1,7 @@ // Test that the `non_exhaustive_omitted_patterns` lint is triggered correctly. +#![feature(non_exhaustive_omitted_patterns_lint)] + // aux-build:enums.rs extern crate enums; diff --git a/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.stderr index e66fd8008a10b..5b21e0402b192 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/reachable-patterns.stderr @@ -1,11 +1,11 @@ warning: some fields are not explicitly listed - --> $DIR/reachable-patterns.rs:127:9 + --> $DIR/reachable-patterns.rs:129:9 | LL | VariantNonExhaustive::Bar { x, .. } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `y` not listed | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:124:12 + --> $DIR/reachable-patterns.rs:126:12 | LL | #[warn(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,13 +13,13 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: the pattern is of type `VariantNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found warning: some fields are not explicitly listed - --> $DIR/reachable-patterns.rs:132:9 + --> $DIR/reachable-patterns.rs:134:9 | LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalRecord::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `third_field` not listed | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:131:12 + --> $DIR/reachable-patterns.rs:133:12 | LL | #[warn(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,13 +27,13 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: the pattern is of type `FunctionalRecord` and the `non_exhaustive_omitted_patterns` attribute was found warning: some fields are not explicitly listed - --> $DIR/reachable-patterns.rs:140:29 + --> $DIR/reachable-patterns.rs:142:29 | LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `second_field` not listed | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:139:12 + --> $DIR/reachable-patterns.rs:141:12 | LL | #[warn(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: the pattern is of type `NormalStruct` and the `non_exhaustive_omitted_patterns` attribute was found warning: some fields are not explicitly listed - --> $DIR/reachable-patterns.rs:140:9 + --> $DIR/reachable-patterns.rs:142:9 | LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `foo` not listed @@ -50,13 +50,13 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested = note: the pattern is of type `NestedStruct` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:54:9 + --> $DIR/reachable-patterns.rs:56:9 | LL | _ => {} | ^ pattern `Struct { .. }` not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:53:16 + --> $DIR/reachable-patterns.rs:55:16 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -64,13 +64,13 @@ LL | #[deny(non_exhaustive_omitted_patterns)] = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:61:9 + --> $DIR/reachable-patterns.rs:63:9 | LL | _ => {} | ^ pattern `Tuple(_)` not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:60:16 + --> $DIR/reachable-patterns.rs:62:16 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -78,13 +78,13 @@ LL | #[deny(non_exhaustive_omitted_patterns)] = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:71:9 + --> $DIR/reachable-patterns.rs:73:9 | LL | _ => {} | ^ pattern `Unit` not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:70:16 + --> $DIR/reachable-patterns.rs:72:16 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -92,13 +92,13 @@ LL | #[deny(non_exhaustive_omitted_patterns)] = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:88:32 + --> $DIR/reachable-patterns.rs:90:32 | LL | NestedNonExhaustive::A(_) => {} | ^ patterns `Tuple(_)` and `Struct { .. }` not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:85:12 + --> $DIR/reachable-patterns.rs:87:12 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -106,7 +106,7 @@ LL | #[deny(non_exhaustive_omitted_patterns)] = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:90:9 + --> $DIR/reachable-patterns.rs:92:9 | LL | _ => {} | ^ pattern `C` not covered @@ -115,13 +115,13 @@ LL | _ => {} = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:120:9 + --> $DIR/reachable-patterns.rs:122:9 | LL | _ => {} | ^ patterns `HostUnreachable`, `NetworkUnreachable`, `NetworkDown` and 18 more not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:97:12 + --> $DIR/reachable-patterns.rs:99:12 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,13 +129,13 @@ LL | #[deny(non_exhaustive_omitted_patterns)] = note: the matched value is of type `ErrorKind` and the `non_exhaustive_omitted_patterns` attribute was found error: some variants are not matched explicitly - --> $DIR/reachable-patterns.rs:157:9 + --> $DIR/reachable-patterns.rs:159:9 | LL | _ => {} | ^ pattern `A(_)` not covered | note: the lint level is defined here - --> $DIR/reachable-patterns.rs:155:12 + --> $DIR/reachable-patterns.rs:157:12 | LL | #[deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wasm/simd-to-array-80108.rs b/src/test/ui/wasm/simd-to-array-80108.rs new file mode 100644 index 0000000000000..4e44cd01f286e --- /dev/null +++ b/src/test/ui/wasm/simd-to-array-80108.rs @@ -0,0 +1,15 @@ +// only-wasm32 +// build-pass +#![feature(repr_simd)] + +// Regression test for #80108 + + +#[repr(simd)] +pub struct Vector([i32; 4]); + +impl Vector { + pub const fn to_array(self) -> [i32; 4] { + self.0 + } +}