Skip to content

switch Option to external iterators - #7055

Merged
bors merged 3 commits into
rust-lang:incomingfrom
thestinger:iterator
Jun 12, 2013
Merged

switch Option to external iterators#7055
bors merged 3 commits into
rust-lang:incomingfrom
thestinger:iterator

Conversation

@thestinger

Copy link
Copy Markdown
Contributor

This was a lot more painful than just changing x.each to x.iter().advance . I ran into my old friend #5898 and had to add underscores to some method names as a temporary workaround.

The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic @mut failures, so those had to be wrapped in blocks except where the scope ends immediately.

Anyway, the ugliness will be fixed as the compiler issues are fixed and this change will amount to for x.each |x| becoming for x.iter |x| and making all the iterator adaptors available.

I dropped the run-pass tests for old_iter because there's not much point in fixing a module that's on the way out in the next week or so.

@bstrie

Copy link
Copy Markdown
Contributor

The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic @mut failures, so those had to be wrapped in blocks except where the scope ends immediately.

Is there an issue open for this?

@thestinger

Copy link
Copy Markdown
ContributorAuthor

@bstrie: #3511

bors added a commit that referenced this pull request Jun 11, 2013
This was a lot more painful than just changing `x.each` to `x.iter().advance` . I ran into my old friend #5898 and had to add underscores to some method names as a temporary workaround.
The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic `@mut` failures, so those had to be wrapped in blocks except where the scope ends immediately.
Anyway, the ugliness will be fixed as the compiler issues are fixed and this change will amount to `for x.each |x|` becoming `for x.iter |x|` and making all the iterator adaptors available.
I dropped the run-pass tests for `old_iter` because there's not much point in fixing a module that's on the way out in the next week or so.
@borsbors closed this Jun 12, 2013
@bors
bors merged commit bbe3d4a into rust-lang:incomingJun 12, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 6, 2021
Fix unused_unit macro false positive
changelog: Fix [`unused_unit`] false positive with macros
Fixesrust-lang#7055
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
7055: Install rustfmt if needed during formatting request r=matklad a=kinnison
In order to fixrust-lang#6052 and to fixrust-lang#4249 this PR installs `rustfmt` using `rustup` if `rustfmt --help` fails.
In theory we ought to memoise the attempts (both the `--help` and the installation) so that we don't keep retrying something which will fail (e.g. if nightly is missing rustfmt), but this is a first-pass for opinions.
In order to make it possible to notify the user of what happened, I added a facility for `GlobalStateSnapshot` to send *messages* to the client indicating what happened. There may be a cleaner way to do this as well but I wasn't sure exactly what might be best given this is my first time in this codebase.
It may be worth, longer term, working with `rustup` to provide a way to detect a missing component binary since `rustup` returns `1` if `rustfmt` is not installed, which is not ideal.
Co-authored-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thestinger@bstrie@bors