Skip to content
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 type params on method without parentheses #68981

Merged
merged 2 commits into from
Feb 13, 2020

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Feb 9, 2020

Account for those type parameters in the structured suggestion when forgetting to call method:

error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>`
  --> $DIR/method-missing-parentheses.rs:2:32
   |
LL |     let _ = vec![].into_iter().collect::<usize>;
   |                                ^^^^^^^---------
   |                                |
   |                                help: use parentheses to call the method: `collect::<usize>()`

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 9, 2020
@estebank
Copy link
Contributor Author

estebank commented Feb 9, 2020

The second commit can be reverted if it is too intrusive for too small a gain.

@petrochenkov
Copy link
Contributor

Looks like the second comment also makes fields with generic arguments legal under #[cfg(FALSE)], which is a language change.

@estebank
Copy link
Contributor Author

estebank commented Feb 9, 2020

@petrochenkov adding delay_span_bug would help with accidental stabilization, but not be a good experience. Is there a place where this check could be done even if cfged out?

src/librustc_typeck/check/expr.rs Outdated Show resolved Hide resolved
src/librustc_typeck/check/expr.rs Outdated Show resolved Hide resolved
src/librustc_typeck/check/expr.rs Outdated Show resolved Hide resolved
src/librustc_parse/parser/expr.rs Show resolved Hide resolved
@estebank
Copy link
Contributor Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Feb 11, 2020

📌 Commit 9d91489 has been approved by davidtwco

@bors 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 Feb 11, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 12, 2020
 Account for type params on method without parentheses

Account for those type parameters in the structured suggestion when forgetting to call method:

```
error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>`
  --> $DIR/method-missing-parentheses.rs:2:32
   |
LL |     let _ = vec![].into_iter().collect::<usize>;
   |                                ^^^^^^^---------
   |                                |
   |                                help: use parentheses to call the method: `collect::<usize>()`
```
bors added a commit that referenced this pull request Feb 12, 2020
Rollup of 7 pull requests

Successful merges:

 - #67954 (Support new LLVM pass manager)
 - #68981 ( Account for type params on method without parentheses)
 - #69002 (miri: improve and simplify overflow detection)
 - #69038 (Add initial debug fmt for Backtrace)
 - #69040 (Cleanup SGX entry code)
 - #69086 (Update compiler-builtins to 0.1.25)
 - #69095 (Minified theme check)

Failed merges:

r? @ghost
@bors bors merged commit 9d91489 into rust-lang:master Feb 13, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants