Avoid unnecessary rustc_span::DUMMY_SP usage.
In some cases `DUMMY_SP` is already imported. In other cases this commit adds the necessary import, in files where `DUMMY_SP` is used more than once.
This commit is contained in:
parent
63f70b3d10
commit
27374a0214
13 changed files with 35 additions and 53 deletions
|
|
@ -408,7 +408,7 @@ impl Item {
|
|||
|
||||
pub(crate) fn attr_span(&self, tcx: TyCtxt<'_>) -> rustc_span::Span {
|
||||
span_of_fragments(&self.attrs.doc_strings)
|
||||
.unwrap_or_else(|| self.span(tcx).map_or(rustc_span::DUMMY_SP, |span| span.inner()))
|
||||
.unwrap_or_else(|| self.span(tcx).map_or(DUMMY_SP, |span| span.inner()))
|
||||
}
|
||||
|
||||
/// Combine all doc strings into a single value handling indentation and newlines as needed.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||
use rustc_session::RustcVersion;
|
||||
use rustc_span::{
|
||||
symbol::{sym, Symbol},
|
||||
BytePos, FileName, RealFileName,
|
||||
BytePos, FileName, RealFileName, DUMMY_SP,
|
||||
};
|
||||
use serde::ser::SerializeMap;
|
||||
use serde::{Serialize, Serializer};
|
||||
|
|
@ -2414,7 +2414,7 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &mut Context<'_>, item: &c
|
|||
let contents = match fs::read_to_string(&path) {
|
||||
Ok(contents) => contents,
|
||||
Err(err) => {
|
||||
let span = item.span(tcx).map_or(rustc_span::DUMMY_SP, |span| span.inner());
|
||||
let span = item.span(tcx).map_or(DUMMY_SP, |span| span.inner());
|
||||
tcx.dcx().span_err(span, format!("failed to read file {}: {err}", path.display()));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2495,7 +2495,7 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &mut Context<'_>, item: &c
|
|||
file.start_pos + BytePos(byte_max),
|
||||
))
|
||||
})()
|
||||
.unwrap_or(rustc_span::DUMMY_SP);
|
||||
.unwrap_or(DUMMY_SP);
|
||||
|
||||
let mut decoration_info = FxHashMap::default();
|
||||
decoration_info.insert("highlight focus", vec![byte_ranges.remove(0)]);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId};
|
|||
use rustc_middle::ty::adjustment::Adjust;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::{sym, InnerSpan, Span};
|
||||
use rustc_span::{sym, DUMMY_SP, InnerSpan, Span};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
|
||||
// FIXME: this is a correctness problem but there's no suitable
|
||||
|
|
@ -290,9 +290,7 @@ impl NonCopyConst {
|
|||
promoted: None,
|
||||
};
|
||||
let param_env = cx.tcx.param_env(def_id).with_reveal_all_normalized(cx.tcx);
|
||||
let result = cx
|
||||
.tcx
|
||||
.const_eval_global_id_for_typeck(param_env, cid, rustc_span::DUMMY_SP);
|
||||
let result = cx.tcx.const_eval_global_id_for_typeck(param_env, cid, DUMMY_SP);
|
||||
self.is_value_unfrozen_raw(cx, result, ty)
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +301,7 @@ impl NonCopyConst {
|
|||
cx.tcx,
|
||||
cx.param_env,
|
||||
ty::UnevaluatedConst::new(def_id, args),
|
||||
rustc_span::DUMMY_SP,
|
||||
DUMMY_SP,
|
||||
);
|
||||
self.is_value_unfrozen_raw(cx, result, ty)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue