File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
rustc_data_structures/src/sync Expand file tree Collapse file tree 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> {
7676 return self . vec . get ( i) ;
7777 }
7878}
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 {
19471947 } ;
19481948
19491949 // 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 ) {
19511951 return ;
19521952 }
19531953
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ impl<'a> StringReader<'a> {
175175 if !sym. can_be_raw ( ) {
176176 self . sess . emit_err ( errors:: CannotBeRawIdent { span, ident : sym } ) ;
177177 }
178- self . sess . raw_identifier_spans . borrow_mut ( ) . push ( span) ;
178+ self . sess . raw_identifier_spans . push ( span) ;
179179 token:: Ident ( sym, true )
180180 }
181181 rustc_lexer:: TokenKind :: UnknownPrefix => {
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ pub struct ParseSess {
194194 pub edition : Edition ,
195195 /// Places where raw identifiers were used. This is used to avoid complaining about idents
196196 /// clashing with keywords in new editions.
197- pub raw_identifier_spans : Lock < Vec < Span > > ,
197+ pub raw_identifier_spans : AppendOnlyVec < Span > ,
198198 /// Places where identifiers that contain invalid Unicode codepoints but that look like they
199199 /// should be. Useful to avoid bad tokenization when encountering emoji. We group them to
200200 /// provide a single error per unique incorrect identifier.
@@ -247,7 +247,7 @@ impl ParseSess {
247247 config : FxIndexSet :: default ( ) ,
248248 check_config : CrateCheckConfig :: default ( ) ,
249249 edition : ExpnId :: root ( ) . expn_data ( ) . edition ,
250- raw_identifier_spans : Lock :: new ( Vec :: new ( ) ) ,
250+ raw_identifier_spans : Default :: default ( ) ,
251251 bad_unicode_identifiers : Lock :: new ( Default :: default ( ) ) ,
252252 source_map,
253253 buffered_lints : Lock :: new ( vec ! [ ] ) ,
You can’t perform that action at this time.
0 commit comments