Skip to content

Commit da093d7

Browse files
committed
Remove label in dirty/clean annotations.
1 parent e1ff91f commit da093d7

File tree

37 files changed

+452
-699
lines changed

37 files changed

+452
-699
lines changed

compiler/rustc_incremental/src/persist/dirty_clean.rs

+4-44
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use std::iter::FromIterator;
3030
use std::vec::Vec;
3131

3232
const EXCEPT: Symbol = sym::except;
33-
const LABEL: Symbol = sym::label;
3433
const CFG: Symbol = sym::cfg;
3534

3635
// Base and Extra labels to build up the labels
@@ -122,16 +121,6 @@ struct Assertion {
122121
dirty: Labels,
123122
}
124123

125-
impl Assertion {
126-
fn from_clean_labels(labels: Labels) -> Assertion {
127-
Assertion { clean: labels, dirty: Labels::default() }
128-
}
129-
130-
fn from_dirty_labels(labels: Labels) -> Assertion {
131-
Assertion { clean: Labels::default(), dirty: labels }
132-
}
133-
}
134-
135124
pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
136125
if !tcx.sess.opts.debugging_opts.query_dep_graph {
137126
return;
@@ -181,15 +170,7 @@ impl DirtyCleanVisitor<'tcx> {
181170
// skip: not the correct `cfg=`
182171
return None;
183172
}
184-
let assertion = if let Some(labels) = self.labels(attr) {
185-
if is_clean {
186-
Assertion::from_clean_labels(labels)
187-
} else {
188-
Assertion::from_dirty_labels(labels)
189-
}
190-
} else {
191-
self.assertion_auto(item_id, attr, is_clean)
192-
};
173+
let assertion = self.assertion_auto(item_id, attr, is_clean);
193174
Some(assertion)
194175
}
195176

@@ -218,16 +199,6 @@ impl DirtyCleanVisitor<'tcx> {
218199
}
219200
}
220201

221-
fn labels(&self, attr: &Attribute) -> Option<Labels> {
222-
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
223-
if item.has_name(LABEL) {
224-
let value = expect_associated_value(self.tcx, &item);
225-
return Some(self.resolve_labels(&item, value));
226-
}
227-
}
228-
None
229-
}
230-
231202
/// `except=` attribute value
232203
fn except(&self, attr: &Attribute) -> Labels {
233204
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
@@ -437,30 +408,19 @@ impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> {
437408
/// Given a `#[rustc_dirty]` or `#[rustc_clean]` attribute, scan
438409
/// for a `cfg="foo"` attribute and check whether we have a cfg
439410
/// flag called `foo`.
440-
///
441-
/// Also make sure that the `label` and `except` fields do not
442-
/// both exist.
443411
fn check_config(tcx: TyCtxt<'_>, attr: &Attribute) -> bool {
444412
debug!("check_config(attr={:?})", attr);
445413
let config = &tcx.sess.parse_sess.config;
446414
debug!("check_config: config={:?}", config);
447-
let (mut cfg, mut except, mut label) = (None, false, false);
415+
let mut cfg = None;
448416
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
449417
if item.has_name(CFG) {
450418
let value = expect_associated_value(tcx, &item);
451419
debug!("check_config: searching for cfg {:?}", value);
452420
cfg = Some(config.contains(&(value, None)));
421+
} else if !item.has_name(EXCEPT) {
422+
tcx.sess.span_err(attr.span, &format!("unknown item `{}`", item.name_or_empty()));
453423
}
454-
if item.has_name(LABEL) {
455-
label = true;
456-
}
457-
if item.has_name(EXCEPT) {
458-
except = true;
459-
}
460-
}
461-
462-
if label && except {
463-
tcx.sess.span_fatal(attr.span, "must specify only one of: `label`, `except`");
464424
}
465425

466426
match cfg {

src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate point;
2424
pub mod fn_calls_methods_in_same_impl {
2525
use point::Point;
2626

27-
#[rustc_clean(label="typeck", cfg="cfail2")]
27+
#[rustc_clean(cfg="cfail2")]
2828
pub fn check() {
2929
let x = Point { x: 2.0, y: 2.0 };
3030
x.distance_from_origin();
@@ -35,7 +35,7 @@ pub mod fn_calls_methods_in_same_impl {
3535
pub mod fn_calls_free_fn {
3636
use point::{self, Point};
3737

38-
#[rustc_clean(label="typeck", cfg="cfail2")]
38+
#[rustc_clean(cfg="cfail2")]
3939
pub fn check() {
4040
let x = Point { x: 2.0, y: 2.0 };
4141
point::distance_squared(&x);
@@ -46,7 +46,7 @@ pub mod fn_calls_free_fn {
4646
pub mod fn_make_struct {
4747
use point::Point;
4848

49-
#[rustc_clean(label="typeck", cfg="cfail2")]
49+
#[rustc_clean(cfg="cfail2")]
5050
pub fn make_origin() -> Point {
5151
Point { x: 2.0, y: 2.0 }
5252
}
@@ -56,7 +56,7 @@ pub mod fn_make_struct {
5656
pub mod fn_read_field {
5757
use point::Point;
5858

59-
#[rustc_clean(label="typeck", cfg="cfail2")]
59+
#[rustc_clean(cfg="cfail2")]
6060
pub fn get_x(p: Point) -> f32 {
6161
p.x
6262
}
@@ -66,7 +66,7 @@ pub mod fn_read_field {
6666
pub mod fn_write_field {
6767
use point::Point;
6868

69-
#[rustc_clean(label="typeck", cfg="cfail2")]
69+
#[rustc_clean(cfg="cfail2")]
7070
pub fn inc_x(p: &mut Point) {
7171
p.x += 1.0;
7272
}

src/test/incremental/callee_caller_cross_crate/b.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
extern crate a;
88

9-
#[rustc_dirty(label="typeck", cfg="rpass2")]
9+
#[rustc_clean(except="typeck", cfg="rpass2")]
1010
pub fn call_function0() {
1111
a::function0(77);
1212
}
1313

14-
#[rustc_clean(label="typeck", cfg="rpass2")]
14+
#[rustc_clean(cfg="rpass2")]
1515
pub fn call_function1() {
1616
a::function1(77);
1717
}

src/test/incremental/change_add_field/struct_point.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub mod point {
7070
pub mod fn_with_type_in_sig {
7171
use point::Point;
7272

73-
#[rustc_dirty(label="typeck", cfg="cfail2")]
73+
#[rustc_clean(except="typeck,fn_sig,optimized_mir", cfg="cfail2")]
7474
pub fn boop(p: Option<&Point>) -> f32 {
7575
p.map(|p| p.total()).unwrap_or(0.0)
7676
}
@@ -86,7 +86,7 @@ pub mod fn_with_type_in_sig {
8686
pub mod call_fn_with_type_in_sig {
8787
use fn_with_type_in_sig;
8888

89-
#[rustc_dirty(label="typeck", cfg="cfail2")]
89+
#[rustc_clean(except="typeck,optimized_mir", cfg="cfail2")]
9090
pub fn bip() -> f32 {
9191
fn_with_type_in_sig::boop(None)
9292
}
@@ -102,7 +102,7 @@ pub mod call_fn_with_type_in_sig {
102102
pub mod fn_with_type_in_body {
103103
use point::Point;
104104

105-
#[rustc_dirty(label="typeck", cfg="cfail2")]
105+
#[rustc_clean(except="typeck,optimized_mir", cfg="cfail2")]
106106
pub fn boop() -> f32 {
107107
Point::origin().total()
108108
}
@@ -115,7 +115,7 @@ pub mod fn_with_type_in_body {
115115
pub mod call_fn_with_type_in_body {
116116
use fn_with_type_in_body;
117117

118-
#[rustc_clean(label="typeck", cfg="cfail2")]
118+
#[rustc_clean(cfg="cfail2")]
119119
pub fn bip() -> f32 {
120120
fn_with_type_in_body::boop()
121121
}
@@ -125,7 +125,7 @@ pub mod call_fn_with_type_in_body {
125125
pub mod fn_make_struct {
126126
use point::Point;
127127

128-
#[rustc_dirty(label="typeck", cfg="cfail2")]
128+
#[rustc_clean(except="typeck,fn_sig,optimized_mir", cfg="cfail2")]
129129
pub fn make_origin(p: Point) -> Point {
130130
Point { ..p }
131131
}
@@ -135,7 +135,7 @@ pub mod fn_make_struct {
135135
pub mod fn_read_field {
136136
use point::Point;
137137

138-
#[rustc_dirty(label="typeck", cfg="cfail2")]
138+
#[rustc_clean(except="typeck,fn_sig,optimized_mir", cfg="cfail2")]
139139
pub fn get_x(p: Point) -> f32 {
140140
p.x
141141
}
@@ -145,7 +145,7 @@ pub mod fn_read_field {
145145
pub mod fn_write_field {
146146
use point::Point;
147147

148-
#[rustc_dirty(label="typeck", cfg="cfail2")]
148+
#[rustc_clean(except="typeck,fn_sig,optimized_mir", cfg="cfail2")]
149149
pub fn inc_x(p: &mut Point) {
150150
p.x += 1.0;
151151
}

src/test/incremental/change_private_fn/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub mod point {
5151
pub mod fn_calls_methods_in_same_impl {
5252
use point::Point;
5353

54-
#[rustc_clean(label="typeck", cfg="cfail2")]
54+
#[rustc_clean(cfg="cfail2")]
5555
pub fn check() {
5656
let x = Point { x: 2.0, y: 2.0 };
5757
x.distance_from_origin();
@@ -62,7 +62,7 @@ pub mod fn_calls_methods_in_same_impl {
6262
pub mod fn_calls_methods_in_another_impl {
6363
use point::Point;
6464

65-
#[rustc_clean(label="typeck", cfg="cfail2")]
65+
#[rustc_clean(cfg="cfail2")]
6666
pub fn check() {
6767
let mut x = Point { x: 2.0, y: 2.0 };
6868
x.translate(3.0, 3.0);
@@ -73,7 +73,7 @@ pub mod fn_calls_methods_in_another_impl {
7373
pub mod fn_make_struct {
7474
use point::Point;
7575

76-
#[rustc_clean(label="typeck", cfg="cfail2")]
76+
#[rustc_clean(cfg="cfail2")]
7777
pub fn make_origin() -> Point {
7878
Point { x: 2.0, y: 2.0 }
7979
}
@@ -83,7 +83,7 @@ pub mod fn_make_struct {
8383
pub mod fn_read_field {
8484
use point::Point;
8585

86-
#[rustc_clean(label="typeck", cfg="cfail2")]
86+
#[rustc_clean(cfg="cfail2")]
8787
pub fn get_x(p: Point) -> f32 {
8888
p.x
8989
}
@@ -93,7 +93,7 @@ pub mod fn_read_field {
9393
pub mod fn_write_field {
9494
use point::Point;
9595

96-
#[rustc_clean(label="typeck", cfg="cfail2")]
96+
#[rustc_clean(cfg="cfail2")]
9797
pub fn inc_x(p: &mut Point) {
9898
p.x += 1.0;
9999
}

src/test/incremental/change_private_fn_cc/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern crate point;
2323
pub mod fn_calls_methods_in_same_impl {
2424
use point::Point;
2525

26-
#[rustc_clean(label="typeck", cfg="cfail2")]
26+
#[rustc_clean(cfg="cfail2")]
2727
pub fn check() {
2828
let x = Point { x: 2.0, y: 2.0 };
2929
x.distance_from_origin();
@@ -34,7 +34,7 @@ pub mod fn_calls_methods_in_same_impl {
3434
pub mod fn_calls_methods_in_another_impl {
3535
use point::Point;
3636

37-
#[rustc_clean(label="typeck", cfg="cfail2")]
37+
#[rustc_clean(cfg="cfail2")]
3838
pub fn check() {
3939
let mut x = Point { x: 2.0, y: 2.0 };
4040
x.translate(3.0, 3.0);
@@ -45,7 +45,7 @@ pub mod fn_calls_methods_in_another_impl {
4545
pub mod fn_make_struct {
4646
use point::Point;
4747

48-
#[rustc_clean(label="typeck", cfg="cfail2")]
48+
#[rustc_clean(cfg="cfail2")]
4949
pub fn make_origin() -> Point {
5050
Point { x: 2.0, y: 2.0 }
5151
}
@@ -55,7 +55,7 @@ pub mod fn_make_struct {
5555
pub mod fn_read_field {
5656
use point::Point;
5757

58-
#[rustc_clean(label="typeck", cfg="cfail2")]
58+
#[rustc_clean(cfg="cfail2")]
5959
pub fn get_x(p: Point) -> f32 {
6060
p.x
6161
}
@@ -65,7 +65,7 @@ pub mod fn_read_field {
6565
pub mod fn_write_field {
6666
use point::Point;
6767

68-
#[rustc_clean(label="typeck", cfg="cfail2")]
68+
#[rustc_clean(cfg="cfail2")]
6969
pub fn inc_x(p: &mut Point) {
7070
p.x += 1.0;
7171
}

src/test/incremental/change_private_impl_method/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub mod point {
5151
pub mod fn_calls_methods_in_same_impl {
5252
use point::Point;
5353

54-
#[rustc_clean(label="typeck", cfg="cfail2")]
54+
#[rustc_clean(cfg="cfail2")]
5555
pub fn check() {
5656
let x = Point { x: 2.0, y: 2.0 };
5757
x.distance_from_origin();
@@ -62,7 +62,7 @@ pub mod fn_calls_methods_in_same_impl {
6262
pub mod fn_calls_methods_in_another_impl {
6363
use point::Point;
6464

65-
#[rustc_clean(label="typeck", cfg="cfail2")]
65+
#[rustc_clean(cfg="cfail2")]
6666
pub fn check() {
6767
let mut x = Point { x: 2.0, y: 2.0 };
6868
x.translate(3.0, 3.0);
@@ -73,7 +73,7 @@ pub mod fn_calls_methods_in_another_impl {
7373
pub mod fn_make_struct {
7474
use point::Point;
7575

76-
#[rustc_clean(label="typeck", cfg="cfail2")]
76+
#[rustc_clean(cfg="cfail2")]
7777
pub fn make_origin() -> Point {
7878
Point { x: 2.0, y: 2.0 }
7979
}
@@ -83,7 +83,7 @@ pub mod fn_make_struct {
8383
pub mod fn_read_field {
8484
use point::Point;
8585

86-
#[rustc_clean(label="typeck", cfg="cfail2")]
86+
#[rustc_clean(cfg="cfail2")]
8787
pub fn get_x(p: Point) -> f32 {
8888
p.x
8989
}
@@ -93,7 +93,7 @@ pub mod fn_read_field {
9393
pub mod fn_write_field {
9494
use point::Point;
9595

96-
#[rustc_clean(label="typeck", cfg="cfail2")]
96+
#[rustc_clean(cfg="cfail2")]
9797
pub fn inc_x(p: &mut Point) {
9898
p.x += 1.0;
9999
}

src/test/incremental/change_private_impl_method_cc/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate point;
2424
pub mod fn_calls_methods_in_same_impl {
2525
use point::Point;
2626

27-
#[rustc_clean(label="typeck", cfg="cfail2")]
27+
#[rustc_clean(cfg="cfail2")]
2828
pub fn check() {
2929
let x = Point { x: 2.0, y: 2.0 };
3030
x.distance_from_origin();
@@ -35,7 +35,7 @@ pub mod fn_calls_methods_in_same_impl {
3535
pub mod fn_calls_methods_in_another_impl {
3636
use point::Point;
3737

38-
#[rustc_clean(label="typeck", cfg="cfail2")]
38+
#[rustc_clean(cfg="cfail2")]
3939
pub fn dirty() {
4040
let mut x = Point { x: 2.0, y: 2.0 };
4141
x.translate(3.0, 3.0);
@@ -46,7 +46,7 @@ pub mod fn_calls_methods_in_another_impl {
4646
pub mod fn_make_struct {
4747
use point::Point;
4848

49-
#[rustc_clean(label="typeck", cfg="cfail2")]
49+
#[rustc_clean(cfg="cfail2")]
5050
pub fn make_origin() -> Point {
5151
Point { x: 2.0, y: 2.0 }
5252
}
@@ -56,7 +56,7 @@ pub mod fn_make_struct {
5656
pub mod fn_read_field {
5757
use point::Point;
5858

59-
#[rustc_clean(label="typeck", cfg="cfail2")]
59+
#[rustc_clean(cfg="cfail2")]
6060
pub fn get_x(p: Point) -> f32 {
6161
p.x
6262
}
@@ -66,7 +66,7 @@ pub mod fn_read_field {
6666
pub mod fn_write_field {
6767
use point::Point;
6868

69-
#[rustc_clean(label="typeck", cfg="cfail2")]
69+
#[rustc_clean(cfg="cfail2")]
7070
pub fn inc_x(p: &mut Point) {
7171
p.x += 1.0;
7272
}

0 commit comments

Comments
 (0)