1

rustc: use more correct span data in for loop desugaring by notriddle · Pull Req...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88214
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

notriddle commented 26 days ago

edited

Fixes #82462

Before:

  help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
     |
  LL |     for x in DroppingSlice(&*v).iter(); {
     |                                       +

After:

  help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
     |
  LL |     };
     |      +

This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK