pub struct MissingTypeParams {
pub span: Span,
pub def_span: Span,
+ pub span_snippet: Option<String>,
pub missing_type_params: Vec<Symbol>,
pub empty_generic_args: bool,
}
err.span_label(self.def_span, rustc_errors::fluent::typeck::label);
let mut suggested = false;
- if let (Some(Ok(snippet)), true) = (
- handler.span_to_snippet_from_emitter(self.span),
- // Don't suggest setting the type params if there are some already: the order is
- // tricky to get right and the user will already know what the syntax is.
- self.empty_generic_args,
- ) {
+ // Don't suggest setting the type params if there are some already: the order is
+ // tricky to get right and the user will already know what the syntax is.
+ if let Some(snippet) = self.span_snippet && self.empty_generic_args {
if snippet.ends_with('>') {
// The user wrote `Trait<'a, T>` or similar. To provide an accurate suggestion
// we would have to preserve the right order. For now, as clearly the user is