diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-16 08:02:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-16 08:02:24 +0200 |
| commit | 27a7ced29f952fc73adb25231f52c8b2d9535497 (patch) | |
| tree | 7c36a1691bbc0eda28710b83043f4a0b376e7b1f /compiler | |
| parent | e98669a51a1e0d11cbec7640a747ac0e79ffa289 (diff) | |
| parent | d2dc0f3b0f0267941b47bde7bd48d26b2c22ca6a (diff) | |
| download | rust-27a7ced29f952fc73adb25231f52c8b2d9535497.tar.gz rust-27a7ced29f952fc73adb25231f52c8b2d9535497.zip | |
Rollup merge of #89912 - davidtwco:issue-89280-split-lines-multiple-lines, r=oli-obk
emitter: current substitution can be multi-line Fixes #89280. In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. r? ````@oli-obk````
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 60a48b5a2d9..9b2094adb15 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -341,7 +341,7 @@ impl CodeSuggestion { }); buf.push_str(&part.snippet); let cur_hi = sm.lookup_char_pos(part.span.hi()); - if prev_hi.line == cur_lo.line { + if prev_hi.line == cur_lo.line && cur_hi.line == cur_lo.line { // Account for the difference between the width of the current code and the // snippet being suggested, so that the *later* suggestions are correctly // aligned on the screen. |
