File tree 4 files changed +20
-4
lines changed
rustc_data_structures/src/sync
4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -76,3 +76,19 @@ impl<T: Copy> AppendOnlyVec<T> {
76
76
return self . vec . get ( i) ;
77
77
}
78
78
}
79
+
80
+ impl < T : Copy + PartialEq > AppendOnlyVec < T > {
81
+ pub fn contains ( & self , val : T ) -> bool {
82
+ for i in 0 .. {
83
+ match self . get ( i) {
84
+ None => return false ,
85
+ Some ( v) => {
86
+ if val == v {
87
+ return true ;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ false
93
+ }
94
+ }
Original file line number Diff line number Diff line change @@ -1947,7 +1947,7 @@ impl KeywordIdents {
1947
1947
} ;
1948
1948
1949
1949
// Don't lint `r#foo`.
1950
- if cx. sess ( ) . parse_sess . raw_identifier_spans . borrow ( ) . contains ( & ident. span ) {
1950
+ if cx. sess ( ) . parse_sess . raw_identifier_spans . contains ( ident. span ) {
1951
1951
return ;
1952
1952
}
1953
1953
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ impl<'a> StringReader<'a> {
175
175
if !sym. can_be_raw ( ) {
176
176
self . sess . emit_err ( errors:: CannotBeRawIdent { span, ident : sym } ) ;
177
177
}
178
- self . sess . raw_identifier_spans . borrow_mut ( ) . push ( span) ;
178
+ self . sess . raw_identifier_spans . push ( span) ;
179
179
token:: Ident ( sym, true )
180
180
}
181
181
rustc_lexer:: TokenKind :: UnknownPrefix => {
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ pub struct ParseSess {
194
194
pub edition : Edition ,
195
195
/// Places where raw identifiers were used. This is used to avoid complaining about idents
196
196
/// clashing with keywords in new editions.
197
- pub raw_identifier_spans : Lock < Vec < Span > > ,
197
+ pub raw_identifier_spans : AppendOnlyVec < Span > ,
198
198
/// Places where identifiers that contain invalid Unicode codepoints but that look like they
199
199
/// should be. Useful to avoid bad tokenization when encountering emoji. We group them to
200
200
/// provide a single error per unique incorrect identifier.
@@ -247,7 +247,7 @@ impl ParseSess {
247
247
config : FxIndexSet :: default ( ) ,
248
248
check_config : CrateCheckConfig :: default ( ) ,
249
249
edition : ExpnId :: root ( ) . expn_data ( ) . edition ,
250
- raw_identifier_spans : Lock :: new ( Vec :: new ( ) ) ,
250
+ raw_identifier_spans : Default :: default ( ) ,
251
251
bad_unicode_identifiers : Lock :: new ( Default :: default ( ) ) ,
252
252
source_map,
253
253
buffered_lints : Lock :: new ( vec ! [ ] ) ,
You can’t perform that action at this time.
0 commit comments