Closed
Conversation
src/doc/guide.md
Outdated
Contributor
There was a problem hiding this comment.
This paragraph doesn't flow too nicely IMHO in the rewritten version. You said we're going to write a more complicated program next, but then take it right back again.
We now build the game at the end of the first section. I wanted to do it as we went along, but it's too hard with these fundamentals not in place. The rest will do the 'as we go' approach, but I think this is better.
Contributor
Author
|
All that stuff should be taken care of now. |
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Oct 6, 2025
Starting with Rust version 1.82.0, the compiler generates similar code
with and without the `with_ref` cfg:
```rust
fn f(x: impl IntoIterator<Item = String>) {
for y in x { println!("{y}"); }
}
fn main() {
#[cfg(with_ref)]
let a = ["foo", "bar"].iter().map(|&s| s.to_string());
#[cfg(not(with_ref))]
let a = ["foo", "bar"].iter().map(|s| s.to_string());
f(a);
}
```
The generated code is strictly identical with `-O`, and identical modulo
some minor reordering without.
changelog: [`inefficient_to_string`]: do not trigger for Rust ≥ 1.82.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This doesn't rely on #15690 for any code, but does for coherence.
We now build the game at the end of the first section.
I wanted to do it as we went along, but it's too hard with these fundamentals not in place. The rest will do the 'as we go' approach, but I think this is better.