1
Fork 0

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:
Nicholas Nethercote 2023-12-18 22:21:37 +11:00
parent d51db05d7e
commit 99472c7049
298 changed files with 1806 additions and 2064 deletions

View file

@ -46,7 +46,7 @@ fn enforce_trait_manually_implementable(
if tcx.trait_def(trait_def_id).deny_explicit_impl {
let trait_name = tcx.item_name(trait_def_id);
let mut err = struct_span_err!(
tcx.sess,
tcx.dcx(),
impl_header_span,
E0322,
"explicit impls for the `{trait_name}` trait are not permitted"
@ -67,7 +67,7 @@ fn enforce_trait_manually_implementable(
tcx.trait_def(trait_def_id).specialization_kind
{
if !tcx.features().specialization && !tcx.features().min_specialization {
tcx.sess.emit_err(errors::SpecializationTrait { span: impl_header_span });
tcx.dcx().emit_err(errors::SpecializationTrait { span: impl_header_span });
return;
}
}
@ -89,7 +89,7 @@ fn enforce_empty_impls_for_marker_traits(
}
struct_span_err!(
tcx.sess,
tcx.dcx(),
tcx.def_span(impl_def_id),
E0715,
"impls for marker traits cannot contain items"
@ -174,7 +174,7 @@ fn check_object_overlap<'tcx>(
if supertrait_def_ids.any(|d| d == trait_def_id) {
let span = tcx.def_span(impl_def_id);
struct_span_err!(
tcx.sess,
tcx.dcx(),
span,
E0371,
"the object type `{}` automatically implements the trait `{}`",