-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Expand E0309 explanation with motivating example #38315
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
one problem with the critique from the "Too Many Linked Lists" posting is that is so flippant that its text does not make it clear what exactly is dumb, and why it is dumb. The way I read the complaint, I interpret the post author as saying:
This obviously does not match your reading of the complaint, since even in expanded example you have given, we would still be able to infer the constraint Anyway, I'm not strictly opposed to expanding the explanatory text in the manner proposed here, but just realize that this may not be a satisfactory response to some critics... |
(i restarted one of the travis builds since it seemed like its failure could not have been caused by this PR...) |
I think there are two "layers" to this: understanding why the I agree that the author's original concern is probably more so the latter than the former. Answering the latter in the explanation would obviously also be great, but I can't immediately think of a concise and intuitive example in mind that would serve well for the purposes of exposition. I'd argue that this is still a step in the right direction. |
r=me assuming the restarted travis build completes successfully. (if it doesn't then we need to look into what's going on there.) |
@pnkfelix looks like the tests passed as expected :) |
@bors r+ rollup |
📌 Commit f09e2cc has been approved by |
Expand E0309 explanation with motivating example I recently started reading @gankro's "[Learning Rust With Entirely Too Many Linked Lists](http://cglab.ca/~abeinges/blah/too-many-lists/book/README.html)", and came across [a part](http://cglab.ca/~abeinges/blah/too-many-lists/book/second-iter.html) where he comes across `E0309`, and after showing `rustc --explain E0309` prompty says > This is dumb. I think it's dumb. You have to do it. Humor aside, I think this says something about the current explanation being somewhat lacking. This patch introduces a motivating example saying why `T: 'a` is a necessary restriction. Hopefully, this will help new Rustaceans understand why leaving out the `'a` bound on `T` might lead to broken code.
Rollup of 29 pull requests - Successful merges: #37761, #38006, #38131, #38150, #38158, #38171, #38208, #38215, #38236, #38245, #38289, #38302, #38315, #38346, #38388, #38395, #38398, #38418, #38432, #38451, #38463, #38468, #38470, #38471, #38472, #38478, #38486, #38493, #38498 - Failed merges: #38271, #38483
I recently started reading @gankro's "Learning Rust With Entirely Too Many Linked Lists", and came across a part where he comes across
E0309
, and after showingrustc --explain E0309
prompty saysHumor aside, I think this says something about the current explanation being somewhat lacking.
This patch introduces a motivating example saying why
T: 'a
is a necessary restriction. Hopefully, this will help new Rustaceans understand why leaving out the'a
bound onT
might lead to broken code.