Rollup merge of #66589 - TheSamsa:master, r=Dylan-DPC
Draw vertical lines correctly in compiler error messages ... with multiline annotations correctly when non-1space unicode characters are to the left For this we use the correct calculation of the 'left' identation closes #66552
This commit is contained in:
commit
7b75a360f6
4 changed files with 28 additions and 4 deletions
|
@ -835,7 +835,7 @@ impl EmitterWriter {
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the colunmn separator.
|
// Write the column separator.
|
||||||
//
|
//
|
||||||
// After this we will have:
|
// After this we will have:
|
||||||
//
|
//
|
||||||
|
@ -906,7 +906,7 @@ impl EmitterWriter {
|
||||||
// | __________
|
// | __________
|
||||||
// | | |
|
// | | |
|
||||||
// | |
|
// | |
|
||||||
// 3 |
|
// 3 | |
|
||||||
// 4 | | }
|
// 4 | | }
|
||||||
// | |_
|
// | |_
|
||||||
for &(pos, annotation) in &annotations_position {
|
for &(pos, annotation) in &annotations_position {
|
||||||
|
@ -920,7 +920,7 @@ impl EmitterWriter {
|
||||||
if pos > 1 && (annotation.has_label() || annotation.takes_space()) {
|
if pos > 1 && (annotation.has_label() || annotation.takes_space()) {
|
||||||
for p in line_offset + 1..=line_offset + pos {
|
for p in line_offset + 1..=line_offset + pos {
|
||||||
buffer.putc(p,
|
buffer.putc(p,
|
||||||
code_offset + annotation.start_col - margin.computed_left,
|
(code_offset + annotation.start_col).saturating_sub(left),
|
||||||
'|',
|
'|',
|
||||||
style);
|
style);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let unicode_is_fun = "‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
|
||||||
|
let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||||
|
//~^ ERROR binary operation `+` cannot be applied to type `&str`
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
error[E0369]: binary operation `+` cannot be applied to type `&str`
|
||||||
|
--> $DIR/non-1-width-unicode-multiline-label.rs:5:260
|
||||||
|
|
|
||||||
|
LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||||
|
| -------------- ^ -------------- &str
|
||||||
|
| | |
|
||||||
|
| | `+` cannot be used to concatenate two `&str` strings
|
||||||
|
| &str
|
||||||
|
|
|
||||||
|
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
||||||
|
|
|
||||||
|
LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!";
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0369`.
|
|
@ -3,7 +3,7 @@ error[E0308]: mismatched types
|
||||||
|
|
|
|
||||||
LL | ...♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄...
|
LL | ...♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄...
|
||||||
| -- ^^ expected `()`, found integer
|
| -- ^^ expected `()`, found integer
|
||||||
| |
|
| |
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue