Skip to content

Commit d13d74d

Browse files
committed
tests: work around #21721 some more by replacing some unit types with [u8; 0].
1 parent 36fcfb0 commit d13d74d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/librand/reseeding.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ pub trait Reseeder<R> {
134134
/// Reseed an RNG using a `Default` instance. This reseeds by
135135
/// replacing the RNG with the result of a `Default::default` call.
136136
#[derive(Copy)]
137-
pub struct ReseedWithDefault;
137+
pub struct ReseedWithDefault { __hack: [u8; 0] }
138+
// FIXME(#21721) used to be an unit struct but that can cause
139+
// certain LLVM versions to abort during optimizations.
140+
#[allow(non_upper_case_globals)]
141+
pub const ReseedWithDefault: ReseedWithDefault = ReseedWithDefault { __hack: [] };
138142

139143
impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {
140144
fn reseed(&mut self, rng: &mut R) {

src/test/bench/task-perf-alloc-unwind.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ fn run(repeat: int, depth: int) {
4040
}
4141
}
4242

43-
type nillist = List<()>;
43+
// FIXME(#21721) used to be `List<()>` but that can cause
44+
// certain LLVM versions to abort during optimizations.
45+
type nillist = List<[u8; 0]>;
4446

4547
// Filled with things that have to be unwound
4648

@@ -81,11 +83,11 @@ fn recurse_or_panic(depth: int, st: Option<State>) {
8183
}
8284
Some(st) => {
8385
let mut v = st.vec.clone();
84-
v.push_all(&[box List::Cons((), st.vec.last().unwrap().clone())]);
86+
v.push_all(&[box List::Cons([], st.vec.last().unwrap().clone())]);
8587
State {
86-
unique: box List::Cons((), box *st.unique),
88+
unique: box List::Cons([], box *st.unique),
8789
vec: v,
88-
res: r(box List::Cons((), st.res._l.clone())),
90+
res: r(box List::Cons([], st.res._l.clone())),
8991
}
9092
}
9193
};

0 commit comments

Comments
 (0)