about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-16 05:08:03 +0000
committerbors <bors@rust-lang.org>2024-02-16 05:08:03 +0000
commitc335b4e4a0a156ec9c7825e2ccd6edf0656f6902 (patch)
tree13da1dc17527ff5aca8c42838d1ff950bf140266 /compiler/rustc_errors/src/lib.rs
parent6c117f632121f0a4d31499cb105b549c545116d3 (diff)
parent840ca093e6e44588b7af0564756cd2384c9a6da9 (diff)
downloadrust-c335b4e4a0a156ec9c7825e2ccd6edf0656f6902.tar.gz
rust-c335b4e4a0a156ec9c7825e2ccd6edf0656f6902.zip
Auto merge of #3301 - rust-lang:rustup-2024-02-16, r=saethlin
Automatic Rustup
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
-rw-r--r--compiler/rustc_errors/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index d876f28040d..b0db3545ae7 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -320,7 +320,9 @@ impl CodeSuggestion {
                 // We need to keep track of the difference between the existing code and the added
                 // or deleted code in order to point at the correct column *after* substitution.
                 let mut acc = 0;
+                let mut only_capitalization = false;
                 for part in &substitution.parts {
+                    only_capitalization |= is_case_difference(sm, &part.snippet, part.span);
                     let cur_lo = sm.lookup_char_pos(part.span.lo());
                     if prev_hi.line == cur_lo.line {
                         let mut count =
@@ -393,7 +395,6 @@ impl CodeSuggestion {
                     }
                 }
                 highlights.push(std::mem::take(&mut line_highlight));
-                let only_capitalization = is_case_difference(sm, &buf, bounding_span);
                 // if the replacement already ends with a newline, don't print the next line
                 if !buf.ends_with('\n') {
                     push_trailing(&mut buf, prev_line.as_ref(), &prev_hi, None);