24
24
25
25
interesting_files = ['.rs' , '.py' , '.js' , '.sh' , '.c' , '.h' ]
26
26
uninteresting_files = ['miniz.c' , 'jquery' , 'rust_android_dummy' ]
27
+ stable_whitelist = {
28
+ 'src/bootstrap' ,
29
+ 'src/build_helper' ,
30
+ 'src/libcollectionstest' ,
31
+ 'src/libcore' ,
32
+ 'src/libstd' ,
33
+ 'src/rustc/std_shim' ,
34
+ 'src/test'
35
+ }
27
36
28
37
29
38
def report_error_name_no (name , no , s ):
@@ -93,6 +102,7 @@ def interesting_file(f):
93
102
file_counts = {ext : 0 for ext in interesting_files }
94
103
95
104
all_paths = set ()
105
+ needs_unstable_attr = set ()
96
106
97
107
try :
98
108
for (dirpath , dirnames , filenames ) in os .walk (src_dir ):
@@ -149,6 +159,9 @@ def interesting_file(f):
149
159
else :
150
160
if "SNAP " in line :
151
161
report_warn ("unmatched SNAP line: " + line )
162
+ search = re .search (r'^#!\[unstable' , line )
163
+ if search :
164
+ needs_unstable_attr .discard (filename )
152
165
153
166
if cr_flag in line :
154
167
check_cr = False
@@ -181,6 +194,9 @@ def interesting_file(f):
181
194
check_cr = True
182
195
check_tab = True
183
196
check_linelength = True
197
+ if all (f not in filename for f in stable_whitelist ) and \
198
+ re .search (r'src/.*/lib\.rs' , filename ):
199
+ needs_unstable_attr .add (filename )
184
200
185
201
# Put a reasonable limit on the amount of header data we use for
186
202
# the licenseck
@@ -195,6 +211,8 @@ def interesting_file(f):
195
211
update_counts (current_name )
196
212
assert len (current_contents ) > 0
197
213
do_license_check (current_name , current_contents )
214
+ for f in needs_unstable_attr :
215
+ report_error_name_no (f , 1 , "requires unstable attribute" )
198
216
199
217
except UnicodeDecodeError as e :
200
218
report_err ("UTF-8 decoding error " + str (e ))
0 commit comments