Skip to content

Commit d6723ee

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 206319 b: refs/heads/beta c: da03c9d h: refs/heads/master i: 206317: 98ba783 206315: ff9bac8 206311: 308bcd1 206303: d7e422b v: v3
1 parent cbe2ead commit d6723ee

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: ee48e6d192166be08a57dc4f5ba14256c072e9c3
32+
refs/heads/beta: da03c9df33177d77029c52f8a68a5d214a6e83c7
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/src/libsyntax/codemap.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,21 +543,17 @@ impl CodeMap {
543543
}
544544
}
545545

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> {
547547
let mut files = self.files.borrow_mut();
548548
let start_pos = match files.last() {
549549
None => 0,
550550
Some(last) => last.end_pos.to_usize(),
551551
};
552552

553553
// 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+
}
561557

562558
// Append '\n' in case it's not already there.
563559
// This is a workaround to prevent CodeMap.lookup_filemap_idx from

branches/beta/src/libsyntax/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#![feature(associated_consts)]
2929
#![feature(collections)]
30+
#![feature(collections_drain)]
3031
#![feature(core)]
3132
#![feature(libc)]
3233
#![feature(rustc_private)]

0 commit comments

Comments
 (0)