-
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
Account for existing bindings when suggesting pin!()
#125684
Merged
Merged
Conversation
This file contains 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
The following suggestion is incorrect, as it doesn't account for the binding: ``` error[E0599]: no method named `poll` found for type parameter `F` in the current scope --> $DIR/pin-needed-to-poll-3.rs:19:28 | LL | impl<F> Future for FutureWrapper<F> | - method `poll` not found for this type parameter ... LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | help: consider pinning the expression | LL ~ let res = let mut pinned = std::pin::pin!(self.fut); LL ~ pinned.as_mut().poll(cx); | ```
When we encounter a situation where we'd suggest `pin!()`, we now account for that expression exising as part of an assignment and provide an appropriate suggestion: ``` error[E0599]: no method named `poll` found for type parameter `F` in the current scope --> $DIR/pin-needed-to-poll-3.rs:19:28 | LL | impl<F> Future for FutureWrapper<F> | - method `poll` not found for this type parameter ... LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | help: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(self.fut); LL ~ let res = pinned.as_mut().poll(cx); | ``` Fix rust-lang#125661.
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
May 28, 2024
mu001999
approved these changes
May 29, 2024
... why don't I see any changes to existing tests, and solely the new test added by this PR? was this diagnostic suggestion added without a unit test in the first place? Sigh. |
@bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 11, 2024
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Jun 11, 2024
…, r=pnkfelix Account for existing bindings when suggesting `pin!()` When we encounter a situation where we'd suggest `pin!()`, we now account for that expression existing as part of an assignment and provide an appropriate suggestion: ``` error[E0599]: no method named `poll` found for type parameter `F` in the current scope --> $DIR/pin-needed-to-poll-3.rs:19:28 | LL | impl<F> Future for FutureWrapper<F> | - method `poll` not found for this type parameter ... LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | help: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(self.fut); LL ~ let res = pinned.as_mut().poll(cx); | ``` Fix rust-lang#125661.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 11, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#115974 (Split core's PanicInfo and std's PanicInfo) - rust-lang#125659 (Remove usage of `isize` in example) - rust-lang#125669 (CI: Update riscv64gc-linux job to Ubuntu 22.04, rename to riscv64gc-gnu) - rust-lang#125684 (Account for existing bindings when suggesting `pin!()`) - rust-lang#126055 (Expand list of trait implementers in E0277 when calling rustc with --verbose) - rust-lang#126174 (Migrate `tests/run-make/prefer-dylib` to `rmake.rs`) - rust-lang#126256 (Add {{target}} substitution to compiletest) r? `@ghost` `@rustbot` modify labels: rollup
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Jun 11, 2024
…, r=pnkfelix Account for existing bindings when suggesting `pin!()` When we encounter a situation where we'd suggest `pin!()`, we now account for that expression existing as part of an assignment and provide an appropriate suggestion: ``` error[E0599]: no method named `poll` found for type parameter `F` in the current scope --> $DIR/pin-needed-to-poll-3.rs:19:28 | LL | impl<F> Future for FutureWrapper<F> | - method `poll` not found for this type parameter ... LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | help: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(self.fut); LL ~ let res = pinned.as_mut().poll(cx); | ``` Fix rust-lang#125661.
This was referenced Jun 11, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 11, 2024
Rollup of 6 pull requests Successful merges: - rust-lang#115974 (Split core's PanicInfo and std's PanicInfo) - rust-lang#125659 (Remove usage of `isize` in example) - rust-lang#125669 (CI: Update riscv64gc-linux job to Ubuntu 22.04, rename to riscv64gc-gnu) - rust-lang#125684 (Account for existing bindings when suggesting `pin!()`) - rust-lang#126055 (Expand list of trait implementers in E0277 when calling rustc with --verbose) - rust-lang#126174 (Migrate `tests/run-make/prefer-dylib` to `rmake.rs`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 12, 2024
Rollup merge of rust-lang#125684 - estebank:pin-to-binding-suggestion, r=pnkfelix Account for existing bindings when suggesting `pin!()` When we encounter a situation where we'd suggest `pin!()`, we now account for that expression existing as part of an assignment and provide an appropriate suggestion: ``` error[E0599]: no method named `poll` found for type parameter `F` in the current scope --> $DIR/pin-needed-to-poll-3.rs:19:28 | LL | impl<F> Future for FutureWrapper<F> | - method `poll` not found for this type parameter ... LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | help: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(self.fut); LL ~ let res = pinned.as_mut().poll(cx); | ``` Fix rust-lang#125661.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
When we encounter a situation where we'd suggest
pin!()
, we now account for that expression existing as part of an assignment and provide an appropriate suggestion:Fix #125661.