-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc crashes when attempting to match a &str #3222
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
Comments
#3316 (since it's not obvious what pull request the commit is from). @nikomatsakis , @brson said you had reservations about the pull request? I'm not even sure if the code should compile or not. |
About the code: I think it must compile. The following code compile and execute well:
You must be able to match a borrowed string with constant. Of course, the syntax may be different but, first, this one is consistent with a if test, second, the syntax is understood by the compiler, only the generation has a problem. |
About the reservations: I'm absolutely sure that my analysis of the problem is good and that what I did will work. However, there are two problems. |
About the strings: during one week, I really wonder why you used such a syntax. I finally understood that strings can be modified. Even if the characters are not mutable, a string can grow. I think that most the problems come from that. Most of the time, a string is never modified. You can concatenate strings, take sub strings, ... Each time you generate a new string and you don't modify existing strings. In Java, you have the StringBuffer class to build dynamically a string. For all other cases, you use a String which is constant. Now, the string syntax is not orthogonal nor consistent. If you write: With a consistent string syntax, this issue may has never appeared. |
The reason why Your proposal would basically rename That said, you're right that building up a unique string by appending to it is confusing. We should add a |
#3316 closes this. If you want to suggest additional enhancements to strings, please open a separate issue for it :-) (And thanks for the patch!) |
fix the visitor's starting position when visiting a labelled block
tests: use Waker::noop instead of defining our own Waker
Bumps [tests/perf/s2n-quic](https://github.com/aws/s2n-quic) from `d03cc47` to `d90729d`.
Given this test case:
rustc fails with:
I have no idea if this code should work or not. If it shouldn't work, I think rustc should emit a nicer error message.
The text was updated successfully, but these errors were encountered: