Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2da6e66

Browse files
committedSep 23, 2021
Support incremental in compiletest for non-incremental modes.
1 parent 0132f82 commit 2da6e66

38 files changed

+166
-119
lines changed
 

‎src/test/codegen-units/partitioning/extern-drop-glue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//
22

3-
// We specify -C incremental here because we want to test the partitioning for
3+
// We specify incremental here because we want to test the partitioning for
44
// incremental compilation
55
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
6-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/extern-drop-glue
6+
// incremental
7+
// compile-flags:-Zprint-mono-items=lazy
78
// compile-flags:-Zinline-in-all-cgus -Copt-level=0
89

910
#![allow(dead_code)]

‎src/test/codegen-units/partitioning/extern-generic.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
4-
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/extern-generic -Zshare-generics=y
4+
// incremental
5+
// compile-flags:-Zprint-mono-items=eager -Zshare-generics=y
56

67
#![allow(dead_code)]
78
#![crate_type="lib"]

‎src/test/codegen-units/partitioning/incremental-merging.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// We specify -C incremental here because we want to test the partitioning for
1+
// We specify incremental here because we want to test the partitioning for
22
// incremental compilation
3-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/incremental-merging
3+
// incremental
4+
// compile-flags:-Zprint-mono-items=lazy
45
// compile-flags:-Ccodegen-units=3
56

67
#![crate_type = "rlib"]

‎src/test/codegen-units/partitioning/inlining-from-extern-crate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
4-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/inlining-from-extern-crate
4+
// incremental
5+
// compile-flags:-Zprint-mono-items=lazy
56
// compile-flags:-Zinline-in-all-cgus
67

78
#![crate_type="lib"]

‎src/test/codegen-units/partitioning/local-drop-glue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
44
// We specify opt-level=0 because `drop_in_place` is `Internal` when optimizing
5-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-drop-glue
5+
// incremental
6+
// compile-flags:-Zprint-mono-items=lazy
67
// compile-flags:-Zinline-in-all-cgus -Copt-level=0
78

89
#![allow(dead_code)]

‎src/test/codegen-units/partitioning/local-generic.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// We specify -C incremental here because we want to test the partitioning for
1+
// We specify incremental here because we want to test the partitioning for
22
// incremental compilation
3-
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/local-generic
3+
// incremental
4+
// compile-flags:-Zprint-mono-items=eager
45

56
#![allow(dead_code)]
67
#![crate_type="lib"]

‎src/test/codegen-units/partitioning/local-inlining-but-not-all.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
4-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-inlining-but-not-all
4+
// incremental
5+
// compile-flags:-Zprint-mono-items=lazy
56
// compile-flags:-Zinline-in-all-cgus=no
67

78
#![allow(dead_code)]

‎src/test/codegen-units/partitioning/local-inlining.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
4-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-inlining
4+
// incremental
5+
// compile-flags:-Zprint-mono-items=lazy
56
// compile-flags:-Zinline-in-all-cgus
67

78
#![allow(dead_code)]

‎src/test/codegen-units/partitioning/local-transitive-inlining.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//
2-
// We specify -C incremental here because we want to test the partitioning for
2+
// We specify incremental here because we want to test the partitioning for
33
// incremental compilation
4-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/local-transitive-inlining
4+
// incremental
5+
// compile-flags:-Zprint-mono-items=lazy
56
// compile-flags:-Zinline-in-all-cgus
67

78
#![allow(dead_code)]

‎src/test/codegen-units/partitioning/methods-are-with-self-type.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
// ignore-test
55

66
//
7-
// We specify -C incremental here because we want to test the partitioning for
7+
// We specify incremental here because we want to test the partitioning for
88
// incremental compilation
9-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/methods-are-with-self-type
9+
// incremental
10+
// compile-flags:-Zprint-mono-items=lazy
1011

1112
#![allow(dead_code)]
1213
#![feature(start)]

‎src/test/codegen-units/partitioning/regular-modules.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// We specify -C incremental here because we want to test the partitioning for
1+
// We specify incremental here because we want to test the partitioning for
22
// incremental compilation
3-
// compile-flags:-Zprint-mono-items=eager -Cincremental=tmp/partitioning-tests/regular-modules
3+
// incremental
4+
// compile-flags:-Zprint-mono-items=eager
45

56
#![allow(dead_code)]
67
#![crate_type="lib"]

‎src/test/codegen-units/partitioning/shared-generics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// no-prefer-dynamic
33
// NOTE: We always compile this test with -Copt-level=0 because higher opt-levels
44
// prevent drop-glue from participating in share-generics.
5-
// compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Cincremental=tmp/partitioning-tests/shared-generics-exe -Copt-level=0
5+
// incremental
6+
// compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Copt-level=0
67

78
#![crate_type="rlib"]
89

‎src/test/codegen-units/partitioning/statics.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// We specify -C incremental here because we want to test the partitioning for
1+
// We specify incremental here because we want to test the partitioning for
22
// incremental compilation
3-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/statics
3+
// incremental
4+
// compile-flags:-Zprint-mono-items=lazy
45

56
#![crate_type="rlib"]
67

‎src/test/codegen-units/partitioning/vtable-through-const.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//
22

3-
// We specify -C incremental here because we want to test the partitioning for
3+
// We specify incremental here because we want to test the partitioning for
44
// incremental compilation
5-
// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/vtable-through-const
5+
// incremental
6+
// compile-flags:-Zprint-mono-items=lazy
67
// compile-flags:-Zinline-in-all-cgus
78

89
// This test case makes sure, that references made through constants are

‎src/test/ui/associated-type-bounds/traits-assoc-type-macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
// compile-flags:-Cincremental=tmp/traits-assoc-type-macros
2+
// incremental
33

44
// This test case makes sure that we can compile with incremental compilation
55
// enabled when there are macros, traits, inheritance and associated types involved.

‎src/test/ui/async-await/issue-72442.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// edition:2018
2-
// compile-flags:-Cincremental=tmp/issue-72442
2+
// incremental
33

44
use std::fs::File;
55
use std::future::Future;

‎src/test/ui/async-await/issues/issue-64964.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// check-pass
2-
// compile-flags: -Z query-dep-graph -C incremental=tmp/issue-64964
2+
// incremental
3+
// compile-flags: -Z query-dep-graph
34
// edition:2018
45

56
// Regression test for ICE related to `await`ing in a method + incr. comp. (#64964)

‎src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that when a trait impl changes, fns whose body uses that trait
22
// must also be recompiled.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-assoc-type-codegen
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(warnings)]

‎src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: OK
2-
--> $DIR/dep-graph-assoc-type-codegen.rs:28:5
2+
--> $DIR/dep-graph-assoc-type-codegen.rs:29:5
33
|
44
LL | #[rustc_then_this_would_need(typeck)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-caller-callee.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that immediate callers have to change when callee changes, but
22
// not callers' callers.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-caller-callee
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(dead_code)]

‎src/test/ui/dep-graph/dep-graph-caller-callee.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: OK
2-
--> $DIR/dep-graph-caller-callee.rs:20:5
2+
--> $DIR/dep-graph-caller-callee.rs:21:5
33
|
44
LL | #[rustc_then_this_would_need(typeck)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: no path from `x` to `typeck`
8-
--> $DIR/dep-graph-caller-callee.rs:31:5
8+
--> $DIR/dep-graph-caller-callee.rs:32:5
99
|
1010
LL | #[rustc_then_this_would_need(typeck)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-struct-signature.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test cases where a changing struct appears in the signature of fns
22
// and methods.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-struct-signature
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(dead_code)]

‎src/test/ui/dep-graph/dep-graph-struct-signature.stderr

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
11
error: no path from `WillChange` to `type_of`
2-
--> $DIR/dep-graph-struct-signature.rs:27:5
2+
--> $DIR/dep-graph-struct-signature.rs:28:5
33
|
44
LL | #[rustc_then_this_would_need(type_of)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: no path from `WillChange` to `associated_item`
8-
--> $DIR/dep-graph-struct-signature.rs:28:5
8+
--> $DIR/dep-graph-struct-signature.rs:29:5
99
|
1010
LL | #[rustc_then_this_would_need(associated_item)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: no path from `WillChange` to `trait_def`
14-
--> $DIR/dep-graph-struct-signature.rs:29:5
14+
--> $DIR/dep-graph-struct-signature.rs:30:5
1515
|
1616
LL | #[rustc_then_this_would_need(trait_def)]
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: OK
20-
--> $DIR/dep-graph-struct-signature.rs:31:9
20+
--> $DIR/dep-graph-struct-signature.rs:32:9
2121
|
2222
LL | #[rustc_then_this_would_need(fn_sig)]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error: OK
26-
--> $DIR/dep-graph-struct-signature.rs:35:5
26+
--> $DIR/dep-graph-struct-signature.rs:36:5
2727
|
2828
LL | #[rustc_then_this_would_need(fn_sig)]
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error: OK
32-
--> $DIR/dep-graph-struct-signature.rs:36:5
32+
--> $DIR/dep-graph-struct-signature.rs:37:5
3333
|
3434
LL | #[rustc_then_this_would_need(typeck)]
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
error: OK
38-
--> $DIR/dep-graph-struct-signature.rs:39:5
38+
--> $DIR/dep-graph-struct-signature.rs:40:5
3939
|
4040
LL | #[rustc_then_this_would_need(fn_sig)]
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242

4343
error: OK
44-
--> $DIR/dep-graph-struct-signature.rs:40:5
44+
--> $DIR/dep-graph-struct-signature.rs:41:5
4545
|
4646
LL | #[rustc_then_this_would_need(typeck)]
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4848

4949
error: OK
50-
--> $DIR/dep-graph-struct-signature.rs:45:5
50+
--> $DIR/dep-graph-struct-signature.rs:46:5
5151
|
5252
LL | #[rustc_then_this_would_need(type_of)]
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5454

5555
error: OK
56-
--> $DIR/dep-graph-struct-signature.rs:47:9
56+
--> $DIR/dep-graph-struct-signature.rs:48:9
5757
|
5858
LL | #[rustc_then_this_would_need(fn_sig)]
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6060

6161
error: OK
62-
--> $DIR/dep-graph-struct-signature.rs:48:9
62+
--> $DIR/dep-graph-struct-signature.rs:49:9
6363
|
6464
LL | #[rustc_then_this_would_need(typeck)]
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6666

6767
error: OK
68-
--> $DIR/dep-graph-struct-signature.rs:52:5
68+
--> $DIR/dep-graph-struct-signature.rs:53:5
6969
|
7070
LL | #[rustc_then_this_would_need(type_of)]
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7272

7373
error: OK
74-
--> $DIR/dep-graph-struct-signature.rs:54:9
74+
--> $DIR/dep-graph-struct-signature.rs:55:9
7575
|
7676
LL | #[rustc_then_this_would_need(fn_sig)]
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7878

7979
error: OK
80-
--> $DIR/dep-graph-struct-signature.rs:55:9
80+
--> $DIR/dep-graph-struct-signature.rs:56:9
8181
|
8282
LL | #[rustc_then_this_would_need(typeck)]
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8484

8585
error: OK
86-
--> $DIR/dep-graph-struct-signature.rs:60:9
86+
--> $DIR/dep-graph-struct-signature.rs:61:9
8787
|
8888
LL | #[rustc_then_this_would_need(type_of)]
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9090

9191
error: OK
92-
--> $DIR/dep-graph-struct-signature.rs:62:9
92+
--> $DIR/dep-graph-struct-signature.rs:63:9
9393
|
9494
LL | #[rustc_then_this_would_need(type_of)]
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9696

9797
error: no path from `WillChange` to `type_of`
98-
--> $DIR/dep-graph-struct-signature.rs:67:5
98+
--> $DIR/dep-graph-struct-signature.rs:68:5
9999
|
100100
LL | #[rustc_then_this_would_need(type_of)]
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
102102

103103
error: no path from `WillChange` to `type_of`
104-
--> $DIR/dep-graph-struct-signature.rs:74:5
104+
--> $DIR/dep-graph-struct-signature.rs:75:5
105105
|
106106
LL | #[rustc_then_this_would_need(type_of)]
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
108108

109109
error: no path from `WillChange` to `fn_sig`
110-
--> $DIR/dep-graph-struct-signature.rs:76:9
110+
--> $DIR/dep-graph-struct-signature.rs:77:9
111111
|
112112
LL | #[rustc_then_this_would_need(fn_sig)]
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114114

115115
error: no path from `WillChange` to `fn_sig`
116-
--> $DIR/dep-graph-struct-signature.rs:80:5
116+
--> $DIR/dep-graph-struct-signature.rs:81:5
117117
|
118118
LL | #[rustc_then_this_would_need(fn_sig)]
119119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120120

121121
error: no path from `WillChange` to `fn_sig`
122-
--> $DIR/dep-graph-struct-signature.rs:83:5
122+
--> $DIR/dep-graph-struct-signature.rs:84:5
123123
|
124124
LL | #[rustc_then_this_would_need(fn_sig)]
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126126

127127
error: no path from `WillChange` to `typeck`
128-
--> $DIR/dep-graph-struct-signature.rs:84:5
128+
--> $DIR/dep-graph-struct-signature.rs:85:5
129129
|
130130
LL | #[rustc_then_this_would_need(typeck)]
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that adding an impl to a trait `Foo` DOES affect functions
22
// that only use `Bar` if they have methods in common.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-trait-impl-two-traits-same-method
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(dead_code)]

‎src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: OK
2-
--> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:32:5
2+
--> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:33:5
33
|
44
LL | #[rustc_then_this_would_need(typeck)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: no path from `x::<impl Foo for u32>` to `typeck`
8-
--> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:41:5
8+
--> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:42:5
99
|
1010
LL | #[rustc_then_this_would_need(typeck)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that adding an impl to a trait `Foo` does not affect functions
22
// that only use `Bar`, so long as they do not have methods in common.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-trait-impl-two-traits
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(warnings)]

‎src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: no path from `x::<impl Foo for char>` to `typeck`
2-
--> $DIR/dep-graph-trait-impl-two-traits.rs:31:5
2+
--> $DIR/dep-graph-trait-impl-two-traits.rs:32:5
33
|
44
LL | #[rustc_then_this_would_need(typeck)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: no path from `x::<impl Foo for char>` to `typeck`
8-
--> $DIR/dep-graph-trait-impl-two-traits.rs:40:5
8+
--> $DIR/dep-graph-trait-impl-two-traits.rs:41:5
99
|
1010
LL | #[rustc_then_this_would_need(typeck)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-trait-impl.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that when a trait impl changes, fns whose body uses that trait
22
// must also be recompiled.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-trait-impl
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(warnings)]

‎src/test/ui/dep-graph/dep-graph-trait-impl.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error: OK
2-
--> $DIR/dep-graph-trait-impl.rs:27:5
2+
--> $DIR/dep-graph-trait-impl.rs:28:5
33
|
44
LL | #[rustc_then_this_would_need(typeck)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: OK
8-
--> $DIR/dep-graph-trait-impl.rs:32:5
8+
--> $DIR/dep-graph-trait-impl.rs:33:5
99
|
1010
LL | #[rustc_then_this_would_need(typeck)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: OK
14-
--> $DIR/dep-graph-trait-impl.rs:37:5
14+
--> $DIR/dep-graph-trait-impl.rs:38:5
1515
|
1616
LL | #[rustc_then_this_would_need(typeck)]
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: OK
20-
--> $DIR/dep-graph-trait-impl.rs:42:5
20+
--> $DIR/dep-graph-trait-impl.rs:43:5
2121
|
2222
LL | #[rustc_then_this_would_need(typeck)]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error: no path from `x::<impl Foo for char>` to `typeck`
26-
--> $DIR/dep-graph-trait-impl.rs:55:5
26+
--> $DIR/dep-graph-trait-impl.rs:56:5
2727
|
2828
LL | #[rustc_then_this_would_need(typeck)]
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-type-alias.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Test that changing what a `type` points to does not go unnoticed.
22

3-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-type-alias
3+
// incremental
4+
// compile-flags: -Z query-dep-graph
45

56
#![feature(rustc_attrs)]
67
#![allow(dead_code)]

‎src/test/ui/dep-graph/dep-graph-type-alias.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
11
error: no path from `TypeAlias` to `type_of`
2-
--> $DIR/dep-graph-type-alias.rs:17:1
2+
--> $DIR/dep-graph-type-alias.rs:18:1
33
|
44
LL | #[rustc_then_this_would_need(type_of)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: OK
8-
--> $DIR/dep-graph-type-alias.rs:19:5
8+
--> $DIR/dep-graph-type-alias.rs:20:5
99
|
1010
LL | #[rustc_then_this_would_need(type_of)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: no path from `TypeAlias` to `type_of`
14-
--> $DIR/dep-graph-type-alias.rs:24:1
14+
--> $DIR/dep-graph-type-alias.rs:25:1
1515
|
1616
LL | #[rustc_then_this_would_need(type_of)]
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error: OK
20-
--> $DIR/dep-graph-type-alias.rs:27:9
20+
--> $DIR/dep-graph-type-alias.rs:28:9
2121
|
2222
LL | #[rustc_then_this_would_need(type_of)]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error: no path from `TypeAlias` to `type_of`
26-
--> $DIR/dep-graph-type-alias.rs:33:1
26+
--> $DIR/dep-graph-type-alias.rs:34:1
2727
|
2828
LL | #[rustc_then_this_would_need(type_of)]
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error: OK
32-
--> $DIR/dep-graph-type-alias.rs:35:5
32+
--> $DIR/dep-graph-type-alias.rs:36:5
3333
|
3434
LL | #[rustc_then_this_would_need(fn_sig)]
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
error: no path from `TypeAlias` to `type_of`
38-
--> $DIR/dep-graph-type-alias.rs:41:1
38+
--> $DIR/dep-graph-type-alias.rs:42:1
3939
|
4040
LL | #[rustc_then_this_would_need(type_of)]
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242

4343
error: OK
44-
--> $DIR/dep-graph-type-alias.rs:43:5
44+
--> $DIR/dep-graph-type-alias.rs:44:5
4545
|
4646
LL | #[rustc_then_this_would_need(fn_sig)]
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4848

4949
error: OK
50-
--> $DIR/dep-graph-type-alias.rs:44:5
50+
--> $DIR/dep-graph-type-alias.rs:45:5
5151
|
5252
LL | #[rustc_then_this_would_need(typeck)]
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5454

5555
error: OK
56-
--> $DIR/dep-graph-type-alias.rs:48:1
56+
--> $DIR/dep-graph-type-alias.rs:49:1
5757
|
5858
LL | #[rustc_then_this_would_need(type_of)]
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6060

6161
error: OK
62-
--> $DIR/dep-graph-type-alias.rs:51:1
62+
--> $DIR/dep-graph-type-alias.rs:52:1
6363
|
6464
LL | #[rustc_then_this_would_need(fn_sig)]
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6666

6767
error: OK
68-
--> $DIR/dep-graph-type-alias.rs:52:1
68+
--> $DIR/dep-graph-type-alias.rs:53:1
6969
|
7070
LL | #[rustc_then_this_would_need(typeck)]
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/dep-graph/dep-graph-variance-alias.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Test that changing what a `type` points to does not go unnoticed
22
// by the variance analysis.
33

4-
// compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-variance-alias
4+
// incremental
5+
// compile-flags: -Z query-dep-graph
56

67
#![feature(rustc_attrs)]
78
#![allow(dead_code)]

‎src/test/ui/dep-graph/dep-graph-variance-alias.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: OK
2-
--> $DIR/dep-graph-variance-alias.rs:18:1
2+
--> $DIR/dep-graph-variance-alias.rs:19:1
33
|
44
LL | #[rustc_then_this_would_need(variances_of)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/suggestions/issue-72766.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// edition:2018
2-
// compile-flags: -Cincremental=tmp/issue-72766
2+
// incremental
33

44
pub struct SadGirl;
55

‎src/test/ui/wf/hir-wf-check-erase-regions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Regression test for #87549.
2-
// compile-flags: -C incremental=tmp/wf/hir-wf-check-erase-regions
2+
// incremental
33

44
pub struct Table<T, const N: usize>([Option<T>; N]);
55

‎src/tools/compiletest/src/common.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,9 @@ pub fn output_base_dir(config: &Config, testpaths: &TestPaths, revision: Option<
459459
pub fn output_base_name(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> PathBuf {
460460
output_base_dir(config, testpaths, revision).join(testpaths.file.file_stem().unwrap())
461461
}
462+
463+
/// Absolute path to the directory to use for incremental compilation. Example:
464+
/// /path/to/build/host-triple/test/ui/relative/testname.mode/testname.inc
465+
pub fn incremental_dir(config: &Config, testpaths: &TestPaths) -> PathBuf {
466+
output_base_name(config, testpaths, None).with_extension("inc")
467+
}

‎src/tools/compiletest/src/header.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ pub struct TestProps {
113113
// testing harness and used when generating compilation
114114
// arguments. (In particular, it propagates to the aux-builds.)
115115
pub incremental_dir: Option<PathBuf>,
116+
// If `true`, this test will use incremental compilation.
117+
//
118+
// This can be set manually with the `incremental` header, or implicitly
119+
// by being a part of an incremental mode test. Using the `incremental`
120+
// header should be avoided if possible; using an incremental mode test is
121+
// preferred. Incremental mode tests support multiple passes, which can
122+
// verify that the incremental cache can be loaded properly after being
123+
// created. Just setting the header will only verify the behavior with
124+
// creating an incremental cache, but doesn't check that it is created
125+
// correctly.
126+
//
127+
// Compiletest will create the incremental directory, and ensure it is
128+
// empty before the test starts. Incremental mode tests will reuse the
129+
// incremental directory between passes in the same test.
130+
pub incremental: bool,
116131
// How far should the test proceed while still passing.
117132
pass_mode: Option<PassMode>,
118133
// Ignore `--pass` overrides from the command line for this test.
@@ -163,6 +178,7 @@ impl TestProps {
163178
pretty_compare_only: false,
164179
forbid_output: vec![],
165180
incremental_dir: None,
181+
incremental: false,
166182
pass_mode: None,
167183
fail_mode: None,
168184
ignore_pass: false,
@@ -350,6 +366,10 @@ impl TestProps {
350366
if !self.stderr_per_bitwidth {
351367
self.stderr_per_bitwidth = config.parse_stderr_per_bitwidth(ln);
352368
}
369+
370+
if !self.incremental {
371+
self.incremental = config.parse_incremental(ln);
372+
}
353373
});
354374
}
355375

@@ -360,6 +380,10 @@ impl TestProps {
360380
self.failure_status = 101;
361381
}
362382

383+
if config.mode == Mode::Incremental {
384+
self.incremental = true;
385+
}
386+
363387
for key in &["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
364388
if let Ok(val) = env::var(key) {
365389
if self.exec_env.iter().find(|&&(ref x, _)| x == key).is_none() {
@@ -731,6 +755,10 @@ impl Config {
731755
fn parse_edition(&self, line: &str) -> Option<String> {
732756
self.parse_name_value_directive(line, "edition")
733757
}
758+
759+
fn parse_incremental(&self, line: &str) -> bool {
760+
self.parse_name_directive(line, "incremental")
761+
}
734762
}
735763

736764
fn expand_variables(mut value: String, config: &Config) -> String {

‎src/tools/compiletest/src/runtest.rs

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ignore-tidy-filelength
22

33
use crate::common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT};
4-
use crate::common::{output_base_dir, output_base_name, output_testname_unique};
4+
use crate::common::{incremental_dir, output_base_dir, output_base_name, output_testname_unique};
55
use crate::common::{Assembly, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui};
66
use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc};
77
use crate::common::{CompareMode, FailMode, PassMode};
@@ -229,18 +229,24 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
229229
print!("\n\n");
230230
}
231231
debug!("running {:?}", testpaths.file.display());
232-
let props = TestProps::from_file(&testpaths.file, revision, &config);
232+
let mut props = TestProps::from_file(&testpaths.file, revision, &config);
233+
if props.incremental {
234+
props.incremental_dir = Some(incremental_dir(&config, testpaths));
235+
}
233236

234237
let cx = TestCx { config: &config, props: &props, testpaths, revision };
235238
create_dir_all(&cx.output_base_dir()).unwrap();
239+
if props.incremental {
240+
cx.init_incremental_test();
241+
}
236242

237243
if config.mode == Incremental {
238244
// Incremental tests are special because they cannot be run in
239245
// parallel.
240246
assert!(!props.revisions.is_empty(), "Incremental tests require revisions.");
241-
cx.init_incremental_test();
242247
for revision in &props.revisions {
243-
let revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
248+
let mut revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
249+
revision_props.incremental_dir = props.incremental_dir.clone();
244250
let rev_cx = TestCx {
245251
config: &config,
246252
props: &revision_props,
@@ -2937,7 +2943,7 @@ impl<'test> TestCx<'test> {
29372943
// incremental workproduct directory. Delete any old
29382944
// incremental work products that may be there from prior
29392945
// runs.
2940-
let incremental_dir = self.incremental_dir();
2946+
let incremental_dir = self.props.incremental_dir.as_ref().unwrap();
29412947
if incremental_dir.exists() {
29422948
// Canonicalizing the path will convert it to the //?/ format
29432949
// on Windows, which enables paths longer than 260 character
@@ -2947,7 +2953,7 @@ impl<'test> TestCx<'test> {
29472953
fs::create_dir_all(&incremental_dir).unwrap();
29482954

29492955
if self.config.verbose {
2950-
print!("init_incremental_test: incremental_dir={}", incremental_dir.display());
2956+
println!("init_incremental_test: incremental_dir={}", incremental_dir.display());
29512957
}
29522958
}
29532959

@@ -2974,46 +2980,30 @@ impl<'test> TestCx<'test> {
29742980
let revision = self.revision.expect("incremental tests require a list of revisions");
29752981

29762982
// Incremental workproduct directory should have already been created.
2977-
let incremental_dir = self.incremental_dir();
2983+
let incremental_dir = self.props.incremental_dir.as_ref().unwrap();
29782984
assert!(incremental_dir.exists(), "init_incremental_test failed to create incremental dir");
29792985

2980-
// Add an extra flag pointing at the incremental directory.
2981-
let mut revision_props = self.props.clone();
2982-
revision_props.incremental_dir = Some(incremental_dir);
2983-
2984-
let revision_cx = TestCx {
2985-
config: self.config,
2986-
props: &revision_props,
2987-
testpaths: self.testpaths,
2988-
revision: self.revision,
2989-
};
2990-
29912986
if self.config.verbose {
2992-
print!("revision={:?} revision_props={:#?}", revision, revision_props);
2987+
print!("revision={:?} props={:#?}", revision, self.props);
29932988
}
29942989

29952990
if revision.starts_with("rpass") {
2996-
if revision_cx.props.should_ice {
2997-
revision_cx.fatal("can only use should-ice in cfail tests");
2991+
if self.props.should_ice {
2992+
self.fatal("can only use should-ice in cfail tests");
29982993
}
2999-
revision_cx.run_rpass_test();
2994+
self.run_rpass_test();
30002995
} else if revision.starts_with("rfail") {
3001-
if revision_cx.props.should_ice {
3002-
revision_cx.fatal("can only use should-ice in cfail tests");
2996+
if self.props.should_ice {
2997+
self.fatal("can only use should-ice in cfail tests");
30032998
}
3004-
revision_cx.run_rfail_test();
2999+
self.run_rfail_test();
30053000
} else if revision.starts_with("cfail") {
3006-
revision_cx.run_cfail_test();
3001+
self.run_cfail_test();
30073002
} else {
3008-
revision_cx.fatal("revision name must begin with rpass, rfail, or cfail");
3003+
self.fatal("revision name must begin with rpass, rfail, or cfail");
30093004
}
30103005
}
30113006

3012-
/// Directory where incremental work products are stored.
3013-
fn incremental_dir(&self) -> PathBuf {
3014-
self.output_base_name().with_extension("inc")
3015-
}
3016-
30173007
fn run_rmake_test(&self) {
30183008
let cwd = env::current_dir().unwrap();
30193009
let src_root = self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();

0 commit comments

Comments
 (0)
Please sign in to comment.