-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Suggest &str.chars()
on attempt to &str.iter()
#90803
Suggest &str.chars()
on attempt to &str.iter()
#90803
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
Here's a similar error:
Maybe this one should mention |
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 would prefer it if we could have a more... generalized solution for this problem. One that I've seen presented is an #[alias("alt_name")]
attribute, where we could manually annotate methods in std
with common names used in other languages for the same behavior. In this case we could annotate #[alias("iter", "codepoints")] fn chars
and let that machinery do the rest.
But in the meantime I'm not against landing targeted solutions, although it is additional tech debt.
@r00ster91 that error occurs in a separate part of the compiler. E0599 occurs during typeck, while E0277 occurs during trait resolution. It is also using the |
e5afb63
to
ae6f7b6
Compare
r? @estebank |
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.
There's some trailing whitespace, but after fixing that r=me
check if `String` or `&String` or `&str` Update compiler/rustc_typeck/src/check/method/suggest.rs Co-authored-by: Esteban Kuber <[email protected]> remove some trailing whitespace
f103b93
to
d562f48
Compare
@bors r+ |
📌 Commit d562f48 has been approved by |
…-iter, r=estebank Suggest `&str.chars()` on attempt to `&str.iter()` closes rust-lang#90786
Rollup of 8 pull requests Successful merges: - rust-lang#86455 (check where-clause for explicit `Sized` before suggesting `?Sized`) - rust-lang#90801 (Normalize both arguments of `equate_normalized_input_or_output`) - rust-lang#90803 (Suggest `&str.chars()` on attempt to `&str.iter()`) - rust-lang#90819 (Fixes incorrect handling of TraitRefs when emitting suggestions.) - rust-lang#90910 (fix getting the discriminant of a zero-variant enum) - rust-lang#90925 (rustc_mir_build: reorder bindings) - rust-lang#90928 (Use a different server for checking clock drift) - rust-lang#90936 (Add a regression test for rust-lang#80772) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
closes #90786