Skip to content

Commit

Permalink
Add parallel rustc ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SparrowLii committed Feb 5, 2024
1 parent 0984bec commit 97f5545
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::path::{Path, PathBuf};
// #73494.
const ENTRY_LIMIT: usize = 900;
const ISSUES_ENTRY_LIMIT: usize = 1807;
const ROOT_ENTRY_LIMIT: usize = 870;
const ROOT_ENTRY_LIMIT: usize = 871;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/parallel-rustc/hello_world.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-flags: -Z threads=8
// run-pass

fn main() {
println!("Hello world!");
}
18 changes: 18 additions & 0 deletions tests/ui/parallel-rustc/issue-111520.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// compile-flags: -Z threads=16
// run-pass

#[repr(transparent)]
struct Sched {
i: i32,
}
impl Sched {
extern "C" fn get(self) -> i32 { self.i }
}

fn main() {
let s = Sched { i: 4 };
let f = || -> i32 {
s.get()
};
println!("f: {}", f());
}
16 changes: 16 additions & 0 deletions tests/ui/parallel-rustc/issue-111528.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// compile-flags: -Z threads=16
// build-fail

#![crate_type="rlib"]
#![allow(warnings)]

#[export_name="fail"]
pub fn a() {
}

#[export_name="fail"]
pub fn b() {
//~^ Error symbol `fail` is already defined
}

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/parallel-rustc/issue-111528.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: symbol `fail` is already defined
--> $DIR/issue-111528.rs:12:1
|
LL | pub fn b() {
| ^^^^^^^^^^

error: aborting due to 1 previous error

7 changes: 7 additions & 0 deletions tests/ui/parallel-rustc/issue-118205-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compile-flags:-C extra-filename=-1 -Z threads=16
// no-prefer-dynamic
// build-pass
#![crate_name = "crateresolve1"]
#![crate_type = "lib"]

pub fn f() -> isize { 10 }
22 changes: 22 additions & 0 deletions tests/ui/parallel-rustc/issue-118205.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// compile-flags: -Z threads=16
// build-pass

pub static GLOBAL: isize = 3;

static GLOBAL0: isize = 4;

pub static GLOBAL2: &'static isize = &GLOBAL0;

pub fn verify_same(a: &'static isize) {
let a = a as *const isize as usize;
let b = &GLOBAL as *const isize as usize;
assert_eq!(a, b);
}

pub fn verify_same2(a: &'static isize) {
let a = a as *const isize as usize;
let b = GLOBAL2 as *const isize as usize;
assert_eq!(a, b);
}

fn main() {}
24 changes: 24 additions & 0 deletions tests/ui/parallel-rustc/issue-94654.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// compile-flags: -Z threads=16

use std::collections::BTreeSet;

#[derive(Hash)]
pub enum ElemDerived {
//~^ ERROR E0072
//~| ERROR E0391
A(ElemDerived)
}

pub enum Elem {
Derived(ElemDerived)
}

pub struct Set(BTreeSet<Elem>);

impl Set {
pub fn into_iter(self) -> impl Iterator<Item = Elem> {
self.0.into_iter()
}
}

fn main() {}
32 changes: 32 additions & 0 deletions tests/ui/parallel-rustc/issue-94654.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
error[E0072]: recursive type `ElemDerived` has infinite size
--> $DIR/issue-94654.rs:6:1
|
LL | pub enum ElemDerived {
| ^^^^^^^^^^^^^^^^^^^^
...
LL | A(ElemDerived)
| ----------- recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL | A(Box<ElemDerived>)
| ++++ +

error[E0391]: cycle detected when computing drop-check constraints for `ElemDerived`
--> $DIR/issue-94654.rs:6:1
|
LL | pub enum ElemDerived {
| ^^^^^^^^^^^^^^^^^^^^
|
= note: ...which immediately requires computing drop-check constraints for `ElemDerived` again
note: cycle used when computing drop-check constraints for `Elem`
--> $DIR/issue-94654.rs:12:1
|
LL | pub enum Elem {
| ^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0072, E0391.
For more information about an error, try `rustc --explain E0072`.

0 comments on commit 97f5545

Please sign in to comment.