Skip to content

Revert hacks and add test for LLVM aborts due to empty aggregates. #22837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/librand/reseeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ pub trait Reseeder<R> {
/// Reseed an RNG using a `Default` instance. This reseeds by
/// replacing the RNG with the result of a `Default::default` call.
#[derive(Copy)]
pub struct ReseedWithDefault { __hack: [u8; 0] }
// FIXME(#21721) used to be an unit struct but that can cause
// certain LLVM versions to abort during optimizations.
#[allow(non_upper_case_globals)]
pub const ReseedWithDefault: ReseedWithDefault = ReseedWithDefault { __hack: [] };
pub struct ReseedWithDefault;

impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {
fn reseed(&mut self, rng: &mut R) {
Expand Down
10 changes: 4 additions & 6 deletions src/test/bench/task-perf-alloc-unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ fn run(repeat: int, depth: int) {
}
}

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

// Filled with things that have to be unwound

Expand Down Expand Up @@ -83,11 +81,11 @@ fn recurse_or_panic(depth: int, st: Option<State>) {
}
Some(st) => {
let mut v = st.vec.clone();
v.push_all(&[box List::Cons([], st.vec.last().unwrap().clone())]);
v.push_all(&[box List::Cons((), st.vec.last().unwrap().clone())]);
State {
unique: box List::Cons([], box *st.unique),
unique: box List::Cons((), box *st.unique),
vec: v,
res: r(box List::Cons([], st.res._l.clone())),
res: r(box List::Cons((), st.res._l.clone())),
}
}
};
Expand Down
4 changes: 1 addition & 3 deletions src/test/run-pass/issue-17216.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ fn main() {
let mut dropped = false;
{
let leak = Leak { dropped: &mut dropped };
// FIXME(#21721) "hack" used to be () but that can cause
// certain LLVM versions to abort during optimizations.
for (_, leaked) in Some(("hack", leak)).into_iter() {}
for ((), leaked) in Some(((), leak)).into_iter() {}
}

assert!(dropped);
Expand Down
17 changes: 17 additions & 0 deletions src/test/run-pass/issue-21721.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
static NONE: Option<((), &'static u8)> = None;
let ptr = unsafe {
*(&NONE as *const _ as *const *const u8)
};
assert!(ptr.is_null());
}