Skip to content

Commit a4dc487

Browse files
authored
Merge pull request #260 from oli-obk/subtests
Nest sub-tests (revisions, paths) below their main test
2 parents 2de49ab + 3441728 commit a4dc487

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1058
-515
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@aux-build:proc_macro_attr.rs
2+
//@check-pass
3+
4+
extern crate proc_macro_attr;
5+
6+
#[proc_macro_attr::passthrough]
7+
pub fn f() {}
8+
9+
pub fn g() {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@aux-build:derive_proc_macro.rs
2+
3+
#[macro_use]
4+
extern crate derive_proc_macro;
5+
6+
fn main() {
7+
let mut x = Foo;
8+
x = Foo;
9+
//~^ ERROR: cannot assign twice
10+
}
11+
12+
#[derive(Something)]
13+
struct Foo;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@aux-build:derive_proc_macro.rs
2+
3+
#[macro_use]
4+
extern crate derive_proc_macro;
5+
6+
fn main() {
7+
let x = Foo;
8+
x = Foo;
9+
//~^ ERROR: cannot assign twice
10+
}
11+
12+
#[derive(Something)]
13+
struct Foo;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
warning: variable `x` is assigned to, but never used
2+
--> examples_tests/rustc_basic/aux_derive.rs:7:9
3+
|
4+
7 | let x = Foo;
5+
| ^
6+
|
7+
= note: consider using `_x` instead
8+
= note: `#[warn(unused_variables)]` on by default
9+
10+
warning: value assigned to `x` is never read
11+
--> examples_tests/rustc_basic/aux_derive.rs:8:5
12+
|
13+
8 | x = Foo;
14+
| ^
15+
|
16+
= help: maybe it is overwritten before being read?
17+
= note: `#[warn(unused_assignments)]` on by default
18+
19+
error[E0384]: cannot assign twice to immutable variable `x`
20+
--> examples_tests/rustc_basic/aux_derive.rs:8:5
21+
|
22+
7 | let x = Foo;
23+
| -
24+
| |
25+
| first assignment to `x`
26+
| help: consider making this binding mutable: `mut x`
27+
8 | x = Foo;
28+
| ^^^^^^^ cannot assign twice to immutable variable
29+
30+
error: aborting due to 1 previous error; 2 warnings emitted
31+
32+
For more information about this error, try `rustc --explain E0384`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@aux-build:the_proc_macro.rs
2+
3+
use the_proc_macro::thing;
4+
5+
fn main() {
6+
thing!(cake);
7+
//~^ ERROR: cannot find value `cake` in this scope
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0425]: cannot find value `cake` in this scope
2+
--> examples_tests/rustc_basic/aux_proc_macro.rs:6:12
3+
|
4+
6 | thing!(cake);
5+
| ^^^^ not found in this scope
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0425`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@compile-flags: --emit=link -C prefer-dynamic=no
2+
3+
#![crate_type = "proc-macro"]
4+
5+
extern crate proc_macro;
6+
7+
use proc_macro::TokenStream;
8+
9+
#[proc_macro_derive(Something)]
10+
pub fn noop(_: TokenStream) -> TokenStream {
11+
std::thread::sleep(std::time::Duration::from_secs(5));
12+
TokenStream::new()
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extern crate proc_macro;
2+
3+
use proc_macro::TokenStream;
4+
5+
#[proc_macro_attribute]
6+
pub fn passthrough(_: TokenStream, item: TokenStream) -> TokenStream {
7+
std::thread::sleep(std::time::Duration::from_secs(5));
8+
item
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![crate_type = "proc-macro"]
2+
3+
extern crate proc_macro;
4+
5+
use proc_macro::TokenStream;
6+
7+
#[proc_macro]
8+
pub fn thing(input: TokenStream) -> TokenStream {
9+
std::thread::sleep(std::time::Duration::from_secs(5));
10+
input
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@run
2+
3+
fn main() {
4+
std::thread::sleep(std::time::Duration::from_secs(5));
5+
}

0 commit comments

Comments
 (0)