aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge #4497bors[bot]2020-05-181-0/+31
|\ | | | | | | | | | | | | | | | | | | | | | | 4497: Create LowerCtx on the fly r=matklad a=edwin0cheng Previously we create `LowerCtx` at the beginning of lowering, however, the hygiene content is in fact changing between macro expression expanding. This PR change it to create the `LowerCtx` on the fly to fix above bug. However, #4465 is not fixed by this PR, the goto-def is still not work yet. It only fixed the infer part. Co-authored-by: Edwin Cheng <[email protected]>
| * Create LowerCtx on the flyEdwin Cheng2020-05-171-0/+31
| |
* | Add more tests for Fn traitsHrvoje Ban2020-05-181-0/+132
| |
* | Allow calling dyn trait super trait methods without the super trait in scopeFlorian Diebold2020-05-163-15/+40
|/ | | | | This also removes some vestiges of the old impl trait support which I think aren't currently in use.
* Chalk upgradeFlorian Diebold2020-05-162-22/+41
|
* Handle `Self` in values and patternsFlorian Diebold2020-05-154-14/+183
| | | | | | | | | I.e. - `Self(x)` or `Self` in tuple/unit struct impls - `Self::Variant(x)` or `Self::Variant` in enum impls - the same in patterns Fixes #4454.
* Adds a param_idx helperFedor Sakharov2020-05-141-0/+5
|
*-. Merge #4394 #4414bors[bot]2020-05-101-2/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4394: Simplify r=matklad a=Veetaha 4414: Highlighting improvements r=matklad a=matthewjasper - `static mut`s are highlighted as `mutable`. - The name of the macro declared by `macro_rules!` is now highlighted. Co-authored-by: veetaha <[email protected]> Co-authored-by: Matthew Jasper <[email protected]>
| | * Highlight mutable statics as mutableMatthew Jasper2020-05-101-2/+6
| | |
* | | Omit default types in HirDisplay SourceCode modeTimo Freiberg2020-05-102-27/+63
| | |
* | | infer: Make expected rhs type for plain assign the lhs typeEmil Lauridsen2020-05-102-1/+31
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where the following code sample would fail to infer the type contained in the option: ```rust fn main() { let mut end = None; // TODO: Fix inference for this in RA loop { end = Some(true); } } ```
* | Merge #4175bors[bot]2020-05-093-38/+178
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | 4175: Introduce HirDisplay method for rendering source code & use it in add_function assist r=flodiebold a=TimoFreiberg Next feature for #3639. So far the only change in the new `HirDisplay` method is that paths are qualified, but more changes will be necessary (omitting the function name from function types, returning an error instead of printing `"{unknown}"`, probably more). Is that approach okay? Co-authored-by: Timo Freiberg <[email protected]>
| * New HirDisplay method for displaying sourcecodeTimo Freiberg2020-05-083-38/+178
| |
* | Handle coercing function types to function pointers in matchFlorian Diebold2020-05-084-11/+72
| | | | | | | | | | | | | | | | | | | | | | | | E.g. in ```rust match x { 1 => function1, 2 => function2, } ``` we need to try coercing both to pointers. Turns out this is a special case in rustc as well (see the link in the comment).
* | Add diagnostic for break outside of loopFlorian Diebold2020-05-084-1/+62
| |
* | Use matches!Florian Diebold2020-05-081-4/+1
| |
* | Handle break somewhat betterFlorian Diebold2020-05-083-3/+105
| | | | | | | | | | Still no break-with-value or labels, but at least we know that `loop { break; }` doesn't diverge.
* | Implement better handling of divergenceFlorian Diebold2020-05-087-23/+200
|/ | | | | | | | Divergence here means that for some reason, the end of a block will not be reached. We tried to model this just using the never type, but that doesn't work fully (e.g. in `let x = { loop {}; "foo" };` x should still have type `&str`); so this introduces a `diverges` flag that the type checker keeps track of, like rustc does.
* Fix type of byte literalsFlorian Diebold2020-05-083-10/+11
| | | | They're `&[u8; N]`, not `&[u8]` (see #4374).
* Fix usefulness check for never typeMikail Bagishov2020-05-061-6/+23
|
* Rename ImplItem to AssocItemEdwin Cheng2020-05-051-2/+2
|
* Merge #4305bors[bot]2020-05-051-0/+29
|\ | | | | | | | | | | | | | | 4305: Favor types for record type struct in name resolution r=matklad a=edwin0cheng Fixed #4235 Co-authored-by: Edwin Cheng <[email protected]>
| * Add test for issueEdwin Cheng2020-05-041-0/+29
| |
* | Merge #4283bors[bot]2020-05-041-18/+20
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4283: Support macro for trait items r=matklad a=edwin0cheng Fixed #4039 r? @flodiebold Co-authored-by: Edwin Cheng <[email protected]> Co-authored-by: Edwin Cheng <[email protected]>
| * | Remove whitespacesEdwin Cheng2020-05-031-1/+1
| | |
| * | Support macro for trait itemsEdwin Cheng2020-05-031-19/+21
| |/
* / add support of cfg attributes on enum variants #4279Benjamin Coenen2020-05-031-0/+27
|/ | | | Signed-off-by: Benjamin Coenen <[email protected]>
* Merge #4234bors[bot]2020-05-021-0/+26
|\ | | | | | | | | | | | | | | | | | | | | | | 4234: Support local_inner_macros r=jonas-schievink a=edwin0cheng This PR implements `#[macro_export(local_inner_macros)]` support. Note that the rustc implementation is quite [hacky][1] too. :) [1]: https://github.com/rust-lang/rust/blob/614f273e9388ddd7804d5cbc80b8865068a3744e/src/librustc_resolve/macros.rs#L456 Co-authored-by: Edwin Cheng <[email protected]>
| * Support local_inner_macrosEdwin Cheng2020-05-011-0/+26
| |
* | Add smoke test for decorated blocksAleksey Kladov2020-05-021-0/+32
| |
* | Revert "Merge #4233"Aleksey Kladov2020-05-021-0/+5
| | | | | | | | | | This reverts commit a5f2b16366f027ad60c58266a66eb7fbdcbda9f9, reversing changes made to c96b2180c1c4206a0a98c280b4d30897eb116336.
| |
| \
*-. \ Merge #4220 #4240bors[bot]2020-05-012-1/+41
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4220: Introduce LowerCtx r=matklad a=edwin0cheng This PR introduces `LowerCtx` for path lowering. After this PR, there are only 2 places remains for using deprecated `Path::from_ast`, which is related to `AstTransform` I am not familiar. I would like to change these in another PR by others ;) related disscusiion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Path.3A.3Afrom_src And also fixed part of https://github.com/rust-analyzer/rust-analyzer/issues/4176#issuecomment-620672930 4240: Bump deps r=matklad a=lnicola Co-authored-by: Edwin Cheng <[email protected]> Co-authored-by: Laurențiu Nicola <[email protected]>
| | * Bump depsLaurențiu Nicola2020-05-011-1/+1
| |/ |/|
| * Add testEdwin Cheng2020-05-011-0/+40
|/
* Kill more zombiesAleksey Kladov2020-04-301-5/+0
|
* Rename to associated_type_shorthand_candidatesJonas Schievink2020-04-292-27/+28
|
* Complete assoc. items on type parametersJonas Schievink2020-04-292-57/+90
|
* Merge #4173bors[bot]2020-04-271-4/+29
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4173: Use core instead of std for builtin derive macros r=edwin0cheng a=edwin0cheng Fixed #4087. We can't use `$crate` here right now because : 1. We have to able to detect `macro` 2.0 in collecting phase for finding `rustc_builtin_macro` attrs. 2. And we have to make hygiene works for builtin derive macro. r= @flodiebold Co-authored-by: Edwin Cheng <[email protected]>
| * Use empty-deps tricks to detect it is coreEdwin Cheng2020-04-271-6/+5
| |
| * Add testEdwin Cheng2020-04-271-0/+26
| |
| * Use core instead of std for builtin derive macrosEdwin Cheng2020-04-271-4/+4
| |
* | For associated type shorthand (T::Item), use the substs from the where clauseFlorian Diebold2020-04-264-13/+119
|/ | | | | So e.g. if we have `fn foo<T: SomeTrait<u32>>() -> T::Item`, we want to lower that to `<T as SomeTrait<u32>>::Item` and not `<T as SomeTrait<_>>::Item`.
* Merge #4145bors[bot]2020-04-251-3/+2
|\ | | | | | | | | | | | | | | | | | | | | 4145: Remove dead code r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Fix panic in NoSuchField diagnosticAleksey Kladov2020-04-251-3/+2
| |
* | add support for cfg feature attributes on expression #4063Benjamin Coenen2020-04-251-0/+32
|/ | | | Signed-off-by: Benjamin Coenen <[email protected]>
* Rename StructField -> FieldAleksey Kladov2020-04-256-27/+25
|
* Convert tests to text-sizeAleksey Kladov2020-04-257-2192/+2192
|
* Convert code to text-sizeAleksey Kladov2020-04-251-2/+2
|
* Merge #4106bors[bot]2020-04-232-1/+42
|\ | | | | | | | | | | | | | | | | | | 4106: Fix wrong substitution code r=matklad a=flodiebold We need to shift in when we're substituting inside a binder. This should fix #4053 (it doesn't fix the occasional overflow that also occurs on the Diesel codebase though). Co-authored-by: Florian Diebold <[email protected]>
| * Fix wrong substitution codeFlorian Diebold2020-04-232-1/+42
| | | | | | | | | | | | | | We need to shift in when we're substituting inside a binder. This should fix #4053 (it doesn't fix the occasional overflow that also occurs on the Diesel codebase though).