-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all testable issue of parallel front end to ui tests
- Loading branch information
1 parent
ecccfb7
commit 1a125e5
Showing
19 changed files
with
625 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This directory contains the robustness test for prallel front end, which means deadlocks | ||
and other ice bugs. In other words, we don't care whether the compiler output in these tests, | ||
but whether they can compile normally without deadlock or other ice bugs. | ||
|
||
So when a test in this directory fails, please pay attention to whether it causes any ice problems. | ||
If so(it should do), please post your comments in the issue corresponding to each test (or create a new issue | ||
with the `wg-parallel-rustc` label). Even if it is an existing issue, please add a new comment, | ||
which will help us determine the reproducibility of the bug. |
16 changes: 8 additions & 8 deletions
16
tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
// Test for #111528, the ice issue cause waiting on a query that panicked | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=16 | ||
//@ build-fail | ||
|
||
#![crate_type="rlib"] | ||
#![crate_type = "rlib"] | ||
#![allow(warnings)] | ||
|
||
#[export_name="fail"] | ||
pub fn a() { | ||
} | ||
#[export_name = "fail"] | ||
pub fn a() {} | ||
|
||
#[export_name="fail"] | ||
pub fn b() { | ||
//~^ Error symbol `fail` is already defined | ||
} | ||
#[export_name = "fail"] | ||
pub fn b() {} | ||
|
||
fn main() {} |
8 changes: 0 additions & 8 deletions
8
tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Test for #119785, which causes a deadlock bug | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=200 | ||
|
||
#![allow(incomplete_features)] | ||
#![feature( | ||
const_trait_impl, | ||
effects, | ||
)] | ||
|
||
use std::marker::Destruct; | ||
|
||
const fn cmp(a: &impl ~const PartialEq) -> bool { | ||
a == a | ||
} | ||
|
||
const fn wrap(x: impl ~const PartialEq + ~const Destruct) | ||
-> impl ~const PartialEq + ~const Destruct | ||
{ | ||
x | ||
} | ||
|
||
#[const_trait] | ||
trait Foo { | ||
fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output; | ||
} | ||
|
||
impl const Foo for () { | ||
fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { | ||
123 | ||
} | ||
} | ||
|
||
const _: () = { | ||
assert!(cmp(&0xDEADBEEFu32)); | ||
assert!(cmp(&())); | ||
assert!(wrap(123) == wrap(123)); | ||
assert!(wrap(123) != wrap(456)); | ||
let x = <() as Foo>::huh(); | ||
assert!(x == x); | ||
}; | ||
|
||
#[const_trait] | ||
trait T {} | ||
struct S; | ||
impl const T for S {} | ||
|
||
const fn rpit() -> impl ~const T { S } | ||
|
||
const fn apit(_: impl ~const T + ~const Destruct) {} | ||
|
||
const fn rpit_assoc_bound() -> impl IntoIterator<Item: ~const T> { Some(S) } | ||
|
||
const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~From Destruct) {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Test for #120757, which causes a deadlock bug | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=50 | ||
|
||
#![feature(generic_const_exprs)] | ||
//~^ WARNING | ||
|
||
trait TensorDimension { | ||
const DIM: usize; | ||
const ISSCALAR: bool = Self::DIM == 0; | ||
fn is_scalar(&self) -> bool { | ||
Self::ISSCALAR | ||
} | ||
} | ||
|
||
trait TensorSize: TensorDimension { | ||
fn size(&self) -> [usize; Self::DIM]; | ||
fn inbounds(&self, index: [usize; Self::DIM]) -> bool { | ||
index.iter().zip(self.size().iter()).all(|(i, s)| i < s) | ||
} | ||
} | ||
|
||
trait Broadcastable: TensorSize + Sized { | ||
type Element; | ||
fn bget(&self, index: [usize; Self::DIM]) -> Option<Self::Element>; | ||
fn lazy_updim<const NEWDIM: usize>( | ||
&self, | ||
size: [usize; NEWDIM], | ||
) -> LazyUpdim<Self, { Self::DIM }, NEWDIM> { | ||
assert!( | ||
NEWDIM >= Self::DIM, | ||
"Updimmed tensor cannot have fewer indices than the initial one." | ||
); // const generic bounds on nightly. ( ) | ||
LazyUpdim { size, reference: &self } | ||
} | ||
fn bmap<T, F: Fn(Self::Element) -> T>(&self, foo: F) -> BMap<T, Self, F, { Self::DIM }> { | ||
BMap { reference: self, closure: foo } | ||
} | ||
} | ||
|
||
struct LazyUpdim<'a, T: Broadcastable, const OLDDIM: usize, const DIM: usize> { | ||
size: [usize; DIM], | ||
reference: &'a T, | ||
} | ||
|
||
impl<'a, T: Broadcastable, const DIM: usize> TensorDimension for LazyUpdim<'a, T, { T::DIM }, DIM> { | ||
const DIM: usize = DIM; | ||
} | ||
impl<'a, T: Broadcastable, const DIM: usize> TensorSize for LazyUpdim<'a, T, { T::DIM }, DIM> { | ||
fn size(&self) -> [usize; DIM] { | ||
self.size | ||
} | ||
} | ||
impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> { | ||
type Element = T::Element; | ||
fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | ||
assert!(DIM >= T::DIM); | ||
if !self.inbounds(index) { | ||
return None; | ||
} | ||
let size = self.size(); | ||
//array_init::array_init(|i| if size[i] > 1 {index[i]} else {0}); | ||
let newindex: [usize; T::DIM] = Default::default(); | ||
self.reference.bget(newindex) | ||
} | ||
} | ||
|
||
struct BMap<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> { | ||
reference: &'a T, | ||
closure: F, | ||
} | ||
|
||
impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorDimension | ||
for BMap<'a, R, T, F, DIM> | ||
{ | ||
const DIM: usize = DIM; | ||
} | ||
impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorSize | ||
for BMap<'a, R, T, F, DIM> | ||
{ | ||
fn size(&self) -> [usize; DIM] { | ||
self.reference.size() | ||
} | ||
} | ||
impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> Broadcastable | ||
for BMap<'a, R, T, F, DIM> | ||
{ | ||
type Element = R; | ||
fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> { | ||
self.reference.bget(index).map(ns_window) | ||
} | ||
} | ||
|
||
impl<T> TensorDimension for Vec<T> { | ||
const DIM: usize = 1; | ||
} | ||
impl<T> TensorSize for Vec<T> { | ||
fn size(&self) -> [usize; 1] { | ||
[self.len()] | ||
} | ||
} | ||
impl<T: Clone> Broadcastable for Vec<T> { | ||
type Element = T; | ||
fn bget(&self, index: [usize; 1]) -> Option<T> { | ||
self.get(index[0]).cloned() | ||
} | ||
} | ||
|
||
fn main() { | ||
let v = vec![1, 2, 3]; | ||
let bv = v.lazy_updim([3, 4]); | ||
let bbv = bv.bmap(|x| x * x); | ||
|
||
println!("The size of v is {:?}", bbv.bget([0, 2]).expect("Out of bounds.")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Test for #129911, which causes a deadlock bug | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=16 | ||
|
||
fn main() { | ||
type KooArc = Frc< | ||
{ | ||
{ | ||
{ | ||
{}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
} | ||
type Frc = Frc< | ||
{ | ||
{ | ||
{ | ||
{}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
} | ||
type Frc = Frc< | ||
{ | ||
{ | ||
{ | ||
{}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
} | ||
type Frc = Frc< | ||
{ | ||
{ | ||
{ | ||
{}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
} | ||
type Frc = Frc< | ||
{ | ||
{ | ||
{ | ||
{ | ||
{}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
}; | ||
} | ||
type Frc = Frc< | ||
{ | ||
{ | ||
{ | ||
{}; | ||
}; | ||
} | ||
type Frc = Frc<{}>::Arc;; | ||
}, | ||
>::Arc;; | ||
}, | ||
>::Arc;; | ||
}, | ||
>::Arc;; | ||
}, | ||
>::Arc;; | ||
}, | ||
>::Arc;; | ||
}, | ||
>::Arc; | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Test for #115223, which causes a deadlock bug without finding the cycle | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=16 | ||
//@ run-pass | ||
|
||
#![crate_name = "foo"] | ||
|
||
use std::ops; | ||
|
||
pub struct Foo; | ||
|
||
impl Foo { | ||
pub fn foo(&mut self) {} | ||
} | ||
|
||
pub struct Bar { | ||
foo: Foo, | ||
} | ||
|
||
impl ops::Deref for Bar { | ||
type Target = Foo; | ||
|
||
fn deref(&self) -> &Foo { | ||
&self.foo | ||
} | ||
} | ||
|
||
impl ops::DerefMut for Bar { | ||
fn deref_mut(&mut self) -> &mut Foo { | ||
&mut self.foo | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Test for #120759, which causes an ice bug | ||
// | ||
//@ parallel-front-end-robustness | ||
//@ compile-flags: -Z threads=50 -Zcrate-attr="feature(transmutability)" | ||
|
||
mod assert { | ||
use std::mem::{Assume, BikeshedIntrinsicFrom}; | ||
pub struct Context; | ||
|
||
pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU) | ||
where | ||
Dst: BikeshedIntrinsicFrom<Src, Context>, | ||
{ | ||
} | ||
} | ||
|
||
fn should_pad_explicitly_packed_field() { | ||
#[repr(C)] | ||
struct ExplicitlyPadded(ExplicitlyPadded); | ||
|
||
assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.