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

@ -28,7 +28,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> {
(None, "".to_string(), Some(()))
};
let mut err = self.sess.create_err(errors::PassToVariadicFunction {
let mut err = self.sess.dcx().create_err(errors::PassToVariadicFunction {
span: self.span,
ty: self.ty,
cast_ty: self.cast_ty,

View file

@ -21,7 +21,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
let mut err = self.sess.create_err(errors::CastThinPointerToFatPointer {
let mut err = self.sess.dcx().create_err(errors::CastThinPointerToFatPointer {
span: self.span,
expr_ty: self.expr_ty,
cast_ty: self.cast_ty.to_owned(),

View file

@ -524,7 +524,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
let span = self.path_segment.ident.span;
let msg = self.create_error_message();
self.tcx.sess.struct_span_err_with_code(span, msg, self.code())
self.tcx.dcx().struct_span_err_with_code(span, msg, self.code())
}
/// Builds the `expected 1 type argument / supplied 2 type arguments` message.