aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
Commit message (Collapse)AuthorAgeFilesLines
* 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 <aramisnoah@gmail.com>
| * 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 <edwin0cheng@gmail.com>
| * 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 <edwin0cheng@gmail.com>
| * 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 <edwin0cheng@gmail.com>
| * | 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 <lukastw97@gmail.com>
| * Add ConstParams to the ide layerLukas Wirth2021-01-011-1/+0
| |
| * Add ConstParams to the HIRLukas Wirth2021-01-014-5/+35
| |
* | Allow spurious warning from rust-lang/rust#80501Laurențiu Nicola2020-12-301-0/+2
|/
* Merge #7021bors[bot]2020-12-241-4/+4
|\ | | | | | | | | | | | | | | 7021: Track labels in the HIR r=matklad a=Veykril Groundwork for #6966 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Track labels in the HIRLukas Wirth2020-12-241-4/+4
| |
* | Merge #7020bors[bot]2020-12-234-6/+45
|\ \ | | | | | | | | | | | | | | | | | | | | | 7020: Implement const pat and expr inference r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * | Implement const block inferenceLukas Wirth2020-12-232-5/+10
| | |
| * | Implement const pat inferenceLukas Wirth2020-12-232-1/+35
| |/
* / Bump chalkLaurențiu Nicola2020-12-231-2/+9
|/
* Higher-ranked trait bounds for where clausesLukas Wirth2020-12-172-12/+15
|
* decl_check: don't pass `db` around so oftenJonas Schievink2020-12-172-58/+60
|
* Make macro def krate mandatoryJonas Schievink2020-12-151-0/+6
| | | | Refactors builtin derive support to go through proper name resolution
* Move to upstream `macro_rules!` modelJonas Schievink2020-12-151-1/+0
|
* Add regression testEdwin Cheng2020-12-151-0/+24
|
* Add test for #6852Florian Diebold2020-12-131-0/+37
|
* Merge #6852bors[bot]2020-12-132-2/+13
|\ | | | | | | | | | | | | | | | | | | 6852: Ignore lifetime params in substitutions r=matklad a=Veykril [`hir_ty::utils::Generics`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/utils.rs#L153) currently only assumes type parameters but not lifetime parameters and therefor creates incorrect index and length calculations, this PR just makes the use sites ignore LifetimeGenerics for now. This fixes the panic at least locally for me for `analysis-stats`. Funnily enough this panic prevented me from using reference search for the `args` field to fix this problem. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Ignore lifetime params in substitutionsLukas Wirth2020-12-132-2/+13
| |
* | Merge #6845bors[bot]2020-12-121-1/+9
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | 6845: Don't HirDisplay unknown types when displaying for source r=Veykril a=Veykril Was wondering why the add missing impl assist didn't do anything here: ![Code_JCA1Qo0V9P](https://user-images.githubusercontent.com/3757771/101990300-7af44a80-3ca6-11eb-8431-e5eb4de4e78c.png) Turns out me forgetting to set the Index::Idx type in the trait causes RA to panic due to it trying to to create an unparsable type in the `make` module. Now we get this instead which imo is definitely better to have. ![Code_MUFPJUCULY](https://user-images.githubusercontent.com/3757771/101990347-c9094e00-3ca6-11eb-9c6a-146bddf64b7c.png) Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Don't HirDisplay unknown types when displaying for sourceLukas Wirth2020-12-121-1/+9
| |
* | Merge #6818bors[bot]2020-12-125-39/+77
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 6818: Add Lifetimes to the HIR r=matklad a=Veykril This doesn't handle resolve yet as I don't know yet how that will be used. I'll get to that once I start moving the lifetime reference PR to the hir. This also adds a new `hir` name type for lifetimes and labels, `hir::LifetimeName`. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * | Add Lifetimes to the HIRLukas Wirth2020-12-115-39/+77
| |/
* | Added remove this semicolon testivan7702020-12-121-0/+10
| |
* | Infer labeled blocksLukas Wirth2020-12-112-4/+74
|/
* Merge #6769bors[bot]2020-12-102-3/+60
|\ | | | | | | | | | | | | | | | | | | 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 <leshenko.ivan770@gmail.com>
| * Cast to ExprStmt, style fixesivan7702020-12-101-6/+5
| |
| * Apply rustfmt changesivan7702020-12-091-9/+8
| |
| * Apply suggestions from code reviewivan7702020-12-091-17/+20
| | | | | | Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
| * Format codeivan7702020-12-081-4/+13
| |