1
Fork 0

Remove more Session methods that duplicate DiagCtxt methods.

This commit is contained in:
Nicholas Nethercote 2023-12-21 16:26:09 +11:00
parent 8af3d8dcab
commit 8a9db25459
36 changed files with 62 additions and 74 deletions

View file

@ -1284,7 +1284,7 @@ pub(super) fn check_type_params_are_used<'tcx>(
if ty.references_error() {
// If there is already another error, do not emit
// an error for not using a type parameter.
assert!(tcx.sess.has_errors().is_some());
assert!(tcx.dcx().has_errors().is_some());
return;
}

View file

@ -115,7 +115,7 @@ where
let errors = wfcx.select_all_or_error();
if !errors.is_empty() {
let err = infcx.err_ctxt().report_fulfillment_errors(errors);
if tcx.sess.err_count() > 0 {
if tcx.dcx().err_count() > 0 {
return Err(err);
} else {
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs

View file

@ -234,7 +234,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
tcx.ensure().check_unused_traits(());
if let Some(reported) = tcx.sess.has_errors() { Err(reported) } else { Ok(()) }
if let Some(reported) = tcx.dcx().has_errors() { Err(reported) } else { Ok(()) }
}
/// A quasi-deprecated helper used in rustdoc and clippy to get