-
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
Implement diagnostic for String conversion #90645
Conversation
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
@terrarier2111 This seems like a great suggestion! Could you please add a test case that triggers the new diagnostic and tests its output? (That will also make it easier to review.) |
Is this okay, how i did it? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
What did i do wrong here? i don't understand this. |
@terrarier2111, to create/update the |
This comment has been minimized.
This comment has been minimized.
@estebank could you review this? |
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.
Thank you for doing this!
I left a couple of nitpicks. Could you also squash your commits into one before we merge?
{ | ||
if let ty::Adt(_def, subst) = found.kind() { | ||
if subst.len() != 0 { | ||
if let rustc_middle::ty::subst::GenericArgKind::Type(ty) = subst[0].unpack() |
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.
Can you maybe use rustc_middle::ty::subst::GenericArgKind
? We generally import the names we use. I don't think we ever use full paths unless they are very short.
I think there are ways you could shorten these. I think that subst
is a Vec
. If so, then you can write something like the following and get rid of two levels of indentation:
if let ty::Adt(_def, [subst]) = found.kind() {
if let GenericArgKind::Type(ty) = subst.unpack() {
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.
This doesn't seem to work. But i can change the path.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
454ae54
to
829a528
Compare
@estebank I squashed all commits, is there anything left to do for me, or is this good to go? |
Lets land this as is ( @bors r+ |
📌 Commit 829a528 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d5a0c7c): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
This is my first real contribution to rustc, any feedback is highly appreciated.
This should fix #89856
Thanks to @estebank for guiding me.