Remove Session methods that duplicate DiagCtxt methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
This commit is contained in:
parent
870a5d957b
commit
620a1e4c2f
4 changed files with 15 additions and 15 deletions
|
|
@ -76,12 +76,12 @@ pub fn get_attr<'a>(
|
|||
})
|
||||
.map_or_else(
|
||||
|| {
|
||||
sess.span_err(attr_segments[1].ident.span, "usage of unknown attribute");
|
||||
sess.dcx().span_err(attr_segments[1].ident.span, "usage of unknown attribute");
|
||||
false
|
||||
},
|
||||
|deprecation_status| {
|
||||
let mut diag =
|
||||
sess.struct_span_err(attr_segments[1].ident.span, "usage of deprecated attribute");
|
||||
sess.dcx().struct_span_err(attr_segments[1].ident.span, "usage of deprecated attribute");
|
||||
match *deprecation_status {
|
||||
DeprecationStatus::Deprecated => {
|
||||
diag.emit();
|
||||
|
|
@ -116,10 +116,10 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
|
|||
if let Ok(value) = FromStr::from_str(value.as_str()) {
|
||||
f(value);
|
||||
} else {
|
||||
sess.span_err(attr.span, "not a number");
|
||||
sess.dcx().span_err(attr.span, "not a number");
|
||||
}
|
||||
} else {
|
||||
sess.span_err(attr.span, "bad clippy attribute");
|
||||
sess.dcx().span_err(attr.span, "bad clippy attribute");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ pub fn get_unique_attr<'a>(
|
|||
let mut unique_attr: Option<&ast::Attribute> = None;
|
||||
for attr in get_attr(sess, attrs, name) {
|
||||
if let Some(duplicate) = unique_attr {
|
||||
sess.struct_span_err(attr.span, format!("`{name}` is defined multiple times"))
|
||||
sess.dcx().struct_span_err(attr.span, format!("`{name}` is defined multiple times"))
|
||||
.span_note(duplicate.span, "first definition found here")
|
||||
.emit();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue