File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
branches/stable/src/libsyntax Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: ee48e6d192166be08a57dc4f5ba14256c072e9c3
32
+ refs/heads/stable: da03c9df33177d77029c52f8a68a5d214a6e83c7
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
Original file line number Diff line number Diff line change @@ -543,21 +543,17 @@ impl CodeMap {
543
543
}
544
544
}
545
545
546
- pub fn new_filemap ( & self , filename : FileName , src : String ) -> Rc < FileMap > {
546
+ pub fn new_filemap ( & self , filename : FileName , mut src : String ) -> Rc < FileMap > {
547
547
let mut files = self . files . borrow_mut ( ) ;
548
548
let start_pos = match files. last ( ) {
549
549
None => 0 ,
550
550
Some ( last) => last. end_pos . to_usize ( ) ,
551
551
} ;
552
552
553
553
// Remove utf-8 BOM if any.
554
- // FIXME #12884: no efficient/safe way to remove from the start of a string
555
- // and reuse the allocation.
556
- let mut src = if src. starts_with ( "\u{feff} " ) {
557
- String :: from ( & src[ 3 ..] )
558
- } else {
559
- String :: from ( & src[ ..] )
560
- } ;
554
+ if src. starts_with ( "\u{feff} " ) {
555
+ src. drain ( ..3 ) ;
556
+ }
561
557
562
558
// Append '\n' in case it's not already there.
563
559
// This is a workaround to prevent CodeMap.lookup_filemap_idx from
Original file line number Diff line number Diff line change 27
27
28
28
#![ feature( associated_consts) ]
29
29
#![ feature( collections) ]
30
+ #![ feature( collections_drain) ]
30
31
#![ feature( core) ]
31
32
#![ feature( libc) ]
32
33
#![ feature( rustc_private) ]
You can’t perform that action at this time.
0 commit comments