1
Fork 0

make clean::Item::span return option instead of dummy span

This commit is contained in:
Michael Goulet 2022-08-09 02:48:01 +00:00
parent 569788e47e
commit 752b0e0672
7 changed files with 40 additions and 30 deletions

View file

@ -2677,7 +2677,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
let contents = match fs::read_to_string(&path) {
Ok(contents) => contents,
Err(err) => {
let span = item.span(tcx).inner();
let span = item.span(tcx).map_or(rustc_span::DUMMY_SP, |span| span.inner());
tcx.sess
.span_err(span, &format!("failed to read file {}: {}", path.display(), err));
return false;