mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-09 14:25:24 +00:00
Rollup merge of #48167 - Mark-Simulacrum:remove-allocation-codemap, r=estebank
Remove allocation from width of character function. Locally this seems to eliminate the problem or at least resolve most of the issue. Fixes #48153. r? @estebank
This commit is contained in:
commit
dc9d93f220
@ -690,14 +690,16 @@ impl CodeMap {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let src = local_begin.fm.external_src.borrow();
|
||||||
|
|
||||||
// We need to extend the snippet to the end of the src rather than to end_index so when
|
// We need to extend the snippet to the end of the src rather than to end_index so when
|
||||||
// searching forwards for boundaries we've got somewhere to search.
|
// searching forwards for boundaries we've got somewhere to search.
|
||||||
let snippet = if let Some(ref src) = local_begin.fm.src {
|
let snippet = if let Some(ref src) = local_begin.fm.src {
|
||||||
let len = src.len();
|
let len = src.len();
|
||||||
(&src[start_index..len]).to_string()
|
(&src[start_index..len])
|
||||||
} else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
|
} else if let Some(src) = src.get_source() {
|
||||||
let len = src.len();
|
let len = src.len();
|
||||||
(&src[start_index..len]).to_string()
|
(&src[start_index..len])
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user