Skip to content

Commit cedae73

Browse files
Fix incremental tests after change to instantiation strategy.
1 parent 6a36594 commit cedae73

File tree

18 files changed

+285
-275
lines changed

18 files changed

+285
-275
lines changed

src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,73 +12,72 @@
1212
// crate. This should not cause anything we use to be invalidated.
1313
// Regression test for #36168.
1414

15-
// revisions:rpass1 rpass2
15+
// revisions:cfail1 cfail2
1616
// compile-flags: -Z query-dep-graph
1717
// aux-build:point.rs
18+
// must-compile-successfully
1819

1920
#![feature(rustc_attrs)]
2021
#![feature(stmt_expr_attributes)]
2122
#![allow(dead_code)]
23+
#![crate_type = "rlib"]
2224

23-
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
24-
#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="rpass2")]
25-
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
26-
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
27-
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
25+
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
26+
#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="cfail2")]
27+
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
28+
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
29+
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
2830

2931
extern crate point;
3032

3133
/// A fn item that calls (public) methods on `Point` from the same impl
32-
mod fn_calls_methods_in_same_impl {
34+
pub mod fn_calls_methods_in_same_impl {
3335
use point::Point;
3436

35-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
37+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
3638
pub fn check() {
3739
let x = Point { x: 2.0, y: 2.0 };
3840
x.distance_from_origin();
3941
}
4042
}
4143

4244
/// A fn item that calls (public) methods on `Point` from another impl
43-
mod fn_calls_free_fn {
45+
pub mod fn_calls_free_fn {
4446
use point::{self, Point};
4547

46-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
48+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
4749
pub fn check() {
4850
let x = Point { x: 2.0, y: 2.0 };
4951
point::distance_squared(&x);
5052
}
5153
}
5254

5355
/// A fn item that makes an instance of `Point` but does not invoke methods
54-
mod fn_make_struct {
56+
pub mod fn_make_struct {
5557
use point::Point;
5658

57-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
59+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
5860
pub fn make_origin() -> Point {
5961
Point { x: 2.0, y: 2.0 }
6062
}
6163
}
6264

6365
/// A fn item that reads fields from `Point` but does not invoke methods
64-
mod fn_read_field {
66+
pub mod fn_read_field {
6567
use point::Point;
6668

67-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
69+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
6870
pub fn get_x(p: Point) -> f32 {
6971
p.x
7072
}
7173
}
7274

7375
/// A fn item that writes to a field of `Point` but does not invoke methods
74-
mod fn_write_field {
76+
pub mod fn_write_field {
7577
use point::Point;
7678

77-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
79+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
7880
pub fn inc_x(p: &mut Point) {
7981
p.x += 1.0;
8082
}
8183
}
82-
83-
fn main() {
84-
}

src/test/incremental/change_add_field/struct_point.rs

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,34 @@
1313
// Fns with that type used only in their body are also recompiled, but
1414
// their callers are not.
1515

16-
// revisions:rpass1 rpass2
16+
// revisions:cfail1 cfail2
1717
// compile-flags: -Z query-dep-graph
18+
// must-compile-successfully
1819

1920
#![feature(rustc_attrs)]
2021
#![feature(stmt_expr_attributes)]
2122
#![allow(dead_code)]
23+
#![crate_type = "rlib"]
2224

2325
// These are expected to require translation.
24-
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
25-
#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="rpass2")]
26-
#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="rpass2")]
27-
#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="rpass2")]
28-
#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="rpass2")]
29-
#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="rpass2")]
30-
#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="rpass2")]
31-
32-
#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="rpass2")]
33-
34-
mod point {
35-
#[cfg(rpass1)]
26+
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
27+
#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="cfail2")]
28+
#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="cfail2")]
29+
#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="cfail2")]
30+
#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="cfail2")]
31+
#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="cfail2")]
32+
#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="cfail2")]
33+
34+
#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="cfail2")]
35+
36+
pub mod point {
37+
#[cfg(cfail1)]
3638
pub struct Point {
3739
pub x: f32,
3840
pub y: f32,
3941
}
4042

41-
#[cfg(rpass2)]
43+
#[cfg(cfail2)]
4244
pub struct Point {
4345
pub x: f32,
4446
pub y: f32,
@@ -47,18 +49,18 @@ mod point {
4749

4850
impl Point {
4951
pub fn origin() -> Point {
50-
#[cfg(rpass1)]
52+
#[cfg(cfail1)]
5153
return Point { x: 0.0, y: 0.0 };
5254

53-
#[cfg(rpass2)]
55+
#[cfg(cfail2)]
5456
return Point { x: 0.0, y: 0.0, z: 0.0 };
5557
}
5658

5759
pub fn total(&self) -> f32 {
58-
#[cfg(rpass1)]
60+
#[cfg(cfail1)]
5961
return self.x + self.y;
6062

61-
#[cfg(rpass2)]
63+
#[cfg(cfail2)]
6264
return self.x + self.y + self.z;
6365
}
6466

@@ -75,10 +77,10 @@ mod point {
7577
/// sufficiently "private", we might not need to type-check again.
7678
/// Rebuilding is probably always necessary since the layout may be
7779
/// affected.
78-
mod fn_with_type_in_sig {
80+
pub mod fn_with_type_in_sig {
7981
use point::Point;
8082

81-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
83+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
8284
pub fn boop(p: Option<&Point>) -> f32 {
8385
p.map(|p| p.total()).unwrap_or(0.0)
8486
}
@@ -91,10 +93,10 @@ mod fn_with_type_in_sig {
9193
/// sufficiently "private", we might not need to type-check again.
9294
/// Rebuilding is probably always necessary since the layout may be
9395
/// affected.
94-
mod call_fn_with_type_in_sig {
96+
pub mod call_fn_with_type_in_sig {
9597
use fn_with_type_in_sig;
9698

97-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
99+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
98100
pub fn bip() -> f32 {
99101
fn_with_type_in_sig::boop(None)
100102
}
@@ -107,10 +109,10 @@ mod call_fn_with_type_in_sig {
107109
/// sufficiently "private", we might not need to type-check again.
108110
/// Rebuilding is probably always necessary since the layout may be
109111
/// affected.
110-
mod fn_with_type_in_body {
112+
pub mod fn_with_type_in_body {
111113
use point::Point;
112114

113-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
115+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
114116
pub fn boop() -> f32 {
115117
Point::origin().total()
116118
}
@@ -120,44 +122,41 @@ mod fn_with_type_in_body {
120122
/// body. In this case, the effects of the change should be contained
121123
/// to Y; X should not have to be rebuilt, nor should it need to be
122124
/// typechecked again.
123-
mod call_fn_with_type_in_body {
125+
pub mod call_fn_with_type_in_body {
124126
use fn_with_type_in_body;
125127

126-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
128+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
127129
pub fn bip() -> f32 {
128130
fn_with_type_in_body::boop()
129131
}
130132
}
131133

132134
/// A fn item that makes an instance of `Point` but does not invoke methods
133-
mod fn_make_struct {
135+
pub mod fn_make_struct {
134136
use point::Point;
135137

136-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
138+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
137139
pub fn make_origin(p: Point) -> Point {
138140
Point { ..p }
139141
}
140142
}
141143

142144
/// A fn item that reads fields from `Point` but does not invoke methods
143-
mod fn_read_field {
145+
pub mod fn_read_field {
144146
use point::Point;
145147

146-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
148+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
147149
pub fn get_x(p: Point) -> f32 {
148150
p.x
149151
}
150152
}
151153

152154
/// A fn item that writes to a field of `Point` but does not invoke methods
153-
mod fn_write_field {
155+
pub mod fn_write_field {
154156
use point::Point;
155157

156-
#[rustc_dirty(label="TypeckTables", cfg="rpass2")]
158+
#[rustc_dirty(label="TypeckTables", cfg="cfail2")]
157159
pub fn inc_x(p: &mut Point) {
158160
p.x += 1.0;
159161
}
160162
}
161-
162-
fn main() {
163-
}

src/test/incremental/change_private_fn/struct_point.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,34 @@
1111
// Test where we change the body of a private method in an impl.
1212
// We then test what sort of functions must be rebuilt as a result.
1313

14-
// revisions:rpass1 rpass2
14+
// revisions:cfail1 cfail2
1515
// compile-flags: -Z query-dep-graph
16+
// must-compile-successfully
1617

1718
#![feature(rustc_attrs)]
1819
#![feature(stmt_expr_attributes)]
1920
#![allow(dead_code)]
21+
#![crate_type = "rlib"]
2022

21-
#![rustc_partition_translated(module="struct_point-point", cfg="rpass2")]
23+
#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")]
2224

23-
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="rpass2")]
24-
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="rpass2")]
25-
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="rpass2")]
26-
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="rpass2")]
27-
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="rpass2")]
25+
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")]
26+
#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")]
27+
#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")]
28+
#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="cfail2")]
29+
#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="cfail2")]
2830

29-
mod point {
31+
pub mod point {
3032
pub struct Point {
3133
pub x: f32,
3234
pub y: f32,
3335
}
3436

3537
fn distance_squared(this: &Point) -> f32 {
36-
#[cfg(rpass1)]
38+
#[cfg(cfail1)]
3739
return this.x + this.y;
3840

39-
#[cfg(rpass2)]
41+
#[cfg(cfail2)]
4042
return this.x * this.x + this.y * this.y;
4143
}
4244

@@ -56,56 +58,53 @@ mod point {
5658
}
5759

5860
/// A fn item that calls (public) methods on `Point` from the same impl which changed
59-
mod fn_calls_methods_in_same_impl {
61+
pub mod fn_calls_methods_in_same_impl {
6062
use point::Point;
6163

62-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
64+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
6365
pub fn check() {
6466
let x = Point { x: 2.0, y: 2.0 };
6567
x.distance_from_origin();
6668
}
6769
}
6870

6971
/// A fn item that calls (public) methods on `Point` from another impl
70-
mod fn_calls_methods_in_another_impl {
72+
pub mod fn_calls_methods_in_another_impl {
7173
use point::Point;
7274

73-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
75+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
7476
pub fn check() {
7577
let mut x = Point { x: 2.0, y: 2.0 };
7678
x.translate(3.0, 3.0);
7779
}
7880
}
7981

8082
/// A fn item that makes an instance of `Point` but does not invoke methods
81-
mod fn_make_struct {
83+
pub mod fn_make_struct {
8284
use point::Point;
8385

84-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
86+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
8587
pub fn make_origin() -> Point {
8688
Point { x: 2.0, y: 2.0 }
8789
}
8890
}
8991

9092
/// A fn item that reads fields from `Point` but does not invoke methods
91-
mod fn_read_field {
93+
pub mod fn_read_field {
9294
use point::Point;
9395

94-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
96+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
9597
pub fn get_x(p: Point) -> f32 {
9698
p.x
9799
}
98100
}
99101

100102
/// A fn item that writes to a field of `Point` but does not invoke methods
101-
mod fn_write_field {
103+
pub mod fn_write_field {
102104
use point::Point;
103105

104-
#[rustc_clean(label="TypeckTables", cfg="rpass2")]
106+
#[rustc_clean(label="TypeckTables", cfg="cfail2")]
105107
pub fn inc_x(p: &mut Point) {
106108
p.x += 1.0;
107109
}
108110
}
109-
110-
fn main() {
111-
}

src/test/incremental/change_private_fn_cc/auxiliary/point.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub struct Point {
1414
}
1515

1616
fn distance_squared(this: &Point) -> f32 {
17-
#[cfg(rpass1)]
17+
#[cfg(cfail1)]
1818
return this.x + this.y;
1919

20-
#[cfg(rpass2)]
20+
#[cfg(cfail2)]
2121
return this.x * this.x + this.y * this.y;
2222
}
2323

0 commit comments

Comments
 (0)