diff options
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/asm.rs | 28 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 33 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/format.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 37 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/pat.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/path.rs | 4 |
7 files changed, 66 insertions, 60 deletions
diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index 4c81983c242..a5986f2bba5 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -32,7 +32,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let asm_arch = if self.tcx.sess.opts.actually_rustdoc { None } else { self.tcx.sess.asm_arch }; if asm_arch.is_none() && !self.tcx.sess.opts.actually_rustdoc { - self.tcx.sess.emit_err(InlineAsmUnsupportedTarget { span: sp }); + self.dcx().emit_err(InlineAsmUnsupportedTarget { span: sp }); } if let Some(asm_arch) = asm_arch { // Inline assembly is currently only stable for these architectures. @@ -60,7 +60,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { && !matches!(asm_arch, Some(asm::InlineAsmArch::X86 | asm::InlineAsmArch::X86_64)) && !self.tcx.sess.opts.actually_rustdoc { - self.tcx.sess.emit_err(AttSyntaxOnlyX86 { span: sp }); + self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp }); } if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind { feature_err( @@ -87,7 +87,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { != source_map.span_to_snippet(*abi_span)) .then_some(()); - self.tcx.sess.emit_err(AbiSpecifiedMultipleTimes { + self.dcx().emit_err(AbiSpecifiedMultipleTimes { abi_span: *abi_span, prev_name: *prev_name, prev_span: *prev_sp, @@ -100,14 +100,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } Err(&[]) => { - self.tcx.sess.emit_err(ClobberAbiNotSupported { abi_span: *abi_span }); + self.dcx().emit_err(ClobberAbiNotSupported { abi_span: *abi_span }); } Err(supported_abis) => { let mut abis = format!("`{}`", supported_abis[0]); for m in &supported_abis[1..] { let _ = write!(abis, ", `{m}`"); } - self.tcx.sess.emit_err(InvalidAbiClobberAbi { + self.dcx().emit_err(InvalidAbiClobberAbi { abi_span: *abi_span, supported_abis: abis, }); @@ -128,7 +128,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { InlineAsmRegOrRegClass::Reg(reg) => { asm::InlineAsmRegOrRegClass::Reg(if let Some(asm_arch) = asm_arch { asm::InlineAsmReg::parse(asm_arch, reg).unwrap_or_else(|error| { - sess.emit_err(InvalidRegister { op_span: *op_sp, reg, error }); + self.dcx().emit_err(InvalidRegister { + op_span: *op_sp, + reg, + error, + }); asm::InlineAsmReg::Err }) } else { @@ -139,7 +143,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { asm::InlineAsmRegOrRegClass::RegClass(if let Some(asm_arch) = asm_arch { asm::InlineAsmRegClass::parse(asm_arch, reg_class).unwrap_or_else( |error| { - sess.emit_err(InvalidRegisterClass { + self.dcx().emit_err(InvalidRegisterClass { op_span: *op_sp, reg_class, error, @@ -276,7 +280,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { class_name: class.name(), } }; - sess.emit_err(InvalidAsmTemplateModifierRegClass { + self.dcx().emit_err(InvalidAsmTemplateModifierRegClass { placeholder_span, op_span: op_sp, sub, @@ -284,14 +288,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } hir::InlineAsmOperand::Const { .. } => { - sess.emit_err(InvalidAsmTemplateModifierConst { + self.dcx().emit_err(InvalidAsmTemplateModifierConst { placeholder_span, op_span: op_sp, }); } hir::InlineAsmOperand::SymFn { .. } | hir::InlineAsmOperand::SymStatic { .. } => { - sess.emit_err(InvalidAsmTemplateModifierSym { + self.dcx().emit_err(InvalidAsmTemplateModifierSym { placeholder_span, op_span: op_sp, }); @@ -315,7 +319,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // require that the operand name an explicit register, not a // register class. if reg_class.is_clobber_only(asm_arch.unwrap()) && !op.is_clobber() { - sess.emit_err(RegisterClassOnlyClobber { + self.dcx().emit_err(RegisterClassOnlyClobber { op_span: op_sp, reg_class_name: reg_class.name(), }); @@ -384,7 +388,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } }; - sess.emit_err(RegisterConflict { + self.dcx().emit_err(RegisterConflict { op_span1: op_sp, op_span2: op_sp2, reg1_name: reg_str(idx), diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 1f6d47ab453..7e638266478 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -249,7 +249,7 @@ impl<'hir> LoweringContext<'_, 'hir> { self.lower_expr_range(e.span, e1.as_deref(), e2.as_deref(), *lims) } ExprKind::Underscore => { - let guar = self.tcx.sess.emit_err(UnderscoreExprLhsAssign { span: e.span }); + let guar = self.dcx().emit_err(UnderscoreExprLhsAssign { span: e.span }); hir::ExprKind::Err(guar) } ExprKind::Path(qself, path) => { @@ -294,8 +294,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let rest = match &se.rest { StructRest::Base(e) => Some(self.lower_expr(e)), StructRest::Rest(sp) => { - let guar = - self.tcx.sess.emit_err(BaseExpressionDoubleDot { span: *sp }); + let guar = self.dcx().emit_err(BaseExpressionDoubleDot { span: *sp }); Some(&*self.arena.alloc(self.expr_err(*sp, guar))) } StructRest::None => None, @@ -332,9 +331,9 @@ impl<'hir> LoweringContext<'_, 'hir> { |this| this.with_new_scopes(e.span, |this| this.lower_block_expr(block)), ), ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()), - ExprKind::Err => hir::ExprKind::Err( - self.tcx.sess.span_delayed_bug(e.span, "lowered ExprKind::Err"), - ), + ExprKind::Err => { + hir::ExprKind::Err(self.dcx().span_delayed_bug(e.span, "lowered ExprKind::Err")) + } ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr), ExprKind::Paren(_) | ExprKind::ForLoop { .. } => { @@ -584,13 +583,13 @@ impl<'hir> LoweringContext<'_, 'hir> { if self.tcx.features().never_patterns { // If the feature is off we already emitted the error after parsing. let suggestion = span.shrink_to_hi(); - self.tcx.sess.emit_err(MatchArmWithNoBody { span, suggestion }); + self.dcx().emit_err(MatchArmWithNoBody { span, suggestion }); } } else if let Some(body) = &arm.body { - self.tcx.sess.emit_err(NeverPatternWithBody { span: body.span }); + self.dcx().emit_err(NeverPatternWithBody { span: body.span }); guard = None; } else if let Some(g) = &arm.guard { - self.tcx.sess.emit_err(NeverPatternWithGuard { span: g.span }); + self.dcx().emit_err(NeverPatternWithGuard { span: g.span }); guard = None; } @@ -902,7 +901,7 @@ impl<'hir> LoweringContext<'_, 'hir> { Some(hir::CoroutineKind::Coroutine) | Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _)) | None => { - return hir::ExprKind::Err(self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks { + return hir::ExprKind::Err(self.dcx().emit_err(AwaitOnlyInAsyncFnAndBlocks { await_kw_span, item_span: self.current_item, })); @@ -1129,7 +1128,7 @@ impl<'hir> LoweringContext<'_, 'hir> { match coroutine_kind { Some(hir::CoroutineKind::Coroutine) => { if decl.inputs.len() > 1 { - self.tcx.sess.emit_err(CoroutineTooManyParameters { fn_decl_span }); + self.dcx().emit_err(CoroutineTooManyParameters { fn_decl_span }); } Some(movability) } @@ -1142,7 +1141,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } None => { if movability == Movability::Static { - self.tcx.sess.emit_err(ClosureCannotBeStatic { fn_decl_span }); + self.dcx().emit_err(ClosureCannotBeStatic { fn_decl_span }); } None } @@ -1181,7 +1180,7 @@ impl<'hir> LoweringContext<'_, 'hir> { }; if let &ClosureBinder::For { span, .. } = binder { - self.tcx.sess.emit_err(NotSupportedForLifetimeBinderAsyncClosure { span }); + self.dcx().emit_err(NotSupportedForLifetimeBinderAsyncClosure { span }); } let (binder_clause, generic_params) = self.lower_closure_binder(binder); @@ -1192,7 +1191,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let body = self.with_new_scopes(fn_decl_span, |this| { // FIXME(cramertj): allow `async` non-`move` closures with arguments. if capture_clause == CaptureBy::Ref && !decl.inputs.is_empty() { - this.tcx.sess.emit_err(AsyncNonMoveClosureNotSupported { fn_decl_span }); + this.dcx().emit_err(AsyncNonMoveClosureNotSupported { fn_decl_span }); } // Transform `async |x: u8| -> X { ... }` into @@ -1448,7 +1447,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ); let fields_omitted = match &se.rest { StructRest::Base(e) => { - self.tcx.sess.emit_err(FunctionalRecordUpdateDestructuringAssignment { + self.dcx().emit_err(FunctionalRecordUpdateDestructuringAssignment { span: e.span, }); true @@ -1544,7 +1543,7 @@ impl<'hir> LoweringContext<'_, 'hir> { (None, Some(..), Closed) => hir::LangItem::RangeToInclusive, (Some(..), Some(..), Closed) => unreachable!(), (start, None, Closed) => { - self.tcx.sess.emit_err(InclusiveRangeWithNoEnd { span }); + self.dcx().emit_err(InclusiveRangeWithNoEnd { span }); match start { Some(..) => hir::LangItem::RangeFrom, None => hir::LangItem::RangeFull, @@ -1653,7 +1652,7 @@ impl<'hir> LoweringContext<'_, 'hir> { Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _)) => true, Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _)) => { return hir::ExprKind::Err( - self.tcx.sess.emit_err(AsyncCoroutinesNotSupported { span }), + self.dcx().emit_err(AsyncCoroutinesNotSupported { span }), ); } Some(hir::CoroutineKind::Coroutine) | None => { diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs index 6a82005c448..00cb09d7a54 100644 --- a/compiler/rustc_ast_lowering/src/format.rs +++ b/compiler/rustc_ast_lowering/src/format.rs @@ -267,7 +267,7 @@ fn make_count<'hir>( ctx.expr( sp, hir::ExprKind::Err( - ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count"), + ctx.dcx().span_delayed_bug(sp, "lowered bad format_args count"), ), ) } @@ -306,7 +306,7 @@ fn make_format_spec<'hir>( } Err(_) => ctx.expr( sp, - hir::ExprKind::Err(ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count")), + hir::ExprKind::Err(ctx.dcx().span_delayed_bug(sp, "lowered bad format_args count")), ), }; let &FormatOptions { diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 9c990cb4619..81457018b37 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -265,7 +265,7 @@ impl<'hir> LoweringContext<'_, 'hir> { &ImplTraitContext::Disallowed(ImplTraitPosition::Generic), |this| match ty { None => { - let guar = this.tcx.sess.span_delayed_bug( + let guar = this.dcx().span_delayed_bug( span, "expected to lower type alias type, but it was missing", ); @@ -879,7 +879,7 @@ impl<'hir> LoweringContext<'_, 'hir> { &ImplTraitContext::Disallowed(ImplTraitPosition::Generic), |this| match ty { None => { - let guar = this.tcx.sess.span_delayed_bug( + let guar = this.dcx().span_delayed_bug( i.span, "expected to lower associated type, but it was missing", ); @@ -1012,7 +1012,7 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_block_expr_opt(&mut self, span: Span, block: Option<&Block>) -> hir::Expr<'hir> { match block { Some(block) => self.lower_block_expr(block), - None => self.expr_err(span, self.tcx.sess.span_delayed_bug(span, "no block")), + None => self.expr_err(span, self.dcx().span_delayed_bug(span, "no block")), } } @@ -1022,7 +1022,7 @@ impl<'hir> LoweringContext<'_, 'hir> { &[], match expr { Some(expr) => this.lower_expr_mut(expr), - None => this.expr_err(span, this.tcx.sess.span_delayed_bug(span, "no block")), + None => this.expr_err(span, this.dcx().span_delayed_bug(span, "no block")), }, ) }) @@ -1296,7 +1296,7 @@ impl<'hir> LoweringContext<'_, 'hir> { .map(|s| Symbol::intern(s)) .collect::<Vec<_>>(); let suggested_name = find_best_match_for_name(&abi_names, abi.symbol_unescaped, None); - self.tcx.sess.emit_err(InvalidAbi { + self.dcx().emit_err(InvalidAbi { abi: abi.symbol_unescaped, span: abi.span, explain: match err { @@ -1383,7 +1383,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } let is_param = *is_param.get_or_insert_with(compute_is_param); if !is_param { - self.tcx.sess.emit_err(MisplacedRelaxTraitBound { span: bound.span() }); + self.dcx().emit_err(MisplacedRelaxTraitBound { span: bound.span() }); } } } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index e35d7d62cad..e3954116288 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -53,7 +53,7 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; -use rustc_errors::{DiagnosticArgFromDisplay, StashKey}; +use rustc_errors::{DiagCtxt, DiagnosticArgFromDisplay, StashKey}; use rustc_hir as hir; use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res}; use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE}; @@ -183,6 +183,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { host_param_id: None, } } + + pub(crate) fn dcx(&self) -> &'hir DiagCtxt { + self.tcx.dcx() + } } trait ResolverAstLoweringExt { @@ -1035,11 +1039,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { && first_char.is_ascii_lowercase() { let mut err = if !data.inputs.is_empty() { - self.tcx.sess.create_err(errors::BadReturnTypeNotation::Inputs { + self.dcx().create_err(errors::BadReturnTypeNotation::Inputs { span: data.inputs_span, }) } else if let FnRetTy::Ty(ty) = &data.output { - self.tcx.sess.create_err(errors::BadReturnTypeNotation::Output { + self.dcx().create_err(errors::BadReturnTypeNotation::Output { span: data.inputs_span.shrink_to_hi().to(ty.span), }) } else { @@ -1163,7 +1167,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { hir::TypeBindingKind::Constraint { bounds } } DesugarKind::Error(position) => { - let guar = self.tcx.sess.emit_err(errors::MisplacedAssocTyBinding { + let guar = self.dcx().emit_err(errors::MisplacedAssocTyBinding { span: constraint.span, position: DiagnosticArgFromDisplay(position), }); @@ -1205,7 +1209,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { data.inputs.last().unwrap().span.shrink_to_hi().to(data.inputs_span.shrink_to_hi()); AssocTyParenthesesSub::NotEmpty { open_param, close_param } }; - self.tcx.sess.emit_err(AssocTyParentheses { span: data.span, sub }); + self.dcx().emit_err(AssocTyParentheses { span: data.span, sub }); } #[instrument(level = "debug", skip(self))] @@ -1347,20 +1351,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let kind = match &t.kind { TyKind::Infer => hir::TyKind::Infer, TyKind::Err => { - hir::TyKind::Err(self.tcx.sess.span_delayed_bug(t.span, "TyKind::Err lowered")) + hir::TyKind::Err(self.dcx().span_delayed_bug(t.span, "TyKind::Err lowered")) } // FIXME(unnamed_fields): IMPLEMENTATION IN PROGRESS #[allow(rustc::untranslatable_diagnostic)] #[allow(rustc::diagnostic_outside_of_impl)] - TyKind::AnonStruct(ref _fields) => hir::TyKind::Err( - self.tcx.sess.span_err(t.span, "anonymous structs are unimplemented"), - ), + TyKind::AnonStruct(ref _fields) => { + hir::TyKind::Err(self.dcx().span_err(t.span, "anonymous structs are unimplemented")) + } // FIXME(unnamed_fields): IMPLEMENTATION IN PROGRESS #[allow(rustc::untranslatable_diagnostic)] #[allow(rustc::diagnostic_outside_of_impl)] - TyKind::AnonUnion(ref _fields) => hir::TyKind::Err( - self.tcx.sess.span_err(t.span, "anonymous unions are unimplemented"), - ), + TyKind::AnonUnion(ref _fields) => { + hir::TyKind::Err(self.dcx().span_err(t.span, "anonymous unions are unimplemented")) + } TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)), TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)), TyKind::Ref(region, mt) => { @@ -1518,7 +1522,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { hir::TyKind::Err(guar) } ImplTraitContext::Disallowed(position) => { - let guar = self.tcx.sess.emit_err(MisplacedImplTrait { + let guar = self.dcx().emit_err(MisplacedImplTrait { span: t.span, position: DiagnosticArgFromDisplay(position), }); @@ -1528,7 +1532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } TyKind::MacCall(_) => panic!("`TyKind::MacCall` should have been expanded by now"), TyKind::CVarArgs => { - let guar = self.tcx.sess.span_delayed_bug( + let guar = self.dcx().span_delayed_bug( t.span, "`TyKind::CVarArgs` should have been handled elsewhere", ); @@ -1672,8 +1676,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { if let Some(old_def_id) = self.orig_opt_local_def_id(param) { old_def_id } else { - self.tcx - .sess + self.dcx() .span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime"); continue; } @@ -2569,7 +2572,7 @@ impl<'hir> GenericArgsCtor<'hir> { let hir_id = lcx.next_id(); let Some(host_param_id) = lcx.host_param_id else { - lcx.tcx.sess.span_delayed_bug( + lcx.dcx().span_delayed_bug( span, "no host param id for call in const yet no errors reported", ); diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index 3ffa4f1f2e6..1c405fac7e4 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -140,7 +140,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // This is not allowed as a sub-tuple pattern PatKind::Ident(_, ident, Some(sub)) if sub.is_rest() => { let sp = pat.span; - self.tcx.sess.emit_err(SubTupleBinding { + self.dcx().emit_err(SubTupleBinding { span: sp, ident_name: ident.name, ident: *ident, @@ -289,12 +289,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { /// Emit a friendly error for extra `..` patterns in a tuple/tuple struct/slice pattern. pub(crate) fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str) { - self.tcx.sess.emit_err(ExtraDoubleDot { span: sp, prev_span: prev_sp, ctx }); + self.dcx().emit_err(ExtraDoubleDot { span: sp, prev_span: prev_sp, ctx }); } /// Used to ban the `..` pattern in places it shouldn't be semantically. fn ban_illegal_rest_pat(&self, sp: Span) -> hir::PatKind<'hir> { - self.tcx.sess.emit_err(MisplacedDoubleDot { span: sp }); + self.dcx().emit_err(MisplacedDoubleDot { span: sp }); // We're not in a list context so `..` can be reasonably treated // as `_` because it should always be valid and roughly matches the @@ -334,7 +334,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ExprKind::Path(..) if allow_paths => {} ExprKind::Unary(UnOp::Neg, inner) if matches!(inner.kind, ExprKind::Lit(_)) => {} _ => { - let guar = self.tcx.sess.emit_err(ArbitraryExpressionInPattern { span: expr.span }); + let guar = self.dcx().emit_err(ArbitraryExpressionInPattern { span: expr.span }); return self.arena.alloc(self.expr_err(expr.span, guar)); } } diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index 5ceeb72f291..130eb3521c3 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -140,7 +140,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // We should've returned in the for loop above. - self.tcx.sess.dcx().span_bug( + self.dcx().span_bug( p.span, format!( "lower_qpath: no final extension segment in {}..{}", @@ -214,7 +214,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } else { None }; - self.tcx.sess.emit_err(GenericTypeWithParentheses { span: data.span, sub }); + self.dcx().emit_err(GenericTypeWithParentheses { span: data.span, sub }); ( self.lower_angle_bracketed_parameter_data( &data.as_angle_bracketed_args(), |
