aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge #7602bors[bot]2021-02-082-11/+38
|\ | | | | | | | | | | | | | | 7602: Check for dyn impls in method resolution r=flodiebold a=Veykril Fixes #6777 Co-authored-by: Lukas Wirth <[email protected]>
| * Check for dyn impls in method resolutionLukas Wirth2021-02-082-11/+38
| |
* | Update crateskjeremy2021-02-081-2/+3
|/ | | | Pulls in https://github.com/rust-lang/chalk/pull/682
* Merge #7574bors[bot]2021-02-051-1/+1
|\ | | | | | | | | | | | | | | | | | | 7574: Remove various redundant clones r=kjeremy a=yoshuawuyts I noticed when running clippy through RA that there are a few instances where `clone` is called where it's not actually needed. I figured a small patch to remove these might be welcome here. Thanks! Co-authored-by: Yoshua Wuyts <[email protected]>
| * Remove redundant clonesYoshua Wuyts2021-02-051-1/+1
| |
| |
| \
*-. \ Merge #7570 #7571bors[bot]2021-02-052-161/+151
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-052-161/+151
| |/
* / Remove unnecessary allocs in case_convLukas Wirth2021-02-051-18/+16
|/
* Make `ModPath`'s representation privateJonas Schievink2021-02-041-1/+1
|
* Use block_def_map in body loweringJonas Schievink2021-02-031-1/+1
|
* Bump chalkLaurențiu Nicola2021-02-021-2/+2
|
* Revert "Use block_def_map in body lowering"Jonas Schievink2021-02-021-1/+1
|
* Use block_def_map in body loweringJonas Schievink2021-02-011-1/+1
|
* Classify function calls as functions when shadowed by typesLukas Wirth2021-01-282-14/+17
|
* Create all `ModuleId`s through a `DefMap` methodJonas Schievink2021-01-251-1/+1
| | | | | `ModuleId` needs to be able to represent blocks, and only the associated `DefMap` will know how to construct that `ModuleId`
* Update tests to register the required standard library typesPhil Ellison2021-01-232-16/+48
|
* Fix test namesPhil Ellison2021-01-231-4/+4
|
* Identify methods using functions ids rather than string namesPhil Ellison2021-01-231-7/+27
|
* Implement fix, add testsPhil Ellison2021-01-232-28/+55
|
* Add diagnostic for filter_map followed by nextPhil Ellison2021-01-232-13/+105
|
* Make `ModuleId`'s `krate` field privateJonas Schievink2021-01-227-15/+17
|
* Obtain `ModuleId`'s `DefMap` through a methodJonas Schievink2021-01-221-3/+3
|
* Merge #7386bors[bot]2021-01-222-1/+28
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7386: Handle box with allocator r=flodiebold a=tweksteen In 1.49.0, the definition of Box was modified to support an optional Allocator[1]. Adapt the parsing of the `box` keyword to supply the expected number of parameters to the constructor. [1] https://github.com/rust-lang/rust/commit/f288cd2e179f600fa00c2a407206a12f6c5a91e0 Fixes: #6956 Co-authored-by: Thiébaud Weksteen <[email protected]>
| * Handle box with allocatorThiébaud Weksteen2021-01-222-1/+28
| | | | | | | | | | | | | | | | In 1.49.0, the definition of Box was modified to support an optional Allocator[1]. Adapt the parsing of the `box` keyword to supply the expected number of parameters to the constructor. [1] https://github.com/rust-lang/rust/commit/f288cd2e179f600fa00c2a407206a12f6c5a91e0
* | Make public DefMap fields privateJonas Schievink2021-01-203-5/+5
| |
* | Rename `CrateDefMap` to `DefMap`Jonas Schievink2021-01-181-3/+3
| |
* | Merge #7291bors[bot]2021-01-181-2/+2
|\ \ | |/ |/| | | | | | | | | | | 7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril That should be the remaining special casing for `self` 🎉 Co-authored-by: Lukas Wirth <[email protected]>
| * Wrap remaining self/super/crate in Name{Ref}Lukas Wirth2021-01-151-2/+2
| |
* | Merge #7276bors[bot]2021-01-173-3/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | 7276: Remove map module from la-arena public API r=lnicola a=arzg It’s unlikely that more items will be added to the module, so it’s simpler for users if `ArenaMap` is re-exported and the module made private. This doesn’t compile for the same reason that #7275 doesn’t: > This pull request doesn’t compile because dependencies on la-arena go through crates.io, so existing dependencies on the crate are referencing an old version. As such, this PR will only compile once a new la-arena version has been published. Co-authored-by: Aramis Razzaghipour <[email protected]>
| * Remove map module from la-arena public APIAramis Razzaghipour2021-01-153-3/+3
| | | | | | | | | | | | It’s unlikely that more items will be added to the module, so it’s simpler for users if `ArenaMap` is re-exported and the module made private.
* | Add support for yiled keywordDaiki Ihara2021-01-151-0/+7
|/
* prepare to publish el libro de arenaAleksey Kladov2021-01-144-4/+4
|
* Render Fn* trait objects and impl types as rust doesLukas Wirth2021-01-133-29/+94
|
* Fixed typos in local bindingsVincent Esche2021-01-092-5/+5
|
* Fixed typos in code commentsVincent Esche2021-01-091-2/+2
|
* Merge #7145bors[bot]2021-01-081-0/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7145: Proper handling $crate Take 2 [DO NOT MERGE] r=edwin0cheng a=edwin0cheng Similar to previous PR (#7133) , but improved the following things : 1. Instead of storing the whole `ExpansionInfo`, we store a similar but stripped version `HygieneInfo`. 2. Instread of storing the `SyntaxNode` (because every token we are interested are IDENT), we store the `TextRange` only. 3. Because of 2, we now can put it in Salsa. 4. And most important improvement: Instead of computing the whole frames every single time, we compute it recursively through salsa: (Such that in the best scenario, we only need to compute the first layer of frame) ```rust let def_site = db.hygiene_frame(info.def.file_id); let call_site = db.hygiene_frame(info.arg.file_id); HygieneFrame { expansion: Some(info), local_inner, krate, call_site, def_site } ``` The overall speed compared to previous PR is much faster (65s vs 45s) : ``` [WITH old PR] Database loaded 644.86ms, 284mi Crates in this dir: 36 Total modules found: 576 Total declarations: 11153 Total functions: 8715 Item Collection: 15.78s, 91562mi Total expressions: 240721 Expressions of unknown type: 2635 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 865 Inference: 49.84s, 250747mi Total: 65.62s, 342310mi rust-analyzer -q analysis-stats . 66.72s user 0.57s system 99% cpu 1:07.40 total [WITH this PR] Database loaded 665.83ms, 284mi Crates in this dir: 36 Total modules found: 577 Total declarations: 11188 Total functions: 8743 Item Collection: 15.28s, 84919mi Total expressions: 241229 Expressions of unknown type: 2637 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 868 Inference: 30.15s, 135293mi Total: 45.43s, 220213mi rust-analyzer -q analysis-stats . 46.26s user 0.74s system 99% cpu 47.294 total ``` *HOWEVER*, it is still a perf regression (35s vs 45s): ``` [WITHOUT this PR] Database loaded 657.42ms, 284mi Crates in this dir: 36 Total modules found: 577 Total declarations: 11177 Total functions: 8735 Item Collection: 12.87s, 72407mi Total expressions: 239380 Expressions of unknown type: 2643 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 868 Inference: 22.88s, 97889mi Total: 35.74s, 170297mi rust-analyzer -q analysis-stats . 36.71s user 0.63s system 99% cpu 37.498 total ``` Co-authored-by: Edwin Cheng <[email protected]>
| * Proper handling $crate Take 2Edwin Cheng2021-01-071-0/+31
| |
* | cargo fmtPhil Ellison2021-01-071-6/+9
| |
* | Add fix to wrap return expression in SomePhil Ellison2021-01-072-12/+25
| |
* | Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-071-1/+1
| |
* | Rename expr -> tail_exprAleksey Kladov2021-01-051-1/+1
| |
* | Impl hovering for TypeParamsLukas Wirth2021-01-041-1/+1
|/
* Revert "Proper handling $crate and local_inner_macros"Jonas Schievink2021-01-031-31/+0
|
* Fixed nested eager macro bugEdwin Cheng2021-01-031-0/+46
|
* Merge #7133bors[bot]2021-01-021-0/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 7133: Proper handling $crate and local_inner_macros r=jonas-schievink a=edwin0cheng This PR introduces `HygineFrames` to store the macro definition/call site hierarchy in hyginee and when resolving `local_inner_macros` and `$crate`, we use the token to look up the corresponding frame and return the correct value. See also: https://rustc-dev-guide.rust-lang.org/macro-expansion.html#hygiene-and-hierarchies fixe #6890 and #6788 r? @jonas-schievink Co-authored-by: Edwin Cheng <[email protected]>
| * Introduce HygieneFrames for proper token hygineeEdwin Cheng2021-01-021-0/+31
| |
* | Merge #7134bors[bot]2021-01-021-0/+18
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7134: Fix infer error of macro invocation in array expr r=edwin0cheng a=edwin0cheng Fixed following infer error: ```rust macro_rules! bar { () => {0u32} } fn test() { let a = [bar!()]; // a : [unknown] } ``` bors r+ Co-authored-by: Edwin Cheng <[email protected]>
| * | Fix infer error of macro invocation in array exprEdwin Cheng2021-01-021-0/+18
| |/
* | Don't emit arg count diagnostics for method calls with unknown receiverFlorian Diebold2021-01-012-1/+29
| | | | | | | | Fixes #7098.
* | Merge #7080bors[bot]2021-01-014-5/+34
|\ \ | |/ |/| | | | | | | | | | | 7080: Implement ConstParams for HIR r=Veykril a=Veykril r? @flodiebold Co-authored-by: Lukas Wirth <[email protected]>