about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src/format.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-18 20:54:03 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-24 07:24:52 +1100
commitd86a48278f7bcd069a56870a70c6376e77bd4ee5 (patch)
tree7b653abdf0eda9cd3568a96299fbfe28a39ee259 /compiler/rustc_builtin_macros/src/format.rs
parent5eccfc388e70d45c98b859af5c14f397ae1c206e (diff)
downloadrust-d86a48278f7bcd069a56870a70c6376e77bd4ee5.tar.gz
rust-d86a48278f7bcd069a56870a70c6376e77bd4ee5.zip
Remove `ExtCtxt` methods that duplicate `DiagCtxt` methods.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/format.rs')
-rw-r--r--compiler/rustc_builtin_macros/src/format.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs
index 2f23146096f..b896e51ddb3 100644
--- a/compiler/rustc_builtin_macros/src/format.rs
+++ b/compiler/rustc_builtin_macros/src/format.rs
@@ -69,7 +69,7 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
     let mut p = ecx.new_parser_from_tts(tts);
 
     if p.token == token::Eof {
-        return Err(ecx.create_err(errors::FormatRequiresString { span: sp }));
+        return Err(ecx.dcx().create_err(errors::FormatRequiresString { span: sp }));
     }
 
     let first_token = &p.token;
@@ -126,7 +126,7 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
                 p.expect(&token::Eq)?;
                 let expr = p.parse_expr()?;
                 if let Some((_, prev)) = args.by_name(ident.name) {
-                    ecx.emit_err(errors::FormatDuplicateArg {
+                    ecx.dcx().emit_err(errors::FormatDuplicateArg {
                         span: ident.span,
                         prev: prev.kind.ident().unwrap().span,
                         duplicate: ident.span,
@@ -139,7 +139,7 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
             _ => {
                 let expr = p.parse_expr()?;
                 if !args.named_args().is_empty() {
-                    ecx.emit_err(errors::PositionalAfterNamed {
+                    ecx.dcx().emit_err(errors::PositionalAfterNamed {
                         span: expr.span,
                         args: args
                             .named_args()
@@ -293,7 +293,7 @@ fn make_format_args(
                 }
             }
         }
-        ecx.emit_err(e);
+        ecx.dcx().emit_err(e);
         return Err(());
     }
 
@@ -351,7 +351,7 @@ fn make_format_args(
                     } else {
                         // For the moment capturing variables from format strings expanded from macros is
                         // disabled (see RFC #2795)
-                        ecx.emit_err(errors::FormatNoArgNamed { span, name });
+                        ecx.dcx().emit_err(errors::FormatNoArgNamed { span, name });
                         DummyResult::raw_expr(span, true)
                     };
                     Ok(args.add(FormatArgument { kind: FormatArgumentKind::Captured(ident), expr }))
@@ -585,7 +585,7 @@ fn invalid_placeholder_type_error(
     } else {
         vec![]
     };
-    ecx.emit_err(errors::FormatUnknownTrait { span: sp.unwrap_or(fmt_span), ty, suggs });
+    ecx.dcx().emit_err(errors::FormatUnknownTrait { span: sp.unwrap_or(fmt_span), ty, suggs });
 }
 
 fn report_missing_placeholders(
@@ -600,12 +600,12 @@ fn report_missing_placeholders(
     fmt_span: Span,
 ) {
     let mut diag = if let &[(span, named)] = &unused[..] {
-        ecx.create_err(errors::FormatUnusedArg { span, named })
+        ecx.dcx().create_err(errors::FormatUnusedArg { span, named })
     } else {
         let unused_labels =
             unused.iter().map(|&(span, named)| errors::FormatUnusedArg { span, named }).collect();
         let unused_spans = unused.iter().map(|&(span, _)| span).collect();
-        ecx.create_err(errors::FormatUnusedArgs {
+        ecx.dcx().create_err(errors::FormatUnusedArgs {
             fmt: fmt_span,
             unused: unused_spans,
             unused_labels,
@@ -776,7 +776,7 @@ fn report_redundant_format_arguments<'a>(
             None
         };
 
-        return Some(ecx.create_err(errors::FormatRedundantArgs {
+        return Some(ecx.dcx().create_err(errors::FormatRedundantArgs {
             n: args_spans.len(),
             span: MultiSpan::from(args_spans),
             note: multispan,
@@ -876,7 +876,7 @@ fn report_invalid_references(
         } else {
             MultiSpan::from_spans(spans)
         };
-        e = ecx.create_err(errors::FormatPositionalMismatch {
+        e = ecx.dcx().create_err(errors::FormatPositionalMismatch {
             span,
             n: num_placeholders,
             desc: num_args_desc,
@@ -942,7 +942,7 @@ fn report_invalid_references(
                 head = indexes.into_iter().map(|i| i.to_string()).collect::<Vec<_>>().join(", ")
             )
         };
-        e = ecx.struct_span_err(
+        e = ecx.dcx().struct_span_err(
             span,
             format!("invalid reference to positional {arg_list} ({num_args_desc})"),
         );