Debian Codegraph @

build/build-rust/stabilize-option-is-none-or-1.82.patch

raw
1 Stabilizes `Option::is_none_or` for our not-quite-Rust-1.82 build for sanitizers.
2
3 This patch is consolidated from [`rust`#129086](https://github.com/rust-lang/rust/pull/129086).
4
5 diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs
6 index 780404212c..d825a47bfd 100644
7 --- a/compiler/rustc_const_eval/src/lib.rs
8 +++ b/compiler/rustc_const_eval/src/lib.rs
9 @@ -6,7 +6,6 @@
10 #![feature(box_patterns)]
11 #![feature(decl_macro)]
12 #![feature(if_let_guard)]
13 -#![feature(is_none_or)]
14 #![feature(let_chains)]
15 #![feature(never_type)]
16 #![feature(rustdoc_internals)]
17 diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs
18 index 758a1cefe6..9ec101196a 100644
19 --- a/compiler/rustc_hir_typeck/src/lib.rs
20 +++ b/compiler/rustc_hir_typeck/src/lib.rs
21 @@ -5,7 +5,6 @@
22 #![feature(box_patterns)]
23 #![feature(control_flow_enum)]
24 #![feature(if_let_guard)]
25 -#![feature(is_none_or)]
26 #![feature(let_chains)]
27 #![feature(never_type)]
28 #![feature(try_blocks)]
29 diff --git a/library/core/src/option.rs b/library/core/src/option.rs
30 index 6c89c81018..9c6819bc58 100644
31 --- a/library/core/src/option.rs
32 +++ b/library/core/src/option.rs
33 @@ -656,8 +656,6 @@
34 /// # Examples
35 ///
36 /// ```
37 - /// #![feature(is_none_or)]
38 - ///
39 /// let x: Option<u32> = Some(2);
40 /// assert_eq!(x.is_none_or(|x| x > 1), true);
41 ///
42 @@ -669,7 +667,7 @@
43 /// ```
44 #[must_use]
45 #[inline]
46 - #[unstable(feature = "is_none_or", issue = "126383")]
47 + #[stable(feature = "is_none_or", since = "CURRENT_RUSTC_VERSION")]
48 pub fn is_none_or(self, f: impl FnOnce(T) -> bool) -> bool {
49 match self {
50 None => true,
51 diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs
52 index 966d38508f..7a11e353f9 100644
53 --- a/src/tools/miri/src/lib.rs
54 +++ b/src/tools/miri/src/lib.rs
55 @@ -12,7 +12,6 @@
56 #![feature(let_chains)]
57 #![feature(trait_upcasting)]
58 #![feature(strict_overflow_ops)]
59 -#![feature(is_none_or)]
60 // Configure clippy and other lints
61 #![allow(
62 clippy::collapsible_else_if,
63 diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
64 index a433ecfd77..f6f90faa4e 100644
65 --- a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
66 +++ b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
67 @@ -1462,7 +1462,7 @@
68 // otherwise, if the arg is equal to the param default, hide it (unless the
69 // default is an error which can happen for the trait Self type)
70 #[allow(unstable_name_collisions)]
71 - default_parameters.get(i).is_none_or(|default_parameter| {
72 + IsNoneOr::is_none_or(default_parameters.get(i), |default_parameter| {
73 // !is_err(default_parameter.skip_binders())
74 // &&
75 arg != &default_parameter.clone().substitute(Interner, &parameters)