pub(super) fn warn_if_unreachable(&self, id: hir::HirId, span: Span, kind: &str) {
        // FIXME: Combine these two 'if' expressions into one once
        // let chains are implemented
        if let Diverges::Always { span: orig_span, custom_note } = self.diverges.get() {
            // If span arose from a desugaring of `if` or `while`, then it is the condition itself,
            // which diverges, that we are about to lint on. This gives suboptimal diagnostics.
            // Instead, stop here so that the `if`- or `while`-expression's block is linted instead.
            if !span.is_desugaring(DesugaringKind::CondTemporary)
                && !span.is_desugaring(DesugaringKind::Async)
                && !orig_span.is_desugaring(DesugaringKind::Await)
            {
                self.diverges.set(Diverges::WarnedAlways);

                debug!("warn_if_unreachable: id={:?} span={:?} kind={}", id, span, kind);

                self.tcx().struct_span_lint_hir(lint::builtin::UNREACHABLE_CODE, id, span, |lint| {
                    let msg = format!("unreachable {}", kind);
                    lint.build(&msg)
                        .span_label(span, &msg)
                        .span_label(
                            orig_span,
                            custom_note
                                .unwrap_or("any code following this expression is unreachable"),
                        )
                        .emit();
                })
            }
        }
    }
/// Produces warning on the given node, if the current point in the
/// function is unreachable, and there hasn't been another warning.
Produces warning on the given node, if the current point in the
function is unreachable, and there hasn't been another warning.
Produces warning on the given node if the current point in the function is unreachable and there hasn ' t been another warning .
pub(super) fn warn_if_unreachable(&self, id: hir::HirId, span: Span, kind: &str) {
        // FIXME: Combine these two 'if' expressions into one once
        // let chains are implemented
        if let Diverges::Always { span: orig_span, custom_note } = self.diverges.get() {
            // If span arose from a desugaring of `if` or `while`, then it is the condition itself,
            // which diverges, that we are about to lint on. This gives suboptimal diagnostics.
            // Instead, stop here so that the `if`- or `while`-expression's block is linted instead.
            if !span.is_desugaring(DesugaringKind::CondTemporary)
                && !span.is_desugaring(DesugaringKind::Async)
                && !orig_span.is_desugaring(DesugaringKind::Await)
            {
                self.diverges.set(Diverges::WarnedAlways);
                debug!("warn_if_unreachable: id={:?} span={:?} kind={}", id, span, kind);
                self.tcx().struct_span_lint_hir(lint::builtin::UNREACHABLE_CODE, id, span, |lint| {
                    let msg = format!("unreachable {}", kind);
                    lint.build(&msg)
                        .span_label(span, &msg)
                        .span_label(
                            orig_span,
                            custom_note
                                .unwrap_or("any code following this expression is unreachable"),
                        )
                        .emit();
                })
            }
        }
    }
pub ( super ) fn warn_if_unreachable ( & self , id : hir :: HirId , span : Span , kind : & str ) { // FIXME: Combine these two 'if' expressions into one once // let chains are implemented if let Diverges :: Always { span : orig_span , custom_note } = self . diverges . get ( ) { // If span arose from a desugaring of `if` or `while`, then it is the condition itself, // which diverges, that we are about to lint on. This gives suboptimal diagnostics. // Instead, stop here so that the `if`- or `while`-expression's block is linted instead. if ! span . is_desugaring ( DesugaringKind :: CondTemporary ) && ! span . is_desugaring ( DesugaringKind :: Async ) && ! orig_span . is_desugaring ( DesugaringKind :: Await ) { self . diverges . set ( Diverges :: WarnedAlways ) ; debug ! ( " " id span kind ) ; self . tcx ( ) . struct_span_lint_hir ( lint :: builtin :: UNREACHABLE_CODE , id , span , | lint | { let msg = format ! ( " " kind ) ; lint . build ( & msg ) . span_label ( span , & msg ) . span_label ( orig_span , custom_note . unwrap_or ( " " ) , ) . emit ( ) ; } ) } } }
Produces warning on the given node, if the current point in the
function is unreachable, and there hasn't been another warning.
Produces warning on the given node if the current point in the function is unreachable and there hasn ' t been another warning .
&self
id
hir::HirId
span
Span
kind
&str
&self
id
hir::HirId
span
Span
kind
&str