Use Freeze
for SourceFile.external_src
This commit is contained in:
parent
f00c139998
commit
c5996b80be
8 changed files with 91 additions and 46 deletions
|
@ -169,7 +169,7 @@ impl AnnotateSnippetEmitterWriter {
|
|||
.map(|line| {
|
||||
// Ensure the source file is present before we try
|
||||
// to load a string from it.
|
||||
source_map.ensure_source_file_source_present(file.clone());
|
||||
source_map.ensure_source_file_source_present(&file);
|
||||
(
|
||||
format!("{}", source_map.filename_for_diagnostics(&file.name)),
|
||||
source_string(file.clone(), &line),
|
||||
|
|
|
@ -1193,7 +1193,7 @@ impl EmitterWriter {
|
|||
let will_be_emitted = |span: Span| {
|
||||
!span.is_dummy() && {
|
||||
let file = sm.lookup_source_file(span.hi());
|
||||
sm.ensure_source_file_source_present(file)
|
||||
sm.ensure_source_file_source_present(&file)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1388,7 +1388,7 @@ impl EmitterWriter {
|
|||
// Print out the annotate source lines that correspond with the error
|
||||
for annotated_file in annotated_files {
|
||||
// we can't annotate anything if the source is unavailable.
|
||||
if !sm.ensure_source_file_source_present(annotated_file.file.clone()) {
|
||||
if !sm.ensure_source_file_source_present(&annotated_file.file) {
|
||||
if !self.short_message {
|
||||
// We'll just print an unannotated message.
|
||||
for (annotation_id, line) in annotated_file.lines.iter().enumerate() {
|
||||
|
|
|
@ -558,7 +558,7 @@ impl DiagnosticSpanLine {
|
|||
.span_to_lines(span)
|
||||
.map(|lines| {
|
||||
// We can't get any lines if the source is unavailable.
|
||||
if !je.sm.ensure_source_file_source_present(lines.file.clone()) {
|
||||
if !je.sm.ensure_source_file_source_present(&lines.file) {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ impl CodeSuggestion {
|
|||
assert!(!lines.lines.is_empty() || bounding_span.is_dummy());
|
||||
|
||||
// We can't splice anything if the source is unavailable.
|
||||
if !sm.ensure_source_file_source_present(lines.file.clone()) {
|
||||
if !sm.ensure_source_file_source_present(&lines.file) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue