pub fn to_diagnostic(&self) -> Diagnostic {
        match *self {
            DesugarError::DuplicateDeclarations {
                original_span,
                duplicate_span,
                ref name,
            } => Diagnostic::new_error(format!(
                "name had more than one declaration associated with it `{}`",
                name,
            ))
            .with_label(
                DiagnosticLabel::new_primary(duplicate_span)
                    .with_message("the duplicated declaration"),
            )
            .with_label(
                DiagnosticLabel::new_secondary(original_span)
                    .with_message("the original declaration"),
            ),
            DesugarError::DeclarationFollowedDefinition {
                definition_span,
                declaration_span,
                name: _,
            } => Diagnostic::new_error(format!("declarations cannot follow definitions"))
                .with_label(
                    DiagnosticLabel::new_primary(declaration_span).with_message("the declaration"),
                )
                .with_label(
                    DiagnosticLabel::new_secondary(definition_span)
                        .with_message("the original definition"),
                ),
            DesugarError::DuplicateDefinitions {
                original_span,
                duplicate_span,
                ref name,
            } => Diagnostic::new_error(format!(
                "name had more than one definition associated with it `{}`",
                name,
            ))
            .with_label(
                DiagnosticLabel::new_primary(duplicate_span)
                    .with_message("the duplicated definition"),
            )
            .with_label(
                DiagnosticLabel::new_secondary(original_span)
                    .with_message("the original definition"),
            ),
            DesugarError::CyclicDefinitions { ref cycle } => {
                Diagnostic::new_error(format!("cyclic definition `{}`", cycle)) // TODO: better formatting
            },
        }
    }
/// Convert the error into a diagnostic message
Convert the error into a diagnostic message
Convert the error into a diagnostic message
pub fn to_diagnostic(&self) -> Diagnostic {
        match *self {
            DesugarError::DuplicateDeclarations {
                original_span,
                duplicate_span,
                ref name,
            } => Diagnostic::new_error(format!(
                "name had more than one declaration associated with it `{}`",
                name,
            ))
            .with_label(
                DiagnosticLabel::new_primary(duplicate_span)
                    .with_message("the duplicated declaration"),
            )
            .with_label(
                DiagnosticLabel::new_secondary(original_span)
                    .with_message("the original declaration"),
            ),
            DesugarError::DeclarationFollowedDefinition {
                definition_span,
                declaration_span,
                name: _,
            } => Diagnostic::new_error(format!("declarations cannot follow definitions"))
                .with_label(
                    DiagnosticLabel::new_primary(declaration_span).with_message("the declaration"),
                )
                .with_label(
                    DiagnosticLabel::new_secondary(definition_span)
                        .with_message("the original definition"),
                ),
            DesugarError::DuplicateDefinitions {
                original_span,
                duplicate_span,
                ref name,
            } => Diagnostic::new_error(format!(
                "name had more than one definition associated with it `{}`",
                name,
            ))
            .with_label(
                DiagnosticLabel::new_primary(duplicate_span)
                    .with_message("the duplicated definition"),
            )
            .with_label(
                DiagnosticLabel::new_secondary(original_span)
                    .with_message("the original definition"),
            ),
            DesugarError::CyclicDefinitions { ref cycle } => {
                Diagnostic::new_error(format!("cyclic definition `{}`", cycle)) // TODO: better formatting
            },
        }
    }
pub fn to_diagnostic ( & self ) -> Diagnostic { match * self { DesugarError :: DuplicateDeclarations { original_span , duplicate_span , ref name , } => Diagnostic :: new_error ( format ! ( " " name ) ) . with_label ( DiagnosticLabel :: new_primary ( duplicate_span ) . with_message ( " " ) , ) . with_label ( DiagnosticLabel :: new_secondary ( original_span ) . with_message ( " " ) , ) , DesugarError :: DeclarationFollowedDefinition { definition_span , declaration_span , name : _ , } => Diagnostic :: new_error ( format ! ( " " ) ) . with_label ( DiagnosticLabel :: new_primary ( declaration_span ) . with_message ( " " ) , ) . with_label ( DiagnosticLabel :: new_secondary ( definition_span ) . with_message ( " " ) , ) , DesugarError :: DuplicateDefinitions { original_span , duplicate_span , ref name , } => Diagnostic :: new_error ( format ! ( " " name ) ) . with_label ( DiagnosticLabel :: new_primary ( duplicate_span ) . with_message ( " " ) , ) . with_label ( DiagnosticLabel :: new_secondary ( original_span ) . with_message ( " " ) , ) , DesugarError :: CyclicDefinitions { ref cycle } => { Diagnostic :: new_error ( format ! ( " " cycle ) ) // TODO: better formatting } , } }
Convert the error into a diagnostic message
Convert the error into a diagnostic message
&self
&self