about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2020-11-01Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkovbors-11/+47
Suggest calling associated `fn` inside `trait`s When calling a function that doesn't exist inside of a trait's associated `fn`, and another associated `fn` in that trait has that name, suggest calling it with the appropriate fully-qualified path. Expand the label to be more descriptive. Prompted by the following user experience: https://users.rust-lang.org/t/cannot-find-function/50663
2020-10-30Fix even more clippy warningsJoshua Nelson-34/+20
2020-10-26Suggest calling associated `fn` inside `trait`sEsteban Küber-11/+47
When calling a function that doesn't exist inside of a trait's associated `fn`, and another associated `fn` in that trait has that name, suggest calling it with the appropriate fully-qualified path. Expand the label to be more descriptive. Prompted by the following user experience: https://users.rust-lang.org/t/cannot-find-function/50663
2020-10-26resolve: private fields in tuple struct ctor diagDavid Wood-44/+61
This commit improves the diagnostic emitted when a tuple struct is being constructed which has private fields so that private fields are labelled and the message is improved. Signed-off-by: David Wood <david@davidtw.co>
2020-10-15resolve: improve "try using tuple struct" messageDavid Wood-11/+11
This commit improves the tuple struct case added in rust-lang/rust#77341 so that the context is mentioned in more of the message. Signed-off-by: David Wood <david@davidtw.co>
2020-10-15resolve: suggest variants with placeholdersDavid Wood-60/+86
This commit improves the diagnostic modified in rust-lang/rust#77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). Signed-off-by: David Wood <david@davidtw.co>
2020-10-09address review commentsEsteban Küber-8/+16
2020-10-09Given `<T as Trait>::A: Ty` suggest `T: Trait<A = Ty>`Esteban Küber-0/+118
Fix #75829
2020-10-09Suggest removing bounds even when potential typoEsteban Küber-15/+21
2020-10-09Tweak output and add test casesEsteban Küber-5/+51
2020-10-09Point out why a trait is expected on `Struct + 'lt`Esteban Küber-1/+10
2020-10-07Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, ↵bors-21/+124
r=estebank resolve: improve "try using the enum's variant" Fixes #73427. This PR improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation. r? `@estebank`
2020-10-02resolve: prohibit anon const non-static lifetimesDavid Wood-0/+33
This commit modifies name resolution to emit an error when non-static lifetimes are used in anonymous constants when the `min_const_generics` feature is enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-09-29resolve: improve "try using the enum's variant"David Wood-21/+124
This commit improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. Signed-off-by: David Wood <david@davidtw.co>
2020-09-17use strip_prefix over starts_with and manual slicing based on pattern length ↵Matthias Krüger-2/+2
(clippy::manual_strip)
2020-09-15fix a couple of stylistic clippy warningsMatthias Krüger-1/+1
namely: clippy::redundant_pattern_matching clippy::redundant_pattern clippy::search_is_some clippy::filter_next clippy::into_iter_on_ref clippy::clone_on_copy clippy::needless_return
2020-09-11Auto merge of #76499 - guswynn:priv_des, r=petrochenkovbors-10/+45
Give better diagnostic when using a private tuple struct constructor Fixes #75907 Some notes: 1. This required some deep changes, including removing a Copy impl for PatKind. If some tests fail, I would still appreciate review on the overall approach 2. this only works with basic patterns (no wildcards for example), and fails if there is any problems getting the visibility of the fields (i am not sure what the failure that can happen in resolve_visibility_speculative, but we check the length of our fields in both cases against each other, so if anything goes wrong, we fall back to the worse error. This could be extended to more patterns 3. this does not yet deal with #75906, but I believe it will be similar 4. let me know if you want more tests 5. doesn't yet at the suggestion that `@yoshuawuyts` suggested at the end of their issue, but that could be added relatively easily (i believe)
2020-09-11Give better diagnostic when using a private tuple struct constructorGus Wynn-10/+45
2020-09-10Attach `TokenStream` to `ast::Path`Aaron Hill-2/+4
2020-09-09remove redundant clonesMatthias Krüger-1/+1
(clippy::redundant_clone)
2020-08-30Suggest `if let x = y` when encountering `if x = y`Esteban Küber-0/+13
Detect potential cases where `if let` was meant but `let` was left out. Fix #44990.
2020-08-30mv compiler to compiler/mark-0/+4458