diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index a675a1fb78bb..6923ca7ef1bf 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1462,7 +1462,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { .map(|span| { ( *span, - if span.lo() == span.hi() { "pub " } else { "pub" } + if span.is_empty() { "pub " } else { "pub" } .to_string(), ) })