Remove ExtCtxt methods that duplicate DiagCtxt methods.
This commit is contained in:
@@ -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})"),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user