-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suggestion .collect()
for iterators in iterators
#81939
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
@jyn514 |
compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm of mixed feelings regarding this PR because of the suggestion applying to static-reference-to-fn-2.rs
but given that the span isn't shown and the suggestion is marked as potentially incorrect, I guess it's fine. I'll approve once you squash your commits :)
f968e9b
to
553b513
Compare
Thanks, I squashed it :) |
☔ The latest upstream changes (presumably #82443) made this pull request unmergeable. Please resolve the merge conflicts. |
553b513
to
a3db47a
Compare
Thanks, apologies for the delay in approving. @bors r+ |
📌 Commit a3db47a has been approved by |
… r=davidtwco Add suggestion `.collect()` for iterators in iterators Closes rust-lang#81584 ``` error[E0515]: cannot return value referencing function parameter `y` --> main3.rs:4:38 | 4 | ... .map(|y| y.iter().map(|x| x + 1)) | -^^^^^^^^^^^^^^^^^^^^^^ | | | returns a value referencing data owned by the current function | `y` is borrowed here | help: Maybe use `.collect()` to allocate the iterator ``` Added the suggestion: `help: Maybe use `.collect()` to allocate the iterator`
… r=davidtwco Add suggestion `.collect()` for iterators in iterators Closes rust-lang#81584 ``` error[E0515]: cannot return value referencing function parameter `y` --> main3.rs:4:38 | 4 | ... .map(|y| y.iter().map(|x| x + 1)) | -^^^^^^^^^^^^^^^^^^^^^^ | | | returns a value referencing data owned by the current function | `y` is borrowed here | help: Maybe use `.collect()` to allocate the iterator ``` Added the suggestion: `help: Maybe use `.collect()` to allocate the iterator`
Rollup of 10 pull requests Successful merges: - rust-lang#80723 (Implement NOOP_METHOD_CALL lint) - rust-lang#80763 (resolve: Reduce scope of `pub_use_of_private_extern_crate` deprecation lint) - rust-lang#81136 (Improved IO Bytes Size Hint) - rust-lang#81939 (Add suggestion `.collect()` for iterators in iterators) - rust-lang#82289 (Fix underflow in specialized ZipImpl::size_hint) - rust-lang#82728 (Avoid unnecessary Vec construction in BufReader) - rust-lang#82764 (Add {BTreeMap,HashMap}::try_insert) - rust-lang#82770 (Add assert_matches macro.) - rust-lang#82773 (Add diagnostic item to `Default` trait) - rust-lang#82787 (Remove unused code from main.js) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Closes #81584
Added the suggestion:
help: Maybe use
.collect()to allocate the iterator