summary refs log tree commit diff
path: root/src/test/compile-fail/numeric-fields.rs
AgeCommit message (Collapse)AuthorLines
2017-07-31limit and delimit available fields in noteZack M. Davis-1/+1
Also, don't show the note if no fields are available (usually due to privacy).
2017-07-23field does not exist error: note fields if Levenshtein suggestion failsZack M. Davis-1/+2
When trying to access or initialize a nonexistent field, if we can't infer what field was meant (by virtue of the purported field in the source being a small Levenshtein distance away from an actual field, suggestive of a typo), issue a note listing all the available fields. To reduce terminal clutter, we don't issue the note when we have a `find_best_match_for_name` Levenshtein suggestion: the suggestion is probably right. The third argument of the call to `find_best_match_for_name` is changed to `None`, accepting the default maximum Levenshtein distance of one-third of the identifier supplied for correction. The previous value of `Some(name.len())` was overzealous, inappropriately very Levenshtein-distant suggestions when the attempted field access could not plausibly be a mere typo. For example, if a struct has fields `mule` and `phone`, but I type `.donkey`, I'd rather the error have a note listing that the available fields are, in fact, `mule` and `phone` (which is the behavior induced by this patch) rather than the error asking "did you mean `phone`?" (which is the behavior on master). The "only find fits with at least one matching letter" comment was accurate when it was first introduced in 09d992471 (January 2015), but is a vicious lie in its present context before a call to `find_best_match_for_name` and must be destroyed (replacing every letter is a Levenshtein distance of name.len()). The present author claims that this suffices to resolve #42599.
2017-05-23Stabilize in 1.19Matthew-1/+1
2017-04-20Do not show `::constructor` on tuple struct diagnosticsEsteban Küber-1/+1
2017-04-20Stabilize RFC 1506 - clarified ADT kindsMatthew-2/+0
2016-09-20Update E0560 to include labelaclarry-2/+6
2016-09-03Check fields in union patters/expressionsVadim Petrochenkov-1/+1
Make parsing of union items backward compatible Add some tests
2016-08-13Parse numeric fields in struct expressions and patternsVadim Petrochenkov-0/+20