about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2020-10-14Rollup merge of #77825 - ethanboxx:min_const_generics_diagnostic, r=lcnrYuki Okushi-15/+8
`min_const_generics` diagnostics improvements As disscussed in [zulip/project-const-generics/non-trivial anonymous constant](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/non-trivial.20anonymous.20constants). This is my first PR on the compiler. @lcnr is mentoring me on this PR. Related to #60551.
2020-10-12A little rewordingEthan Brierley-1/+1
Co-authored-by: varkor <github@varkor.com>
2020-10-12Remove a little jargon from errorEthan Brierley-1/+1
Co-authored-by: varkor <github@varkor.com>
2020-10-12Make error help clearerEthan Brierley-1/+1
Co-authored-by: varkor <github@varkor.com>
2020-10-11`min_const_generics` diagnostics improvementsEthan Brierley-15/+8
2 3
2020-10-09address review commentsEsteban Küber-8/+16
2020-10-09Add docstringEsteban Küber-0/+2
2020-10-09Given `<T as Trait>::A: Ty` suggest `T: Trait<A = Ty>`Esteban Küber-0/+129
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/+17
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-07fix def collector for impl traitBastian Kauschke-4/+4
2020-10-05Rollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebankDylan DPC-2/+2
Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics` Closes https://github.com/rust-lang/rust/issues/61410. Adds `min_const_generics` tests for: - https://github.com/rust-lang/rust/issues/73727 - https://github.com/rust-lang/rust/issues/72293 - https://github.com/rust-lang/rust/issues/67375 - https://github.com/rust-lang/rust/issues/75153 - https://github.com/rust-lang/rust/issues/71922 - https://github.com/rust-lang/rust/issues/69913 - https://github.com/rust-lang/rust/issues/67945 - https://github.com/rust-lang/rust/issues/69239 Adds `const_generics` tests for: - https://github.com/rust-lang/rust/issues/67375 - https://github.com/rust-lang/rust/issues/75153 - https://github.com/rust-lang/rust/issues/71922 - https://github.com/rust-lang/rust/issues/69913 - https://github.com/rust-lang/rust/issues/67945 - https://github.com/rust-lang/rust/issues/69239 (I only added separate `min_const_generics` and `const_generics` tests if they were handled differently by the two features.) We need to figure out how to deduplicate when `const_generics` is stabilised, but we can discuss that later. For now, we should be checking neither feature breaks, so require regression tests for both. I've given them identical names when I've added both, which should make it easier to spot them later. r? @lcnr
2020-10-03Replace "non trivial" with "non-trivial"varkor-2/+2
2020-10-03Rollup merge of #77421 - petrochenkov:globtravel, r=nagisaJonas Schievink-11/+2
Revert "resolve: Avoid "self-confirming" import resolutions in one more case" And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead. Closes https://github.com/rust-lang/rust/issues/74556.
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-10-02Revert "resolve: Avoid "self-confirming" import resolutions in one more case"Vadim Petrochenkov-11/+2
2020-09-30Improve wording for external crate resolution errorCamelid-1/+1
I think it reads better this way.
2020-09-30Don't suggest macros that out of scopeTemirkhan Myrzamadi-2/+9
2020-09-30Suggest imports of unresolved macrosTemirkhan Myrzamadi-0/+4
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-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-21Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPCecstatic-morse-5/+2
use if let instead of single match arm expressions use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
2020-09-20Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnrRalf Jung-2/+2
use matches!() macro for simple if let conditions
2020-09-20use if let instead of single match arm expressions to compact code and ↵Matthias Krüger-5/+2
reduce nesting (clippy::single_match)
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-2/+2
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-16Rollup merge of #76756 - matthiaskrgr:cl123ppy, r=Dylan-DPCTyler Mandry-1/+1
fix a couple of stylistic clippy warnings 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-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-15Remove redundant `&format!`.Hameer Abbasi-3/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-09-15This commit introduces the following changes:Hameer Abbasi-9/+23
* Change error message for type param in a const expression when using min_const_generics * Change ParamInNonTrivialAnonConst to contain an extra bool used for distinguishing whether the passed-in symbol is a type or a value.
2020-09-13review, improve note spanBastian Kauschke-18/+16
2020-09-13allow concrete self types in constsBastian Kauschke-12/+26
2020-09-11Auto merge of #76499 - guswynn:priv_des, r=petrochenkovbors-29/+80
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-29/+80
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-2/+2
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Path`Aaron Hill-4/+8
2020-09-09Rollup merge of #76522 - matthiaskrgr:redundant_clone, r=jonas-schievinkTyler Mandry-1/+1
remove redundant clones (clippy::redundant_clone)
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-1/+8
Improve unresolved use error message "use of undeclared type or module `foo`" doesn't mention that it could be a crate. This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate. I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
2020-09-09remove redundant clonesMatthias Krüger-1/+1
(clippy::redundant_clone)
2020-09-01Rollup merge of #76143 - jyn514:duplicate-builtin-macros, r=petrochenkovTyler Mandry-5/+25
Give a better error message for duplicate built-in macros Minor follow-up to https://github.com/rust-lang/rust/pull/75176 giving a better error message for duplicate builtin macros. This would have made it a little easier to debug. r? @petrochenkov
2020-09-01Clarify message about unresolved useKornel-1/+8
2020-09-01Give a better error message for duplicate built-in macrosJoshua Nelson-5/+25
Previously, this would say no such macro existed, but this was misleading, since the macro _did_ exist, it was just already seen. - Say where the macro was previously defined - Add long-form error message
2020-08-30Suggest `if let x = y` when encountering `if x = y`Esteban Küber-1/+19
Detect potential cases where `if let` was meant but `let` was left out. Fix #44990.
2020-08-30mv compiler to compiler/mark-0/+16500