diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-07-19 23:48:43 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-07-19 23:48:43 +0000 |
| commit | 20a3b9a2152ff705af029cbb359bc09a4b43a9c7 (patch) | |
| tree | 998c9484a5c54038362df80b617327ce95285e74 /compiler/rustc_errors/src | |
| parent | 39f42ad9e8430a8abb06c262346e89593278c515 (diff) | |
| download | rust-20a3b9a2152ff705af029cbb359bc09a4b43a9c7.tar.gz rust-20a3b9a2152ff705af029cbb359bc09a4b43a9c7.zip | |
Use the correct span for displaying the line following a derive suggestion
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 9d4d159fd96..a0fa4115c3e 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1982,7 +1982,7 @@ impl EmitterWriter { // We special case `#[derive(_)]\n` and other attribute suggestions, because those // are the ones where context is most useful. let file_lines = sm - .span_to_lines(span.primary_span().unwrap().shrink_to_hi()) + .span_to_lines(parts[0].span.shrink_to_hi()) .expect("span_to_lines failed when emitting suggestion"); let line_num = sm.lookup_char_pos(parts[0].span.lo()).line; if let Some(line) = file_lines.file.get_line(line_num - 1) { |
