aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics
Commit message (Collapse)AuthorAgeFilesLines
* internal: move diagnostics to hirAleksey Kladov2021-05-253-7/+6
| | | | | | | | | | | | | | | | | | | | | | | The idea here is to eventually get rid of `dyn Diagnostic` and `DiagnosticSink` infrastructure altogether, and just have a `enum hir::Diagnostic` instead. The problem with `dyn Diagnostic` is that it is defined in the lowest level of the stack (hir_expand), but is used by the highest level (ide). As a first step, we free hir_expand and hir_def from `dyn Diagnostic` and kick the can up to `hir_ty`, as an intermediate state. The plan is then to move DiagnosticSink similarly to the hir crate, and, as final third step, remove its usage from the ide. One currently unsolved problem is testing. You can notice that the test which checks precise diagnostic ranges, unresolved_import_in_use_tree, was moved to the ide layer. Logically, only IDE should have the infra to render a specific range. At the same time, the range is determined with the data produced in hir_def and hir crates, so this layering is rather unfortunate. Working on hir_def shouldn't require compiling `ide` for testing.
* Record method call substs and use them in call infoFlorian Diebold2021-05-232-9/+5
|
* Add last remaining module docstringFlorian Diebold2021-05-221-1/+3
|
* Check patterns for type match recursively.Dawer2021-05-192-2/+30
|
* internal: Record mismatches of pattern types.Dawer2021-05-191-1/+1
|
* Fix false positive "Missing match arm".Dawer2021-05-141-0/+1
|
* Fix inference with conditionally compiled tailsDaniel McNab2021-05-031-1/+1
| | | | Fixes #8378
* decl_check: follow test style guideJonas Schievink2021-04-131-60/+59
|
* address review feedbackJade2021-04-131-21/+35
|
* decl_check: consider outer scopes' allowsJade2021-04-081-10/+122
| | | | | | | | | Fix #8417. Also makes it less noisy about no_mangle annotated stuff the user can do nothing about. Note: this still is broken with bitfield! macros. A repro in an ignore test is included here. I believe this bug is elsewhere, and I don't think I can work around it here.
* infer: remove `record_field_resolutions` fieldJonas Schievink2021-04-061-5/+4
| | | | | It stores no useful data, since we can derive all fields from `variant_resolutions`
* Move Ty accessors to TyExtLukas Wirth2021-04-062-2/+4
|
* Add Lifetime to TyKind::RefLukas Wirth2021-04-061-1/+1
|
* Hide Binders internals moreFlorian Diebold2021-04-051-1/+2
|
* Add TyBuilder::unit() and TyExt::is_unit()Florian Diebold2021-04-041-2/+2
|
* Access a body's block def maps via a methodJonas Schievink2021-04-041-2/+1
|
* Use bitflags to compress function propertiesJonas Schievink2021-04-032-4/+4
| | | | Very minor savings, only 1 MB or so
* Rename Ty::interned to Ty::kindFlorian Diebold2021-04-033-3/+3
| | | | ... since that's the actual method on Chalk side that matches the signature.
* Introduce `GenericArg` like in ChalkFlorian Diebold2021-04-032-2/+7
| | | | | | | Plus some more adaptations to Substitution. Lots of `assert_ty_ref` that we should revisit when introducing lifetime/const parameters.
* Fix expansion of OR-patterns in match checkJesse Bakker2021-03-301-25/+15
|
* Fix infinite recursion when computing diagnostics for inner itemsJonas Schievink2021-03-181-1/+14
|
* Improve testJonas Schievink2021-03-171-0/+21
|
* Add test for `#[cfg]` on function paramsJonas Schievink2021-03-171-0/+13
|
* Handle `#[cfg]` on call argumentsJonas Schievink2021-03-171-0/+23
|
* avoid converting types into themselves via .into() (clippy::useless-conversion)Matthias Krüger2021-03-173-19/+19
| | | | example: let x: String = String::from("hello world").into();
* Introduce FunctionQualifier for hir::FunctionDataoxalica2021-03-152-4/+4
|
* Use chalk_ir::FnDefIdFlorian Diebold2021-03-131-1/+1
|
* Separate `Ty` and `TyKind` like in ChalkFlorian Diebold2021-03-133-17/+16
| | | | | Currently `Ty` just wraps `TyKind`, but this allows us to change most places to already use `intern` / `interned`.
* Use `body.block_scopes` to validate inner itemsJonas Schievink2021-03-091-3/+8
|
* Use upstream cov-markLaurențiu Nicola2021-03-081-7/+4
|
* Use chalk_ir::AdtIdLukas Wirth2021-03-042-9/+11
|
* Introduce Ty::AliasLukas Wirth2021-03-011-1/+1
|
* Inline TypeCtor into TyLukas Wirth2021-02-283-16/+9
|
* Update fixed testsJonas Schievink2021-02-101-15/+14
|
*-. Merge #7570 #7571bors[bot]2021-02-051-160/+119
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7570: Add doc gen to the `generate_enum_match_method` assist r=yoshuawuyts a=yoshuawuyts Implements a small extension to https://github.com/rust-analyzer/rust-analyzer/pull/7562, generating default comments. I wasn't sure if this would fit the goals of Rust-Analyzer, so I chose to split it into a separate PR. This is especially useful when writing code in a codebase which uses `#![warn(missing_docs)]` lint, as many production-grade libraries do. The comments we're generating here are similar to the ones found on [`Option::is_some`](https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some) and [`Result::is_err`](https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err). I briefly considered only generating these for `pub` types, but they seem small and unobtrusive enough that they're probably useful in the general case. Thanks! ## Example __input__ ```rust pub(crate) enum Variant { Undefined, Minor, // cursor here Major, } ``` __output__ ```rust pub(crate) enum Variant { Undefined, Minor, Major, } impl Variant { /// Returns `true` if the variant is [`Minor`]. pub(crate) fn is_minor(&self) -> bool { matches!(self, Self::Minor) } } ``` ## Future Directions This opens up the path to adding an assist for generating these comments on existing `is_` methods. This would make it both easy to document new code, and update existing code with documentation. 7571: Cleanup decl_check r=Veykril a=Veykril bors r+ Co-authored-by: Yoshua Wuyts <[email protected]> Co-authored-by: Lukas Wirth <[email protected]>
| | * Cleanup decl_checkLukas Wirth2021-02-051-160/+119
| |/
* / Remove unnecessary allocs in case_convLukas Wirth2021-02-051-18/+16
|/
* Classify function calls as functions when shadowed by typesLukas Wirth2021-01-281-9/+3
|
* Update tests to register the required standard library typesPhil Ellison2021-01-231-6/+10
|
* Identify methods using functions ids rather than string namesPhil Ellison2021-01-231-7/+27
|
* Implement fix, add testsPhil Ellison2021-01-231-20/+7
|
* Add diagnostic for filter_map followed by nextPhil Ellison2021-01-231-9/+61
|
* prepare to publish el libro de arenaAleksey Kladov2021-01-141-1/+1
|
* Fixed typos in local bindingsVincent Esche2021-01-091-2/+2
|
* Fixed typos in code commentsVincent Esche2021-01-091-2/+2
|
* cargo fmtPhil Ellison2021-01-071-6/+9
|
* Add fix to wrap return expression in SomePhil Ellison2021-01-071-6/+16
|
* Don't emit arg count diagnostics for method calls with unknown receiverFlorian Diebold2021-01-011-1/+25
| | | | Fixes #7098.
* decl_check: don't pass `db` around so oftenJonas Schievink2020-12-171-54/+49
|
* Merge #6769bors[bot]2020-12-101-3/+36
|\ | | | | | | | | | | | | | | | | | | 6769: Add native "remove this semicolon" diagnostics r=matklad a=ivan770 Closes #6739 ![demo2](https://user-images.githubusercontent.com/14003886/101530533-b76c3180-399a-11eb-9d18-5c8457721655.gif) Co-authored-by: ivan770 <[email protected]>