Skip to content

Commit 09af8a6

Browse files
committed
Rename Session::span_diagnostic as Session::dcx.
1 parent 9df1576 commit 09af8a6

File tree

66 files changed

+176
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+176
-204
lines changed

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
139139

140140
// We should've returned in the for loop above.
141141

142-
self.tcx.sess.diagnostic().span_bug(
142+
self.tcx.sess.dcx().span_bug(
143143
p.span,
144144
format!(
145145
"lower_qpath: no final extension segment in {}..{}",

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a> AstValidator<'a> {
221221
}
222222

223223
fn err_handler(&self) -> &rustc_errors::DiagCtxt {
224-
self.session.diagnostic()
224+
self.session.dcx()
225225
}
226226

227227
fn check_lifetime(&self, ident: Ident) {

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a> PostExpansionVisitor<'a> {
102102
}
103103
Err(abi::AbiDisabled::Unrecognized) => {
104104
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
105-
self.sess.diagnostic().span_delayed_bug(
105+
self.sess.dcx().span_delayed_bug(
106106
span,
107107
format!(
108108
"unrecognized ABI not caught in lowering: {}",
@@ -654,7 +654,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate)
654654
if all_stable {
655655
err.sugg = Some(attr.span);
656656
}
657-
sess.diagnostic().emit_err(err);
657+
sess.dcx().emit_err(err);
658658
}
659659
}
660660
}

compiler/rustc_attr/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
945945
assert!(attr.has_name(sym::repr), "expected `#[repr(..)]`, found: {attr:?}");
946946
use ReprAttr::*;
947947
let mut acc = Vec::new();
948-
let diagnostic = sess.diagnostic();
948+
let diagnostic = sess.dcx();
949949

950950
if let Some(items) = attr.meta_item_list() {
951951
for item in items {

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11381138
});
11391139
} else {
11401140
issued_spans.var_subdiag(
1141-
Some(self.infcx.tcx.sess.diagnostic()),
1141+
Some(self.infcx.tcx.sess.dcx()),
11421142
&mut err,
11431143
Some(issued_borrow.kind),
11441144
|kind, var_span| {
@@ -1155,7 +1155,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11551155
);
11561156

11571157
borrow_spans.var_subdiag(
1158-
Some(self.infcx.tcx.sess.diagnostic()),
1158+
Some(self.infcx.tcx.sess.dcx()),
11591159
&mut err,
11601160
Some(gen_borrow_kind),
11611161
|kind, var_span| {

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
124124
let did = did.expect_local();
125125
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
126126
diag.eager_subdiagnostic(
127-
self.infcx.tcx.sess.diagnostic(),
127+
self.infcx.tcx.sess.dcx(),
128128
OnClosureNote::InvokedTwice {
129129
place_name: &ty::place_to_string_for_capture(
130130
self.infcx.tcx,
@@ -146,7 +146,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
146146
let did = did.expect_local();
147147
if let Some((span, hir_place)) = self.infcx.tcx.closure_kind_origin(did) {
148148
diag.eager_subdiagnostic(
149-
self.infcx.tcx.sess.diagnostic(),
149+
self.infcx.tcx.sess.dcx(),
150150
OnClosureNote::MovedTwice {
151151
place_name: &ty::place_to_string_for_capture(self.infcx.tcx, hir_place),
152152
span: *span,
@@ -1150,7 +1150,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11501150
&& self.infcx.can_eq(self.param_env, ty, self_ty)
11511151
{
11521152
err.eager_subdiagnostic(
1153-
self.infcx.tcx.sess.diagnostic(),
1153+
self.infcx.tcx.sess.dcx(),
11541154
CaptureReasonSuggest::FreshReborrow {
11551155
span: move_span.shrink_to_hi(),
11561156
},

compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl OutlivesSuggestionBuilder {
206206
// If there is exactly one suggestable constraints, then just suggest it. Otherwise, emit a
207207
// list of diagnostics.
208208
let mut diag = if suggested.len() == 1 {
209-
mbcx.infcx.tcx.sess.diagnostic().struct_help(match suggested.last().unwrap() {
209+
mbcx.infcx.tcx.sess.dcx().struct_help(match suggested.last().unwrap() {
210210
SuggestedConstraint::Outlives(a, bs) => {
211211
let bs: SmallVec<[String; 2]> = bs.iter().map(|r| r.to_string()).collect();
212212
format!("add bound `{a}: {}`", bs.join(" + "))
@@ -223,7 +223,7 @@ impl OutlivesSuggestionBuilder {
223223
.infcx
224224
.tcx
225225
.sess
226-
.diagnostic()
226+
.dcx()
227227
.struct_help("the following changes may resolve your lifetime errors");
228228

229229
// Add suggestions.

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2503,7 +2503,7 @@ mod error {
25032503
self.errors.buffered.sort_by_key(|diag| diag.sort_span);
25042504

25052505
for diag in self.errors.buffered.drain(..) {
2506-
self.infcx.tcx.sess.diagnostic().emit_diagnostic(diag);
2506+
self.infcx.tcx.sess.dcx().emit_diagnostic(diag);
25072507
}
25082508
}
25092509

compiler/rustc_borrowck/src/nll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ pub(super) fn dump_annotation<'tcx>(
280280

281281
let def_span = tcx.def_span(body.source.def_id());
282282
let mut err = if let Some(closure_region_requirements) = closure_region_requirements {
283-
let mut err = tcx.sess.diagnostic().struct_span_note(def_span, "external requirements");
283+
let mut err = tcx.sess.dcx().struct_span_note(def_span, "external requirements");
284284

285285
regioncx.annotate(tcx, &mut err);
286286

@@ -299,7 +299,7 @@ pub(super) fn dump_annotation<'tcx>(
299299

300300
err
301301
} else {
302-
let mut err = tcx.sess.diagnostic().struct_span_note(def_span, "no external requirements");
302+
let mut err = tcx.sess.dcx().struct_span_note(def_span, "no external requirements");
303303
regioncx.annotate(tcx, &mut err);
304304

305305
err

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn mirbug(tcx: TyCtxt<'_>, span: Span, msg: String) {
268268
// We sometimes see MIR failures (notably predicate failures) due to
269269
// the fact that we check rvalue sized predicates here. So use `span_delayed_bug`
270270
// to avoid reporting bugs in those cases.
271-
tcx.sess.diagnostic().span_delayed_bug(span, msg);
271+
tcx.sess.dcx().span_delayed_bug(span, msg);
272272
}
273273

274274
enum FieldAccessError {

0 commit comments

Comments
 (0)