Skip to content

Commit f3d9523

Browse files
committed
Restrict diagnostic context lifetime of FnCtxt to InferCtxt instead of TyCtxt
1 parent ef55919 commit f3d9523

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
144144
}
145145
}
146146

147-
pub(crate) fn dcx(&self) -> DiagCtxtHandle<'tcx> {
147+
pub(crate) fn dcx(&self) -> DiagCtxtHandle<'a> {
148148
self.infcx.dcx()
149149
}
150150

compiler/rustc_hir_typeck/src/pat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18811881
&self,
18821882
pat: &Pat<'_>,
18831883
fields: &'tcx [hir::PatField<'tcx>],
1884-
) -> Diag<'tcx> {
1884+
) -> Diag<'a> {
18851885
let mut err = self
18861886
.dcx()
18871887
.struct_span_err(pat.span, "pattern requires `..` due to inaccessible fields");
@@ -1973,7 +1973,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19731973
unmentioned_fields: &[(&ty::FieldDef, Ident)],
19741974
have_inaccessible_fields: bool,
19751975
fields: &'tcx [hir::PatField<'tcx>],
1976-
) -> Diag<'tcx> {
1976+
) -> Diag<'a> {
19771977
let inaccessible = if have_inaccessible_fields { " and inaccessible fields" } else { "" };
19781978
let field_names = if let [(_, field)] = unmentioned_fields {
19791979
format!("field `{field}`{inaccessible}")

compiler/rustc_infer/src/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ impl<'tcx> InferCtxt<'tcx> {
16071607
}
16081608
}
16091609

1610-
impl<'tcx> TypeErrCtxt<'_, 'tcx> {
1610+
impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
16111611
// [Note-Type-error-reporting]
16121612
// An invariant is that anytime the expected or actual type is Error (the special
16131613
// error type, meaning that an error occurred when typechecking this expression),
@@ -1623,9 +1623,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
16231623
sp: Span,
16241624
mk_diag: M,
16251625
actual_ty: Ty<'tcx>,
1626-
) -> Diag<'tcx>
1626+
) -> Diag<'a>
16271627
where
1628-
M: FnOnce(String) -> Diag<'tcx>,
1628+
M: FnOnce(String) -> Diag<'a>,
16291629
{
16301630
let actual_ty = self.resolve_vars_if_possible(actual_ty);
16311631
debug!("type_error_struct_with_diag({:?}, {:?})", sp, actual_ty);

0 commit comments

Comments
 (0)