Skip to content

Commit e36c2a4

Browse files
committed
Auto merge of rust-lang#126793 - saethlin:mono-rawvec, r=scottmcm
Apply "polymorphization at home" to RawVec The idea here is to move all the logic in RawVec into functions with explicit size and alignment parameters. This should eliminate all the fussing about how tweaking RawVec code produces large swings in compile times. This uncovered rust-lang/rust-clippy#12979, so I've modified the relevant test in a way that tries to preserve the spirit of the test without tripping the ICE.
2 parents 837d904 + dda9eb9 commit e36c2a4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/ui/borrow_interior_mutable_const/others.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::sync::Once;
1010

1111
const ATOMIC: AtomicUsize = AtomicUsize::new(5);
1212
const CELL: Cell<usize> = Cell::new(6);
13-
const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
13+
const ATOMIC_TUPLE: ([AtomicUsize; 1], Option<Box<AtomicUsize>>, u8) = ([ATOMIC], None, 7);
1414
const INTEGER: u8 = 8;
1515
const STRING: String = String::new();
1616
const STR: &str = "012345";
@@ -74,7 +74,6 @@ fn main() {
7474
let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR: interior mutability
7575
let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR: interior mutability
7676
let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR: interior mutability
77-
let _ = &*ATOMIC_TUPLE.1;
7877
let _ = &ATOMIC_TUPLE.2;
7978
let _ = (&&&&ATOMIC_TUPLE).0;
8079
let _ = (&&&&ATOMIC_TUPLE).2;

tests/ui/borrow_interior_mutable_const/others.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,23 @@ LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst);
9292
= help: assign this const to a local or static variable, and use the variable here
9393

9494
error: a `const` item with interior mutability should not be borrowed
95-
--> tests/ui/borrow_interior_mutable_const/others.rs:82:13
95+
--> tests/ui/borrow_interior_mutable_const/others.rs:81:13
9696
|
9797
LL | let _ = ATOMIC_TUPLE.0[0];
9898
| ^^^^^^^^^^^^
9999
|
100100
= help: assign this const to a local or static variable, and use the variable here
101101

102102
error: a `const` item with interior mutability should not be borrowed
103-
--> tests/ui/borrow_interior_mutable_const/others.rs:87:5
103+
--> tests/ui/borrow_interior_mutable_const/others.rs:86:5
104104
|
105105
LL | CELL.set(2);
106106
| ^^^^
107107
|
108108
= help: assign this const to a local or static variable, and use the variable here
109109

110110
error: a `const` item with interior mutability should not be borrowed
111-
--> tests/ui/borrow_interior_mutable_const/others.rs:88:16
111+
--> tests/ui/borrow_interior_mutable_const/others.rs:87:16
112112
|
113113
LL | assert_eq!(CELL.get(), 6);
114114
| ^^^^

0 commit comments

Comments
 (0)