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:
@@ -260,7 +260,7 @@ fn do_orphan_check_impl<'tcx>(
|
||||
match local_impl {
|
||||
LocalImpl::Allow => {}
|
||||
LocalImpl::Disallow { problematic_kind } => {
|
||||
return Err(tcx.sess.emit_err(errors::TraitsWithDefaultImpl {
|
||||
return Err(tcx.dcx().emit_err(errors::TraitsWithDefaultImpl {
|
||||
span: tcx.def_span(def_id),
|
||||
traits: tcx.def_path_str(trait_def_id),
|
||||
problematic_kind,
|
||||
@@ -272,13 +272,13 @@ fn do_orphan_check_impl<'tcx>(
|
||||
match nonlocal_impl {
|
||||
NonlocalImpl::Allow => {}
|
||||
NonlocalImpl::DisallowBecauseNonlocal => {
|
||||
return Err(tcx.sess.emit_err(errors::CrossCrateTraitsDefined {
|
||||
return Err(tcx.dcx().emit_err(errors::CrossCrateTraitsDefined {
|
||||
span: tcx.def_span(def_id),
|
||||
traits: tcx.def_path_str(trait_def_id),
|
||||
}));
|
||||
}
|
||||
NonlocalImpl::DisallowOther => {
|
||||
return Err(tcx.sess.emit_err(errors::CrossCrateTraits {
|
||||
return Err(tcx.dcx().emit_err(errors::CrossCrateTraits {
|
||||
span: tcx.def_span(def_id),
|
||||
traits: tcx.def_path_str(trait_def_id),
|
||||
self_ty,
|
||||
@@ -422,7 +422,7 @@ fn emit_orphan_check_error<'tcx>(
|
||||
sugg,
|
||||
},
|
||||
};
|
||||
tcx.sess.emit_err(err_struct)
|
||||
tcx.dcx().emit_err(err_struct)
|
||||
}
|
||||
traits::OrphanCheckErr::UncoveredTy(param_ty, local_type) => {
|
||||
let mut sp = sp;
|
||||
@@ -433,13 +433,13 @@ fn emit_orphan_check_error<'tcx>(
|
||||
}
|
||||
|
||||
match local_type {
|
||||
Some(local_type) => tcx.sess.emit_err(errors::TyParamFirstLocal {
|
||||
Some(local_type) => tcx.dcx().emit_err(errors::TyParamFirstLocal {
|
||||
span: sp,
|
||||
note: (),
|
||||
param_ty,
|
||||
local_type,
|
||||
}),
|
||||
None => tcx.sess.emit_err(errors::TyParamSome { span: sp, note: (), param_ty }),
|
||||
None => tcx.dcx().emit_err(errors::TyParamSome { span: sp, note: (), param_ty }),
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -453,7 +453,7 @@ fn lint_auto_trait_impl<'tcx>(
|
||||
impl_def_id: LocalDefId,
|
||||
) {
|
||||
if trait_ref.args.len() != 1 {
|
||||
tcx.sess.dcx().span_delayed_bug(
|
||||
tcx.dcx().span_delayed_bug(
|
||||
tcx.def_span(impl_def_id),
|
||||
"auto traits cannot have generic parameters",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user