about summary refs log tree commit diff
path: root/src/test/compile-fail/struct-fields-too-many.rs
AgeCommit message (Collapse)AuthorLines
2017-12-14Move compile-fail tests with NOTE/HELP annotations to UIVadim Petrochenkov-23/+0
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-0/+1
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.
2016-09-20Update E0560 to include labelaclarry-1/+3
2016-09-03Check fields in union patters/expressionsVadim Petrochenkov-1/+1
Make parsing of union items backward compatible Add some tests
2015-01-08Update compile fail tests to use isize.Huon Wilson-1/+1
2013-10-28#8263 part 2: Adding struct name.Joshua Yanovski-1/+1
2012-12-10Reliciense makefiles and testsuite. Yup.Graydon Hoare-0/+10
2012-10-31Fix checking of duplicate and missing struct field initializers. Closes ↵Brian Anderson-0/+10
#3486. Closes #3892