Skip to content

Commit f943de9

Browse files
committed
Rollup merge of #22837 - eddyb:issue-21721, r=dotdash
Closes #21721.
2 parents fa66eb3 + 704ce1d commit f943de9

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

src/librand/reseeding.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ 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 { __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: [] };
137+
pub struct ReseedWithDefault;
142138

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

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

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

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]>;
43+
type nillist = List<()>;
4644

4745
// Filled with things that have to be unwound
4846

@@ -83,11 +81,11 @@ fn recurse_or_panic(depth: int, st: Option<State>) {
8381
}
8482
Some(st) => {
8583
let mut v = st.vec.clone();
86-
v.push_all(&[box List::Cons([], st.vec.last().unwrap().clone())]);
84+
v.push_all(&[box List::Cons((), st.vec.last().unwrap().clone())]);
8785
State {
88-
unique: box List::Cons([], box *st.unique),
86+
unique: box List::Cons((), box *st.unique),
8987
vec: v,
90-
res: r(box List::Cons([], st.res._l.clone())),
88+
res: r(box List::Cons((), st.res._l.clone())),
9189
}
9290
}
9391
};

src/test/run-pass/issue-17216.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ fn main() {
2525
let mut dropped = false;
2626
{
2727
let leak = Leak { dropped: &mut dropped };
28-
// FIXME(#21721) "hack" used to be () but that can cause
29-
// certain LLVM versions to abort during optimizations.
30-
for (_, leaked) in Some(("hack", leak)).into_iter() {}
28+
for ((), leaked) in Some(((), leak)).into_iter() {}
3129
}
3230

3331
assert!(dropped);

src/test/run-pass/issue-21721.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
static NONE: Option<((), &'static u8)> = None;
13+
let ptr = unsafe {
14+
*(&NONE as *const _ as *const *const u8)
15+
};
16+
assert!(ptr.is_null());
17+
}

0 commit comments

Comments
 (0)