| author | bors <bors@rust-lang.org> 2025-12-24 09:31:51 UTC |
| committer | bors <bors@rust-lang.org> 2025-12-24 09:31:51 UTC |
| log | c4aa646f15e40bd3e64ddb5017b7b89b3646ac99 |
| tree | 06667b695a4299158d5f84c9bc0f19e44810f5a6 |
| parent | efa32de15b394620520f24781d8c55d4df6fa106 |
| parent | f9e3c618b806c41a4d7bd61200e7787336b244d6 |
Rollup of 3 pull requests
Successful merges:
- rust-lang/rust#150016 (stabilize `lazy_get`)
- rust-lang/rust#150139 (Correct terminology in Clone)
- rust-lang/rust#150238 (mir_build: Classify `TestableCase::Constant` into multiple sub-kinds)
r? `@ghost`
`@rustbot` modify labels: rollup16 files changed, 141 insertions(+), 102 deletions(-)
compiler/rustc_mir_build/src/builder/matches/buckets.rs+20-10| ... | ... | @@ -6,8 +6,7 @@ use rustc_middle::span_bug; |
| 6 | 6 | use tracing::debug; |
| 7 | 7 | |
| 8 | 8 | use crate::builder::Builder; |
| 9 | use crate::builder::matches::test::is_switch_ty; | |
| 10 | use crate::builder::matches::{Candidate, Test, TestBranch, TestKind, TestableCase}; | |
| 9 | use crate::builder::matches::{Candidate, PatConstKind, Test, TestBranch, TestKind, TestableCase}; | |
| 11 | 10 | |
| 12 | 11 | /// Output of [`Builder::partition_candidates_into_buckets`]. |
| 13 | 12 | pub(crate) struct PartitionedCandidates<'tcx, 'b, 'c> { |
| ... | ... | @@ -157,11 +156,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 157 | 156 | // |
| 158 | 157 | // FIXME(#29623) we could use PatKind::Range to rule |
| 159 | 158 | // things out here, in some cases. |
| 160 | // | |
| 161 | // FIXME(Zalathar): Is the `is_switch_ty` test unnecessary? | |
| 162 | (TestKind::SwitchInt, &TestableCase::Constant { value }) | |
| 163 | if is_switch_ty(match_pair.pattern_ty) => | |
| 164 | { | |
| 159 | ( | |
| 160 | TestKind::SwitchInt, | |
| 161 | &TestableCase::Constant { value, kind: PatConstKind::IntOrChar }, | |
| 162 | ) => { | |
| 165 | 163 | // An important invariant of candidate bucketing is that a candidate |
| 166 | 164 | // must not match in multiple branches. For `SwitchInt` tests, adding |
| 167 | 165 | // a new value might invalidate that property for range patterns that |
| ... | ... | @@ -206,7 +204,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 206 | 204 | }) |
| 207 | 205 | } |
| 208 | 206 | |
| 209 | (TestKind::If, TestableCase::Constant { value }) => { | |
| 207 | (TestKind::If, TestableCase::Constant { value, kind: PatConstKind::Bool }) => { | |
| 210 | 208 | fully_matched = true; |
| 211 | 209 | let value = value.try_to_bool().unwrap_or_else(|| { |
| 212 | 210 | span_bug!(test.span, "expected boolean value but got {value:?}") |
| ... | ... | @@ -291,7 +289,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 291 | 289 | if !test.overlaps(pat, self.tcx)? { Some(TestBranch::Failure) } else { None } |
| 292 | 290 | } |
| 293 | 291 | } |
| 294 | (TestKind::Range(range), &TestableCase::Constant { value }) => { | |
| 292 | ( | |
| 293 | TestKind::Range(range), | |
| 294 | &TestableCase::Constant { | |
| 295 | value, | |
| 296 | kind: PatConstKind::Bool | PatConstKind::IntOrChar | PatConstKind::Float, | |
| 297 | }, | |
| 298 | ) => { | |
| 295 | 299 | fully_matched = false; |
| 296 | 300 | if !range.contains(value, self.tcx)? { |
| 297 | 301 | // `value` is not contained in the testing range, |
| ... | ... | @@ -302,7 +306,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 302 | 306 | } |
| 303 | 307 | } |
| 304 | 308 | |
| 305 | (TestKind::Eq { value: test_val, .. }, TestableCase::Constant { value: case_val }) => { | |
| 309 | ( | |
| 310 | TestKind::Eq { value: test_val, .. }, | |
| 311 | TestableCase::Constant { | |
| 312 | value: case_val, | |
| 313 | kind: PatConstKind::Float | PatConstKind::Other, | |
| 314 | }, | |
| 315 | ) => { | |
| 306 | 316 | if test_val == case_val { |
| 307 | 317 | fully_matched = true; |
| 308 | 318 | Some(TestBranch::Success) |
compiler/rustc_mir_build/src/builder/matches/match_pair.rs+26-2| ... | ... | @@ -7,7 +7,9 @@ use rustc_middle::ty::{self, Ty, TypeVisitableExt}; |
| 7 | 7 | |
| 8 | 8 | use crate::builder::Builder; |
| 9 | 9 | use crate::builder::expr::as_place::{PlaceBase, PlaceBuilder}; |
| 10 | use crate::builder::matches::{FlatPat, MatchPairTree, PatternExtraData, TestableCase}; | |
| 10 | use crate::builder::matches::{ | |
| 11 | FlatPat, MatchPairTree, PatConstKind, PatternExtraData, TestableCase, | |
| 12 | }; | |
| 11 | 13 | |
| 12 | 14 | impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 13 | 15 | /// Builds and pushes [`MatchPairTree`] subtrees, one for each pattern in |
| ... | ... | @@ -156,7 +158,29 @@ impl<'tcx> MatchPairTree<'tcx> { |
| 156 | 158 | } |
| 157 | 159 | } |
| 158 | 160 | |
| 159 | PatKind::Constant { value } => Some(TestableCase::Constant { value }), | |
| 161 | PatKind::Constant { value } => { | |
| 162 | // CAUTION: The type of the pattern node (`pattern.ty`) is | |
| 163 | // _often_ the same as the type of the const value (`value.ty`), | |
| 164 | // but there are some cases where those types differ | |
| 165 | // (e.g. when `deref!(..)` patterns interact with `String`). | |
| 166 | ||
| 167 | // Classify the constant-pattern into further kinds, to | |
| 168 | // reduce the number of ad-hoc type tests needed later on. | |
| 169 | let pat_ty = pattern.ty; | |
| 170 | let const_kind = if pat_ty.is_bool() { | |
| 171 | PatConstKind::Bool | |
| 172 | } else if pat_ty.is_integral() || pat_ty.is_char() { | |
| 173 | PatConstKind::IntOrChar | |
| 174 | } else if pat_ty.is_floating_point() { | |
| 175 | PatConstKind::Float | |
| 176 | } else { | |
| 177 | // FIXME(Zalathar): This still covers several different | |
| 178 | // categories (e.g. raw pointer, string, pattern-type) | |
| 179 | // which could be split out into their own kinds. | |
| 180 | PatConstKind::Other | |
| 181 | }; | |
| 182 | Some(TestableCase::Constant { value, kind: const_kind }) | |
| 183 | } | |
| 160 | 184 | |
| 161 | 185 | PatKind::AscribeUserType { |
| 162 | 186 | ascription: Ascription { ref annotation, variance }, |
compiler/rustc_mir_build/src/builder/matches/mod.rs+23-1| ... | ... | @@ -1262,7 +1262,7 @@ struct Ascription<'tcx> { |
| 1262 | 1262 | #[derive(Debug, Clone)] |
| 1263 | 1263 | enum TestableCase<'tcx> { |
| 1264 | 1264 | Variant { adt_def: ty::AdtDef<'tcx>, variant_index: VariantIdx }, |
| 1265 | Constant { value: ty::Value<'tcx> }, | |
| 1265 | Constant { value: ty::Value<'tcx>, kind: PatConstKind }, | |
| 1266 | 1266 | Range(Arc<PatRange<'tcx>>), |
| 1267 | 1267 | Slice { len: u64, variable_length: bool }, |
| 1268 | 1268 | Deref { temp: Place<'tcx>, mutability: Mutability }, |
| ... | ... | @@ -1276,6 +1276,28 @@ impl<'tcx> TestableCase<'tcx> { |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | /// Sub-classification of [`TestableCase::Constant`], which helps to avoid | |
| 1280 | /// some redundant ad-hoc checks when preparing and lowering tests. | |
| 1281 | #[derive(Debug, Clone)] | |
| 1282 | enum PatConstKind { | |
| 1283 | /// The primitive `bool` type, which is like an integer but simpler, | |
| 1284 | /// having only two values. | |
| 1285 | Bool, | |
| 1286 | /// Primitive unsigned/signed integer types, plus `char`. | |
| 1287 | /// These types interact nicely with `SwitchInt`. | |
| 1288 | IntOrChar, | |
| 1289 | /// Floating-point primitives, e.g. `f32`, `f64`. | |
| 1290 | /// These types don't support `SwitchInt` and require an equality test, | |
| 1291 | /// but can also interact with range pattern tests. | |
| 1292 | Float, | |
| 1293 | /// Any other constant-pattern is usually tested via some kind of equality | |
| 1294 | /// check. Types that might be encountered here include: | |
| 1295 | /// - `&str` | |
| 1296 | /// - raw pointers derived from integer values | |
| 1297 | /// - pattern types, e.g. `pattern_type!(u32 is 1..)` | |
| 1298 | Other, | |
| 1299 | } | |
| 1300 | ||
| 1279 | 1301 | /// Node in a tree of "match pairs", where each pair consists of a place to be |
| 1280 | 1302 | /// tested, and a test to perform on that place. |
| 1281 | 1303 | /// |
compiler/rustc_mir_build/src/builder/matches/test.rs+9-9| ... | ... | @@ -19,7 +19,9 @@ use rustc_span::{DUMMY_SP, Span, Symbol, sym}; |
| 19 | 19 | use tracing::{debug, instrument}; |
| 20 | 20 | |
| 21 | 21 | use crate::builder::Builder; |
| 22 | use crate::builder::matches::{MatchPairTree, Test, TestBranch, TestKind, TestableCase}; | |
| 22 | use crate::builder::matches::{ | |
| 23 | MatchPairTree, PatConstKind, Test, TestBranch, TestKind, TestableCase, | |
| 24 | }; | |
| 23 | 25 | |
| 24 | 26 | impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 25 | 27 | /// Identifies what test is needed to decide if `match_pair` is applicable. |
| ... | ... | @@ -32,11 +34,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 32 | 34 | let kind = match match_pair.testable_case { |
| 33 | 35 | TestableCase::Variant { adt_def, variant_index: _ } => TestKind::Switch { adt_def }, |
| 34 | 36 | |
| 35 | TestableCase::Constant { .. } if match_pair.pattern_ty.is_bool() => TestKind::If, | |
| 36 | TestableCase::Constant { .. } if is_switch_ty(match_pair.pattern_ty) => { | |
| 37 | TestableCase::Constant { value: _, kind: PatConstKind::Bool } => TestKind::If, | |
| 38 | TestableCase::Constant { value: _, kind: PatConstKind::IntOrChar } => { | |
| 37 | 39 | TestKind::SwitchInt |
| 38 | 40 | } |
| 39 | TestableCase::Constant { value } => { | |
| 41 | TestableCase::Constant { value, kind: PatConstKind::Float } => { | |
| 42 | TestKind::Eq { value, cast_ty: match_pair.pattern_ty } | |
| 43 | } | |
| 44 | TestableCase::Constant { value, kind: PatConstKind::Other } => { | |
| 40 | 45 | TestKind::Eq { value, cast_ty: match_pair.pattern_ty } |
| 41 | 46 | } |
| 42 | 47 | |
| ... | ... | @@ -491,11 +496,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 491 | 496 | } |
| 492 | 497 | } |
| 493 | 498 | |
| 494 | /// Returns true if this type be used with [`TestKind::SwitchInt`]. | |
| 495 | pub(crate) fn is_switch_ty(ty: Ty<'_>) -> bool { | |
| 496 | ty.is_integral() || ty.is_char() | |
| 497 | } | |
| 498 | ||
| 499 | 499 | fn trait_method<'tcx>( |
| 500 | 500 | tcx: TyCtxt<'tcx>, |
| 501 | 501 | trait_def_id: DefId, |
library/core/src/cell/lazy.rs+3-8| ... | ... | @@ -165,7 +165,6 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { |
| 165 | 165 | /// # Examples |
| 166 | 166 | /// |
| 167 | 167 | /// ``` |
| 168 | /// #![feature(lazy_get)] | |
| 169 | 168 | /// use std::cell::LazyCell; |
| 170 | 169 | /// |
| 171 | 170 | /// let mut lazy = LazyCell::new(|| 92); |
| ... | ... | @@ -176,7 +175,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { |
| 176 | 175 | /// assert_eq!(*lazy, 44); |
| 177 | 176 | /// ``` |
| 178 | 177 | #[inline] |
| 179 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 178 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 180 | 179 | pub fn force_mut(this: &mut LazyCell<T, F>) -> &mut T { |
| 181 | 180 | #[cold] |
| 182 | 181 | /// # Safety |
| ... | ... | @@ -264,8 +263,6 @@ impl<T, F> LazyCell<T, F> { |
| 264 | 263 | /// # Examples |
| 265 | 264 | /// |
| 266 | 265 | /// ``` |
| 267 | /// #![feature(lazy_get)] | |
| 268 | /// | |
| 269 | 266 | /// use std::cell::LazyCell; |
| 270 | 267 | /// |
| 271 | 268 | /// let mut lazy = LazyCell::new(|| 92); |
| ... | ... | @@ -276,7 +273,7 @@ impl<T, F> LazyCell<T, F> { |
| 276 | 273 | /// assert_eq!(*lazy, 44); |
| 277 | 274 | /// ``` |
| 278 | 275 | #[inline] |
| 279 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 276 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 280 | 277 | pub fn get_mut(this: &mut LazyCell<T, F>) -> Option<&mut T> { |
| 281 | 278 | let state = this.state.get_mut(); |
| 282 | 279 | match state { |
| ... | ... | @@ -291,8 +288,6 @@ impl<T, F> LazyCell<T, F> { |
| 291 | 288 | /// # Examples |
| 292 | 289 | /// |
| 293 | 290 | /// ``` |
| 294 | /// #![feature(lazy_get)] | |
| 295 | /// | |
| 296 | 291 | /// use std::cell::LazyCell; |
| 297 | 292 | /// |
| 298 | 293 | /// let lazy = LazyCell::new(|| 92); |
| ... | ... | @@ -302,7 +297,7 @@ impl<T, F> LazyCell<T, F> { |
| 302 | 297 | /// assert_eq!(LazyCell::get(&lazy), Some(&92)); |
| 303 | 298 | /// ``` |
| 304 | 299 | #[inline] |
| 305 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 300 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 306 | 301 | pub fn get(this: &LazyCell<T, F>) -> Option<&T> { |
| 307 | 302 | // SAFETY: |
| 308 | 303 | // This is sound for the same reason as in `force`: once the state is |
library/core/src/clone.rs+5-5| ... | ... | @@ -52,12 +52,12 @@ mod uninit; |
| 52 | 52 | /// original. |
| 53 | 53 | /// |
| 54 | 54 | /// Differs from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while |
| 55 | /// `Clone` is always explicit and may or may not be expensive. In order to enforce | |
| 56 | /// these characteristics, Rust does not allow you to reimplement [`Copy`], but you | |
| 57 | /// may reimplement `Clone` and run arbitrary code. | |
| 55 | /// `Clone` is always explicit and may or may not be expensive. [`Copy`] has no methods, so you | |
| 56 | /// cannot change its behavior, but when implementing `Clone`, the `clone` method you provide | |
| 57 | /// may run arbitrary code. | |
| 58 | 58 | /// |
| 59 | /// Since `Clone` is more general than [`Copy`], you can automatically make anything | |
| 60 | /// [`Copy`] be `Clone` as well. | |
| 59 | /// Since `Clone` is a supertrait of [`Copy`], any type that implements `Copy` must also implement | |
| 60 | /// `Clone`. | |
| 61 | 61 | /// |
| 62 | 62 | /// ## Derivable |
| 63 | 63 | /// |
library/core/src/lib.rs-1| ... | ... | @@ -113,7 +113,6 @@ |
| 113 | 113 | #![feature(internal_impls_macro)] |
| 114 | 114 | #![feature(ip)] |
| 115 | 115 | #![feature(is_ascii_octdigit)] |
| 116 | #![feature(lazy_get)] | |
| 117 | 116 | #![feature(link_cfg)] |
| 118 | 117 | #![feature(offset_of_enum)] |
| 119 | 118 | #![feature(panic_internals)] |
library/coretests/tests/lib.rs-1| ... | ... | @@ -79,7 +79,6 @@ |
| 79 | 79 | #![feature(iterator_try_collect)] |
| 80 | 80 | #![feature(iterator_try_reduce)] |
| 81 | 81 | #![feature(layout_for_ptr)] |
| 82 | #![feature(lazy_get)] | |
| 83 | 82 | #![feature(maybe_uninit_fill)] |
| 84 | 83 | #![feature(maybe_uninit_uninit_array_transpose)] |
| 85 | 84 | #![feature(min_specialization)] |
library/std/src/lib.rs-1| ... | ... | @@ -344,7 +344,6 @@ |
| 344 | 344 | #![feature(hint_must_use)] |
| 345 | 345 | #![feature(int_from_ascii)] |
| 346 | 346 | #![feature(ip)] |
| 347 | #![feature(lazy_get)] | |
| 348 | 347 | #![feature(maybe_uninit_array_assume_init)] |
| 349 | 348 | #![feature(panic_can_unwind)] |
| 350 | 349 | #![feature(panic_internals)] |
library/std/src/sync/lazy_lock.rs+3-8| ... | ... | @@ -172,7 +172,6 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { |
| 172 | 172 | /// # Examples |
| 173 | 173 | /// |
| 174 | 174 | /// ``` |
| 175 | /// #![feature(lazy_get)] | |
| 176 | 175 | /// use std::sync::LazyLock; |
| 177 | 176 | /// |
| 178 | 177 | /// let mut lazy = LazyLock::new(|| 92); |
| ... | ... | @@ -183,7 +182,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { |
| 183 | 182 | /// assert_eq!(*lazy, 44); |
| 184 | 183 | /// ``` |
| 185 | 184 | #[inline] |
| 186 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 185 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 187 | 186 | pub fn force_mut(this: &mut LazyLock<T, F>) -> &mut T { |
| 188 | 187 | #[cold] |
| 189 | 188 | /// # Safety |
| ... | ... | @@ -279,8 +278,6 @@ impl<T, F> LazyLock<T, F> { |
| 279 | 278 | /// # Examples |
| 280 | 279 | /// |
| 281 | 280 | /// ``` |
| 282 | /// #![feature(lazy_get)] | |
| 283 | /// | |
| 284 | 281 | /// use std::sync::LazyLock; |
| 285 | 282 | /// |
| 286 | 283 | /// let mut lazy = LazyLock::new(|| 92); |
| ... | ... | @@ -291,7 +288,7 @@ impl<T, F> LazyLock<T, F> { |
| 291 | 288 | /// assert_eq!(*lazy, 44); |
| 292 | 289 | /// ``` |
| 293 | 290 | #[inline] |
| 294 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 291 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 295 | 292 | pub fn get_mut(this: &mut LazyLock<T, F>) -> Option<&mut T> { |
| 296 | 293 | // `state()` does not perform an atomic load, so prefer it over `is_complete()`. |
| 297 | 294 | let state = this.once.state(); |
| ... | ... | @@ -309,8 +306,6 @@ impl<T, F> LazyLock<T, F> { |
| 309 | 306 | /// # Examples |
| 310 | 307 | /// |
| 311 | 308 | /// ``` |
| 312 | /// #![feature(lazy_get)] | |
| 313 | /// | |
| 314 | 309 | /// use std::sync::LazyLock; |
| 315 | 310 | /// |
| 316 | 311 | /// let lazy = LazyLock::new(|| 92); |
| ... | ... | @@ -320,7 +315,7 @@ impl<T, F> LazyLock<T, F> { |
| 320 | 315 | /// assert_eq!(LazyLock::get(&lazy), Some(&92)); |
| 321 | 316 | /// ``` |
| 322 | 317 | #[inline] |
| 323 | #[unstable(feature = "lazy_get", issue = "129333")] | |
| 318 | #[stable(feature = "lazy_get", since = "CURRENT_RUSTC_VERSION")] | |
| 324 | 319 | #[rustc_should_not_be_called_on_const_items] |
| 325 | 320 | pub fn get(this: &LazyLock<T, F>) -> Option<&T> { |
| 326 | 321 | if this.once.is_completed() { |
library/std/tests/sync/lib.rs-1| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | #![feature(lazy_get)] | |
| 2 | 1 | #![feature(mapped_lock_guards)] |
| 3 | 2 | #![feature(mpmc_channel)] |
| 4 | 3 | #![feature(once_cell_try)] |
tests/ui/lint/const-item-interior-mutations-const-cell.rs-1| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | #![feature(sync_unsafe_cell)] |
| 5 | 5 | #![feature(once_cell_try_insert)] |
| 6 | 6 | #![feature(once_cell_try)] |
| 7 | #![feature(lazy_get)] | |
| 8 | 7 | |
| 9 | 8 | use std::cell::{Cell, RefCell, SyncUnsafeCell, UnsafeCell}; |
| 10 | 9 | use std::cell::{LazyCell, OnceCell}; |
tests/ui/lint/const-item-interior-mutations-const-cell.stderr+22-22| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | warning: mutation of an interior mutable `const` item with call to `force` |
| 2 | --> $DIR/const-item-interior-mutations-const-cell.rs:16:13 | |
| 2 | --> $DIR/const-item-interior-mutations-const-cell.rs:15:13 | |
| 3 | 3 | | |
| 4 | 4 | LL | let _ = LazyCell::force(&A); |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^-^ |
| ... | ... | @@ -17,7 +17,7 @@ LL + static A: LazyCell<i32> = LazyCell::new(|| 0); |
| 17 | 17 | | |
| 18 | 18 | |
| 19 | 19 | warning: mutation of an interior mutable `const` item with call to `set` |
| 20 | --> $DIR/const-item-interior-mutations-const-cell.rs:23:13 | |
| 20 | --> $DIR/const-item-interior-mutations-const-cell.rs:22:13 | |
| 21 | 21 | | |
| 22 | 22 | LL | let _ = A.set(10); |
| 23 | 23 | | -^^^^^^^^ |
| ... | ... | @@ -34,7 +34,7 @@ LL + static A: OnceCell<i32> = OnceCell::new(); |
| 34 | 34 | | |
| 35 | 35 | |
| 36 | 36 | warning: mutation of an interior mutable `const` item with call to `try_insert` |
| 37 | --> $DIR/const-item-interior-mutations-const-cell.rs:26:13 | |
| 37 | --> $DIR/const-item-interior-mutations-const-cell.rs:25:13 | |
| 38 | 38 | | |
| 39 | 39 | LL | let _ = A.try_insert(20); |
| 40 | 40 | | -^^^^^^^^^^^^^^^ |
| ... | ... | @@ -51,7 +51,7 @@ LL + static A: OnceCell<i32> = OnceCell::new(); |
| 51 | 51 | | |
| 52 | 52 | |
| 53 | 53 | warning: mutation of an interior mutable `const` item with call to `get_or_init` |
| 54 | --> $DIR/const-item-interior-mutations-const-cell.rs:29:13 | |
| 54 | --> $DIR/const-item-interior-mutations-const-cell.rs:28:13 | |
| 55 | 55 | | |
| 56 | 56 | LL | let _ = A.get_or_init(|| 30); |
| 57 | 57 | | -^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -68,7 +68,7 @@ LL + static A: OnceCell<i32> = OnceCell::new(); |
| 68 | 68 | | |
| 69 | 69 | |
| 70 | 70 | warning: mutation of an interior mutable `const` item with call to `get_or_try_init` |
| 71 | --> $DIR/const-item-interior-mutations-const-cell.rs:32:13 | |
| 71 | --> $DIR/const-item-interior-mutations-const-cell.rs:31:13 | |
| 72 | 72 | | |
| 73 | 73 | LL | let _ = A.get_or_try_init(|| Ok::<_, ()>(40)); |
| 74 | 74 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -85,7 +85,7 @@ LL + static A: OnceCell<i32> = OnceCell::new(); |
| 85 | 85 | | |
| 86 | 86 | |
| 87 | 87 | warning: mutation of an interior mutable `const` item with call to `set` |
| 88 | --> $DIR/const-item-interior-mutations-const-cell.rs:39:13 | |
| 88 | --> $DIR/const-item-interior-mutations-const-cell.rs:38:13 | |
| 89 | 89 | | |
| 90 | 90 | LL | let _ = A.set(1); |
| 91 | 91 | | -^^^^^^^ |
| ... | ... | @@ -102,7 +102,7 @@ LL + static A: Cell<i32> = Cell::new(0); |
| 102 | 102 | | |
| 103 | 103 | |
| 104 | 104 | warning: mutation of an interior mutable `const` item with call to `swap` |
| 105 | --> $DIR/const-item-interior-mutations-const-cell.rs:42:13 | |
| 105 | --> $DIR/const-item-interior-mutations-const-cell.rs:41:13 | |
| 106 | 106 | | |
| 107 | 107 | LL | let _ = A.swap(&A); |
| 108 | 108 | | -^^^^^^^^^ |
| ... | ... | @@ -119,7 +119,7 @@ LL + static A: Cell<i32> = Cell::new(0); |
| 119 | 119 | | |
| 120 | 120 | |
| 121 | 121 | warning: mutation of an interior mutable `const` item with call to `replace` |
| 122 | --> $DIR/const-item-interior-mutations-const-cell.rs:45:13 | |
| 122 | --> $DIR/const-item-interior-mutations-const-cell.rs:44:13 | |
| 123 | 123 | | |
| 124 | 124 | LL | let _ = A.replace(2); |
| 125 | 125 | | -^^^^^^^^^^^ |
| ... | ... | @@ -136,7 +136,7 @@ LL + static A: Cell<i32> = Cell::new(0); |
| 136 | 136 | | |
| 137 | 137 | |
| 138 | 138 | warning: mutation of an interior mutable `const` item with call to `get` |
| 139 | --> $DIR/const-item-interior-mutations-const-cell.rs:48:13 | |
| 139 | --> $DIR/const-item-interior-mutations-const-cell.rs:47:13 | |
| 140 | 140 | | |
| 141 | 141 | LL | let _ = A.get(); |
| 142 | 142 | | -^^^^^^ |
| ... | ... | @@ -153,7 +153,7 @@ LL + static A: Cell<i32> = Cell::new(0); |
| 153 | 153 | | |
| 154 | 154 | |
| 155 | 155 | warning: mutation of an interior mutable `const` item with call to `update` |
| 156 | --> $DIR/const-item-interior-mutations-const-cell.rs:51:13 | |
| 156 | --> $DIR/const-item-interior-mutations-const-cell.rs:50:13 | |
| 157 | 157 | | |
| 158 | 158 | LL | let _ = A.update(|x| x + 1); |
| 159 | 159 | | -^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -170,7 +170,7 @@ LL + static A: Cell<i32> = Cell::new(0); |
| 170 | 170 | | |
| 171 | 171 | |
| 172 | 172 | warning: mutation of an interior mutable `const` item with call to `replace` |
| 173 | --> $DIR/const-item-interior-mutations-const-cell.rs:58:13 | |
| 173 | --> $DIR/const-item-interior-mutations-const-cell.rs:57:13 | |
| 174 | 174 | | |
| 175 | 175 | LL | let _ = A.replace(1); |
| 176 | 176 | | -^^^^^^^^^^^ |
| ... | ... | @@ -187,7 +187,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 187 | 187 | | |
| 188 | 188 | |
| 189 | 189 | warning: mutation of an interior mutable `const` item with call to `replace_with` |
| 190 | --> $DIR/const-item-interior-mutations-const-cell.rs:61:13 | |
| 190 | --> $DIR/const-item-interior-mutations-const-cell.rs:60:13 | |
| 191 | 191 | | |
| 192 | 192 | LL | let _ = A.replace_with(|x| *x + 2); |
| 193 | 193 | | -^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -204,7 +204,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 204 | 204 | | |
| 205 | 205 | |
| 206 | 206 | warning: mutation of an interior mutable `const` item with call to `swap` |
| 207 | --> $DIR/const-item-interior-mutations-const-cell.rs:64:13 | |
| 207 | --> $DIR/const-item-interior-mutations-const-cell.rs:63:13 | |
| 208 | 208 | | |
| 209 | 209 | LL | let _ = A.swap(&A); |
| 210 | 210 | | -^^^^^^^^^ |
| ... | ... | @@ -221,7 +221,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 221 | 221 | | |
| 222 | 222 | |
| 223 | 223 | warning: mutation of an interior mutable `const` item with call to `borrow` |
| 224 | --> $DIR/const-item-interior-mutations-const-cell.rs:67:13 | |
| 224 | --> $DIR/const-item-interior-mutations-const-cell.rs:66:13 | |
| 225 | 225 | | |
| 226 | 226 | LL | let _ = A.borrow(); |
| 227 | 227 | | -^^^^^^^^^ |
| ... | ... | @@ -238,7 +238,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 238 | 238 | | |
| 239 | 239 | |
| 240 | 240 | warning: mutation of an interior mutable `const` item with call to `try_borrow` |
| 241 | --> $DIR/const-item-interior-mutations-const-cell.rs:70:13 | |
| 241 | --> $DIR/const-item-interior-mutations-const-cell.rs:69:13 | |
| 242 | 242 | | |
| 243 | 243 | LL | let _ = A.try_borrow(); |
| 244 | 244 | | -^^^^^^^^^^^^^ |
| ... | ... | @@ -255,7 +255,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 255 | 255 | | |
| 256 | 256 | |
| 257 | 257 | warning: mutation of an interior mutable `const` item with call to `borrow_mut` |
| 258 | --> $DIR/const-item-interior-mutations-const-cell.rs:73:13 | |
| 258 | --> $DIR/const-item-interior-mutations-const-cell.rs:72:13 | |
| 259 | 259 | | |
| 260 | 260 | LL | let _ = A.borrow_mut(); |
| 261 | 261 | | -^^^^^^^^^^^^^ |
| ... | ... | @@ -272,7 +272,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 272 | 272 | | |
| 273 | 273 | |
| 274 | 274 | warning: mutation of an interior mutable `const` item with call to `try_borrow_mut` |
| 275 | --> $DIR/const-item-interior-mutations-const-cell.rs:76:13 | |
| 275 | --> $DIR/const-item-interior-mutations-const-cell.rs:75:13 | |
| 276 | 276 | | |
| 277 | 277 | LL | let _ = A.try_borrow_mut(); |
| 278 | 278 | | -^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -289,7 +289,7 @@ LL + static A: RefCell<i32> = RefCell::new(0); |
| 289 | 289 | | |
| 290 | 290 | |
| 291 | 291 | warning: mutation of an interior mutable `const` item with call to `replace` |
| 292 | --> $DIR/const-item-interior-mutations-const-cell.rs:83:22 | |
| 292 | --> $DIR/const-item-interior-mutations-const-cell.rs:82:22 | |
| 293 | 293 | | |
| 294 | 294 | LL | let _ = unsafe { A.replace(1) }; |
| 295 | 295 | | -^^^^^^^^^^^ |
| ... | ... | @@ -306,7 +306,7 @@ LL + static A: UnsafeCell<i32> = UnsafeCell::new(0); |
| 306 | 306 | | |
| 307 | 307 | |
| 308 | 308 | warning: mutation of an interior mutable `const` item with call to `get` |
| 309 | --> $DIR/const-item-interior-mutations-const-cell.rs:86:13 | |
| 309 | --> $DIR/const-item-interior-mutations-const-cell.rs:85:13 | |
| 310 | 310 | | |
| 311 | 311 | LL | let _ = A.get(); |
| 312 | 312 | | -^^^^^^ |
| ... | ... | @@ -323,7 +323,7 @@ LL + static A: UnsafeCell<i32> = UnsafeCell::new(0); |
| 323 | 323 | | |
| 324 | 324 | |
| 325 | 325 | warning: mutation of an interior mutable `const` item with call to `as_ref_unchecked` |
| 326 | --> $DIR/const-item-interior-mutations-const-cell.rs:90:17 | |
| 326 | --> $DIR/const-item-interior-mutations-const-cell.rs:89:17 | |
| 327 | 327 | | |
| 328 | 328 | LL | let _ = A.as_ref_unchecked(); |
| 329 | 329 | | -^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -340,7 +340,7 @@ LL + static A: UnsafeCell<i32> = UnsafeCell::new(0); |
| 340 | 340 | | |
| 341 | 341 | |
| 342 | 342 | warning: mutation of an interior mutable `const` item with call to `as_mut_unchecked` |
| 343 | --> $DIR/const-item-interior-mutations-const-cell.rs:93:17 | |
| 343 | --> $DIR/const-item-interior-mutations-const-cell.rs:92:17 | |
| 344 | 344 | | |
| 345 | 345 | LL | let _ = A.as_mut_unchecked(); |
| 346 | 346 | | -^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -357,7 +357,7 @@ LL + static A: UnsafeCell<i32> = UnsafeCell::new(0); |
| 357 | 357 | | |
| 358 | 358 | |
| 359 | 359 | warning: mutation of an interior mutable `const` item with call to `get` |
| 360 | --> $DIR/const-item-interior-mutations-const-cell.rs:101:13 | |
| 360 | --> $DIR/const-item-interior-mutations-const-cell.rs:100:13 | |
| 361 | 361 | | |
| 362 | 362 | LL | let _ = A.get(); |
| 363 | 363 | | -^^^^^^ |
tests/ui/lint/const-item-interior-mutations-const.fixed-1| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | #![feature(lock_value_accessors)] |
| 7 | 7 | #![feature(once_cell_try_insert)] |
| 8 | 8 | #![feature(once_cell_try)] |
| 9 | #![feature(lazy_get)] | |
| 10 | 9 | |
| 11 | 10 | use std::sync::{Condvar, LazyLock, Mutex, Once, OnceLock, RwLock}; |
| 12 | 11 | use std::time::Duration; |
tests/ui/lint/const-item-interior-mutations-const.rs-1| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | #![feature(lock_value_accessors)] |
| 7 | 7 | #![feature(once_cell_try_insert)] |
| 8 | 8 | #![feature(once_cell_try)] |
| 9 | #![feature(lazy_get)] | |
| 10 | 9 | |
| 11 | 10 | use std::sync::{Condvar, LazyLock, Mutex, Once, OnceLock, RwLock}; |
| 12 | 11 | use std::time::Duration; |
tests/ui/lint/const-item-interior-mutations-const.stderr+30-30| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | warning: mutation of an interior mutable `const` item with call to `set` |
| 2 | --> $DIR/const-item-interior-mutations-const.rs:17:14 | |
| 2 | --> $DIR/const-item-interior-mutations-const.rs:16:14 | |
| 3 | 3 | | |
| 4 | 4 | LL | let _a = A.set(1); |
| 5 | 5 | | -^^^^^^^ |
| ... | ... | @@ -17,7 +17,7 @@ LL + static A: Mutex<i32> = Mutex::new(0); |
| 17 | 17 | | |
| 18 | 18 | |
| 19 | 19 | warning: mutation of an interior mutable `const` item with call to `replace` |
| 20 | --> $DIR/const-item-interior-mutations-const.rs:20:14 | |
| 20 | --> $DIR/const-item-interior-mutations-const.rs:19:14 | |
| 21 | 21 | | |
| 22 | 22 | LL | let _a = A.replace(2); |
| 23 | 23 | | -^^^^^^^^^^^ |
| ... | ... | @@ -34,7 +34,7 @@ LL + static A: Mutex<i32> = Mutex::new(0); |
| 34 | 34 | | |
| 35 | 35 | |
| 36 | 36 | warning: mutation of an interior mutable `const` item with call to `lock` |
| 37 | --> $DIR/const-item-interior-mutations-const.rs:23:10 | |
| 37 | --> $DIR/const-item-interior-mutations-const.rs:22:10 | |
| 38 | 38 | | |
| 39 | 39 | LL | drop(A.lock()); |
| 40 | 40 | | -^^^^^^^ |
| ... | ... | @@ -51,7 +51,7 @@ LL + static A: Mutex<i32> = Mutex::new(0); |
| 51 | 51 | | |
| 52 | 52 | |
| 53 | 53 | warning: mutation of an interior mutable `const` item with call to `try_lock` |
| 54 | --> $DIR/const-item-interior-mutations-const.rs:26:10 | |
| 54 | --> $DIR/const-item-interior-mutations-const.rs:25:10 | |
| 55 | 55 | | |
| 56 | 56 | LL | drop(A.try_lock()); |
| 57 | 57 | | -^^^^^^^^^^^ |
| ... | ... | @@ -68,7 +68,7 @@ LL + static A: Mutex<i32> = Mutex::new(0); |
| 68 | 68 | | |
| 69 | 69 | |
| 70 | 70 | warning: mutation of an interior mutable `const` item with call to `clear_poison` |
| 71 | --> $DIR/const-item-interior-mutations-const.rs:29:14 | |
| 71 | --> $DIR/const-item-interior-mutations-const.rs:28:14 | |
| 72 | 72 | | |
| 73 | 73 | LL | let _a = A.clear_poison(); |
| 74 | 74 | | -^^^^^^^^^^^^^^^ |
| ... | ... | @@ -85,7 +85,7 @@ LL + static A: Mutex<i32> = Mutex::new(0); |
| 85 | 85 | | |
| 86 | 86 | |
| 87 | 87 | warning: mutation of an interior mutable `const` item with call to `call_once` |
| 88 | --> $DIR/const-item-interior-mutations-const.rs:36:14 | |
| 88 | --> $DIR/const-item-interior-mutations-const.rs:35:14 | |
| 89 | 89 | | |
| 90 | 90 | LL | let _a = A.call_once(|| {}); |
| 91 | 91 | | -^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -102,7 +102,7 @@ LL + static A: Once = Once::new(); |
| 102 | 102 | | |
| 103 | 103 | |
| 104 | 104 | warning: mutation of an interior mutable `const` item with call to `call_once_force` |
| 105 | --> $DIR/const-item-interior-mutations-const.rs:39:14 | |
| 105 | --> $DIR/const-item-interior-mutations-const.rs:38:14 | |
| 106 | 106 | | |
| 107 | 107 | LL | let _a = A.call_once_force(|_| {}); |
| 108 | 108 | | -^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -119,7 +119,7 @@ LL + static A: Once = Once::new(); |
| 119 | 119 | | |
| 120 | 120 | |
| 121 | 121 | warning: mutation of an interior mutable `const` item with call to `wait` |
| 122 | --> $DIR/const-item-interior-mutations-const.rs:42:14 | |
| 122 | --> $DIR/const-item-interior-mutations-const.rs:41:14 | |
| 123 | 123 | | |
| 124 | 124 | LL | let _a = A.wait(); |
| 125 | 125 | | -^^^^^^^ |
| ... | ... | @@ -136,7 +136,7 @@ LL + static A: Once = Once::new(); |
| 136 | 136 | | |
| 137 | 137 | |
| 138 | 138 | warning: mutation of an interior mutable `const` item with call to `wait_force` |
| 139 | --> $DIR/const-item-interior-mutations-const.rs:45:14 | |
| 139 | --> $DIR/const-item-interior-mutations-const.rs:44:14 | |
| 140 | 140 | | |
| 141 | 141 | LL | let _a = A.wait_force(); |
| 142 | 142 | | -^^^^^^^^^^^^^ |
| ... | ... | @@ -153,7 +153,7 @@ LL + static A: Once = Once::new(); |
| 153 | 153 | | |
| 154 | 154 | |
| 155 | 155 | warning: mutation of an interior mutable `const` item with call to `set` |
| 156 | --> $DIR/const-item-interior-mutations-const.rs:52:14 | |
| 156 | --> $DIR/const-item-interior-mutations-const.rs:51:14 | |
| 157 | 157 | | |
| 158 | 158 | LL | let _a = A.set(1); |
| 159 | 159 | | -^^^^^^^ |
| ... | ... | @@ -170,7 +170,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 170 | 170 | | |
| 171 | 171 | |
| 172 | 172 | warning: mutation of an interior mutable `const` item with call to `replace` |
| 173 | --> $DIR/const-item-interior-mutations-const.rs:55:14 | |
| 173 | --> $DIR/const-item-interior-mutations-const.rs:54:14 | |
| 174 | 174 | | |
| 175 | 175 | LL | let _a = A.replace(2); |
| 176 | 176 | | -^^^^^^^^^^^ |
| ... | ... | @@ -187,7 +187,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 187 | 187 | | |
| 188 | 188 | |
| 189 | 189 | warning: mutation of an interior mutable `const` item with call to `read` |
| 190 | --> $DIR/const-item-interior-mutations-const.rs:58:10 | |
| 190 | --> $DIR/const-item-interior-mutations-const.rs:57:10 | |
| 191 | 191 | | |
| 192 | 192 | LL | drop(A.read()); |
| 193 | 193 | | -^^^^^^^ |
| ... | ... | @@ -204,7 +204,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 204 | 204 | | |
| 205 | 205 | |
| 206 | 206 | warning: mutation of an interior mutable `const` item with call to `try_read` |
| 207 | --> $DIR/const-item-interior-mutations-const.rs:61:10 | |
| 207 | --> $DIR/const-item-interior-mutations-const.rs:60:10 | |
| 208 | 208 | | |
| 209 | 209 | LL | drop(A.try_read()); |
| 210 | 210 | | -^^^^^^^^^^^ |
| ... | ... | @@ -221,7 +221,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 221 | 221 | | |
| 222 | 222 | |
| 223 | 223 | warning: mutation of an interior mutable `const` item with call to `write` |
| 224 | --> $DIR/const-item-interior-mutations-const.rs:64:10 | |
| 224 | --> $DIR/const-item-interior-mutations-const.rs:63:10 | |
| 225 | 225 | | |
| 226 | 226 | LL | drop(A.write()); |
| 227 | 227 | | -^^^^^^^^ |
| ... | ... | @@ -238,7 +238,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 238 | 238 | | |
| 239 | 239 | |
| 240 | 240 | warning: mutation of an interior mutable `const` item with call to `try_write` |
| 241 | --> $DIR/const-item-interior-mutations-const.rs:67:10 | |
| 241 | --> $DIR/const-item-interior-mutations-const.rs:66:10 | |
| 242 | 242 | | |
| 243 | 243 | LL | drop(A.try_write()); |
| 244 | 244 | | -^^^^^^^^^^^^ |
| ... | ... | @@ -255,7 +255,7 @@ LL + static A: RwLock<i32> = RwLock::new(0); |
| 255 | 255 | | |
| 256 | 256 | |
| 257 | 257 | warning: mutation of an interior mutable `const` item with call to `force` |
| 258 | --> $DIR/const-item-interior-mutations-const.rs:74:14 | |
| 258 | --> $DIR/const-item-interior-mutations-const.rs:73:14 | |
| 259 | 259 | | |
| 260 | 260 | LL | let _a = LazyLock::force(&A); |
| 261 | 261 | | ^^^^^^^^^^^^^^^^^-^ |
| ... | ... | @@ -272,7 +272,7 @@ LL + static A: LazyLock<i32> = LazyLock::new(|| 0); |
| 272 | 272 | | |
| 273 | 273 | |
| 274 | 274 | warning: mutation of an interior mutable `const` item with call to `get` |
| 275 | --> $DIR/const-item-interior-mutations-const.rs:77:14 | |
| 275 | --> $DIR/const-item-interior-mutations-const.rs:76:14 | |
| 276 | 276 | | |
| 277 | 277 | LL | let _a = LazyLock::get(&A); |
| 278 | 278 | | ^^^^^^^^^^^^^^^-^ |
| ... | ... | @@ -289,7 +289,7 @@ LL + static A: LazyLock<i32> = LazyLock::new(|| 0); |
| 289 | 289 | | |
| 290 | 290 | |
| 291 | 291 | warning: mutation of an interior mutable `const` item with call to `get` |
| 292 | --> $DIR/const-item-interior-mutations-const.rs:84:14 | |
| 292 | --> $DIR/const-item-interior-mutations-const.rs:83:14 | |
| 293 | 293 | | |
| 294 | 294 | LL | let _a = A.get(); |
| 295 | 295 | | -^^^^^^ |
| ... | ... | @@ -306,7 +306,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 306 | 306 | | |
| 307 | 307 | |
| 308 | 308 | warning: mutation of an interior mutable `const` item with call to `wait` |
| 309 | --> $DIR/const-item-interior-mutations-const.rs:87:14 | |
| 309 | --> $DIR/const-item-interior-mutations-const.rs:86:14 | |
| 310 | 310 | | |
| 311 | 311 | LL | let _a = A.wait(); |
| 312 | 312 | | -^^^^^^^ |
| ... | ... | @@ -323,7 +323,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 323 | 323 | | |
| 324 | 324 | |
| 325 | 325 | warning: mutation of an interior mutable `const` item with call to `set` |
| 326 | --> $DIR/const-item-interior-mutations-const.rs:90:14 | |
| 326 | --> $DIR/const-item-interior-mutations-const.rs:89:14 | |
| 327 | 327 | | |
| 328 | 328 | LL | let _a = A.set(10); |
| 329 | 329 | | -^^^^^^^^ |
| ... | ... | @@ -340,7 +340,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 340 | 340 | | |
| 341 | 341 | |
| 342 | 342 | warning: mutation of an interior mutable `const` item with call to `try_insert` |
| 343 | --> $DIR/const-item-interior-mutations-const.rs:93:14 | |
| 343 | --> $DIR/const-item-interior-mutations-const.rs:92:14 | |
| 344 | 344 | | |
| 345 | 345 | LL | let _a = A.try_insert(20); |
| 346 | 346 | | -^^^^^^^^^^^^^^^ |
| ... | ... | @@ -357,7 +357,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 357 | 357 | | |
| 358 | 358 | |
| 359 | 359 | warning: mutation of an interior mutable `const` item with call to `get_or_init` |
| 360 | --> $DIR/const-item-interior-mutations-const.rs:96:14 | |
| 360 | --> $DIR/const-item-interior-mutations-const.rs:95:14 | |
| 361 | 361 | | |
| 362 | 362 | LL | let _a = A.get_or_init(|| 30); |
| 363 | 363 | | -^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -374,7 +374,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 374 | 374 | | |
| 375 | 375 | |
| 376 | 376 | warning: mutation of an interior mutable `const` item with call to `get_or_try_init` |
| 377 | --> $DIR/const-item-interior-mutations-const.rs:99:14 | |
| 377 | --> $DIR/const-item-interior-mutations-const.rs:98:14 | |
| 378 | 378 | | |
| 379 | 379 | LL | let _a = A.get_or_try_init(|| Ok::<_, ()>(40)); |
| 380 | 380 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -391,7 +391,7 @@ LL + static A: OnceLock<i32> = OnceLock::new(); |
| 391 | 391 | | |
| 392 | 392 | |
| 393 | 393 | warning: mutation of an interior mutable `const` item with call to `wait` |
| 394 | --> $DIR/const-item-interior-mutations-const.rs:109:14 | |
| 394 | --> $DIR/const-item-interior-mutations-const.rs:108:14 | |
| 395 | 395 | | |
| 396 | 396 | LL | let _a = A.wait(guard); |
| 397 | 397 | | -^^^^^^^^^^^^ |
| ... | ... | @@ -408,7 +408,7 @@ LL + static A: Condvar = Condvar::new(); |
| 408 | 408 | | |
| 409 | 409 | |
| 410 | 410 | warning: mutation of an interior mutable `const` item with call to `wait_while` |
| 411 | --> $DIR/const-item-interior-mutations-const.rs:114:14 | |
| 411 | --> $DIR/const-item-interior-mutations-const.rs:113:14 | |
| 412 | 412 | | |
| 413 | 413 | LL | let _a = A.wait_while(guard, |x| *x == 0); |
| 414 | 414 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -425,7 +425,7 @@ LL + static A: Condvar = Condvar::new(); |
| 425 | 425 | | |
| 426 | 426 | |
| 427 | 427 | warning: mutation of an interior mutable `const` item with call to `wait_timeout_ms` |
| 428 | --> $DIR/const-item-interior-mutations-const.rs:119:14 | |
| 428 | --> $DIR/const-item-interior-mutations-const.rs:118:14 | |
| 429 | 429 | | |
| 430 | 430 | LL | let _a = A.wait_timeout_ms(guard, 10); |
| 431 | 431 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -442,7 +442,7 @@ LL + static A: Condvar = Condvar::new(); |
| 442 | 442 | | |
| 443 | 443 | |
| 444 | 444 | warning: mutation of an interior mutable `const` item with call to `wait_timeout` |
| 445 | --> $DIR/const-item-interior-mutations-const.rs:124:14 | |
| 445 | --> $DIR/const-item-interior-mutations-const.rs:123:14 | |
| 446 | 446 | | |
| 447 | 447 | LL | let _a = A.wait_timeout(guard, Duration::from_millis(10)); |
| 448 | 448 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -459,7 +459,7 @@ LL + static A: Condvar = Condvar::new(); |
| 459 | 459 | | |
| 460 | 460 | |
| 461 | 461 | warning: mutation of an interior mutable `const` item with call to `wait_timeout_while` |
| 462 | --> $DIR/const-item-interior-mutations-const.rs:129:14 | |
| 462 | --> $DIR/const-item-interior-mutations-const.rs:128:14 | |
| 463 | 463 | | |
| 464 | 464 | LL | let _a = A.wait_timeout_while(guard, Duration::from_millis(10), |x| *x == 0); |
| 465 | 465 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -476,7 +476,7 @@ LL + static A: Condvar = Condvar::new(); |
| 476 | 476 | | |
| 477 | 477 | |
| 478 | 478 | warning: mutation of an interior mutable `const` item with call to `notify_one` |
| 479 | --> $DIR/const-item-interior-mutations-const.rs:132:14 | |
| 479 | --> $DIR/const-item-interior-mutations-const.rs:131:14 | |
| 480 | 480 | | |
| 481 | 481 | LL | let _a = A.notify_one(); |
| 482 | 482 | | -^^^^^^^^^^^^^ |
| ... | ... | @@ -493,7 +493,7 @@ LL + static A: Condvar = Condvar::new(); |
| 493 | 493 | | |
| 494 | 494 | |
| 495 | 495 | warning: mutation of an interior mutable `const` item with call to `notify_all` |
| 496 | --> $DIR/const-item-interior-mutations-const.rs:135:14 | |
| 496 | --> $DIR/const-item-interior-mutations-const.rs:134:14 | |
| 497 | 497 | | |
| 498 | 498 | LL | let _a = A.notify_all(); |
| 499 | 499 | | -^^^^^^^^^^^^^ |