Uh oh!
There was an error while loading. Please reload this page.
Update the wording for E0063. This will truncate the fields to 3. - #35691
Conversation
rust-highfive
commented
Aug 15, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (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. |
There was a problem hiding this comment.
Not super happy about this arm. Suggestions welcome!
There was a problem hiding this comment.
I'd be tempted to use an if-expression instead.
let len = remaining_fields.len();let truncated_fields = if len <= 3{(remaining_fields.keys().take(len),"".to_string())}else{(remaining_fields.keys().take(3),format!(", and {} other field{}",(len-3),if x == (len-3){""} else {"s"}))};There are probably are slicker fixes, but maybe that's an idea
There was a problem hiding this comment.
This looks much cleaner :) Re compiling and merging master.
jaredwy
commented
Aug 15, 2016
Added the r? late :( Can't remove the assignee. Sorry about that @nrc |
sophiajt
commented
Aug 15, 2016
It looks pretty good. I commented on the spot you were wondering about. Feel free to ping me again when you want me to take another look. |
jaredwy
commented
Aug 15, 2016
@jonathandturner updated. |
sophiajt
commented
Aug 15, 2016
Great! @bors r+ rollup |
bors
commented
Aug 15, 2016
📌 Commit 65b8be7 has been approved by |
Well that is certainly interesting. @jonathandturner can i use a regex in these error strings? |
sophiajt
commented
Aug 16, 2016
@jaredwy - Instead of regex, since the label testing is substring matching, you could look for labels like "and 1 other field" |
…dturner Update the wording for E0063. This will truncate the fields to 3. Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field This is for rust-lang#35218 as part of rust-lang#35233 r? @jonathandturner
TimNN
commented
Aug 17, 2016
@jaredwy: (I'm assuming you're referring to the travis failure) The order of keys in a However from what I can tell However, even sorting by the original keys would probably not work, since the keys are names, which are just newtyped To get a deterministic sort order for the fields, the easiest solution would probably be to collect the string representation of the keys into a Vec and sort that. (Something like Alternately do as @jonathandturner suggested and just not mention the actual field names in the error messages. |
sophiajt
commented
Aug 17, 2016
jaredwy
commented
Aug 19, 2016
@jonathandturner I went the path of just using substring matching in the tests. The idea of using a sort meant that if anything on the type upstream to introduce stable keys changed we would lose that. The first two tests check that the keys are being outputted so i am confident we will catch a problem. |
sophiajt
commented
Aug 19, 2016
bors
commented
Aug 19, 2016
📌 Commit 7cb1557 has been approved by |
…dturner Update the wording for E0063. This will truncate the fields to 3. Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field This is for rust-lang#35218 as part of rust-lang#35233 r? @jonathandturner
jaredwy
commented
Aug 20, 2016
Looks like this has to remove all the fields. I am not in front of my computer for the weekend. I can fix up the test on monday. Might have to pull it out from the rollup. Sorry about that! |
sophiajt
commented
Aug 20, 2016
@jonathandturner as per the other issue :) Been a little... preoccupied of late. This issue isn't forgotten just probably don't want code written under the influence of pain meds :D Will have the time today or over the weekend to get to this. |
bors
commented
Sep 3, 2016
☔ The latest upstream changes (presumably #36016) made this pull request unmergeable. Please resolve the merge conflicts. |
7cb1557 to
e496fc7CompareI am alive and back from bed rest 👯 I went with the sort method. I wasn't happy having such a large chunk of code untested :) Alphabetical order kind of grew on me in the error output as well. |
Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field
e496fc7 to
0e32d11Comparesophiajt
commented
Sep 9, 2016
@jaredwy - welcome back! If you think the PR is good to go, I can reapprove. |
jaredwy
commented
Sep 9, 2016
If you are happy with the alpha sorting of fields then I think it's good to go. |
sophiajt
commented
Sep 9, 2016
bors
commented
Sep 9, 2016
📌 Commit 0e32d11 has been approved by |
…dturner Update the wording for E0063. This will truncate the fields to 3. Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field This is for rust-lang#35218 as part of rust-lang#35233 r? @jonathandturner
…dturner Update the wording for E0063. This will truncate the fields to 3. Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field This is for rust-lang#35218 as part of rust-lang#35233 r? @jonathandturner
Instead of listing every field it will now show missing
a,z,b, and 1 other fieldThis is for #35218 as part of #35233
r? @jonathandturner