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
d51db05d7e
commit
99472c7049
298 changed files with 1806 additions and 2064 deletions
|
@ -52,7 +52,7 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
|
|||
);
|
||||
} else {
|
||||
self.tcx
|
||||
.sess
|
||||
.dcx()
|
||||
.emit_err(errors::UnalignedPackedRef { span: self.source_info.span });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
|
|||
let assigned_ty = place.ty(&self.body.local_decls, self.tcx).ty;
|
||||
if assigned_ty.needs_drop(self.tcx, self.param_env) {
|
||||
// This would be unsafe, but should be outright impossible since we reject such unions.
|
||||
self.tcx.sess.span_delayed_bug(
|
||||
self.tcx.dcx().span_delayed_bug(
|
||||
self.source_info.span,
|
||||
format!("union fields that need dropping should be impossible: {assigned_ty}")
|
||||
);
|
||||
|
@ -568,7 +568,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
tcx.sess.emit_err(errors::RequiresUnsafe {
|
||||
tcx.dcx().emit_err(errors::RequiresUnsafe {
|
||||
span: source_info.span,
|
||||
enclosing,
|
||||
details,
|
||||
|
|
|
@ -1604,7 +1604,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
|
|||
(args.discr_ty(tcx), movability == hir::Movability::Movable)
|
||||
}
|
||||
_ => {
|
||||
tcx.sess.span_delayed_bug(
|
||||
tcx.dcx().span_delayed_bug(
|
||||
body.span,
|
||||
format!("unexpected coroutine type {coroutine_ty}"),
|
||||
);
|
||||
|
|
|
@ -315,7 +315,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
|||
self.init_data.seek_before(self.body.terminator_loc(bb));
|
||||
let (_maybe_live, maybe_dead) = self.init_data.maybe_live_dead(parent);
|
||||
if maybe_dead {
|
||||
self.tcx.sess.span_delayed_bug(
|
||||
self.tcx.dcx().span_delayed_bug(
|
||||
terminator.source_info.span,
|
||||
format!(
|
||||
"drop of untracked, uninitialized value {bb:?}, place {place:?} ({path:?})"
|
||||
|
@ -380,7 +380,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
|||
LookupResult::Parent(None) => {}
|
||||
LookupResult::Parent(Some(_)) => {
|
||||
if !replace {
|
||||
self.tcx.sess.span_delayed_bug(
|
||||
self.tcx.dcx().span_delayed_bug(
|
||||
terminator.source_info.span,
|
||||
format!("drop of untracked value {bb:?}"),
|
||||
);
|
||||
|
|
|
@ -267,7 +267,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
|
|||
let body = &tcx.mir_const(def).borrow();
|
||||
|
||||
if body.return_ty().references_error() {
|
||||
tcx.sess.span_delayed_bug(body.span, "mir_const_qualif: MIR had errors");
|
||||
tcx.dcx().span_delayed_bug(body.span, "mir_const_qualif: MIR had errors");
|
||||
return Default::default();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue