about summary refs log tree commit diff
path: root/crates
AgeCommit message (Collapse)AuthorLines
2022-02-26Split up highlighting tests a bit moreLukas Wirth-139/+91
2022-02-26Re-order and cleanup highlighting testsLukas Wirth-208/+199
2022-02-26fix: Don't emit unresolvedReference highlight tags in unlinked filesLukas Wirth-4/+12
2022-02-25Merge #11538bors[bot]-2/+12
11538: feat: Make private editable completions configurable, disable by default r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10253 Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9885 This does disable these completions by default, as it seems that people find this behaviour surprising(due to other IDEs usually not doing this). Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-25feat: Make private editable completions configurable, disable by defaultLukas Wirth-2/+12
2022-02-25Implement the new built-in `unreachable!` macroJonas Schievink-0/+21
2022-02-25Resolve `$crate` in `HirDisplay` of `Path`Jonas Schievink-1/+42
2022-02-25Merge #11550bors[bot]-663/+775
11550: Refactor autoderef/method resolution r=flodiebold a=flodiebold - don't return the receiver type from method resolution; instead just return the autorefs/autoderefs that happened and repeat them. This ensures all the effects like trait obligations and whatever we learned about type variables from derefing them are actually applied. Also, it allows us to get rid of `decanonicalize_ty`, which was just wrong in principle. - Autoderef itself now directly works with an inference table. Sadly this has the effect of making it harder to use as an iterator, often requiring manual `while let` loops. (rustc works around this by using inner mutability in the inference context, so that things like unifying types don't require a unique reference.) - We now record the adjustments (autoref/deref) for method receivers and index expressions, which we didn't before. - Removed the redundant crate parameter from method resolution, since the trait_env contains the crate as well. - in the HIR API, the methods now take a scope to determine the trait env. `Type` carries a trait env, but I think that's probably a bad decision because it's easy to create it with the wrong env, e.g. by using `Adt::ty`. This mostly didn't matter so far because `iterate_method_candidates` took a crate parameter and ignored `self.krate`, but the trait env would still have been wrong in those cases, which I think would give some wrong results in some edge cases. Fixes #10058. Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-25Avoid autoderef coercions leaking if they don't applyFlorian Diebold-0/+42
2022-02-25Merge #11549bors[bot]-0/+94
11549: feat: support concat_bytes r=jonas-schievink a=ihciah Support `concat_bytes`. Solve #11544. Co-authored-by: ihciah <ihciah@gmail.com>
2022-02-25Fix unreachable pubFlorian Diebold-1/+1
2022-02-25Refactor autoderef and method resolutionFlorian Diebold-667/+655
- don't return the receiver type from method resolution; instead just return the autorefs/autoderefs that happened and repeat them. This ensures all the effects like trait obligations and whatever we learned about type variables from derefing them are actually applied. Also, it allows us to get rid of `decanonicalize_ty`, which was just wrong in principle. - Autoderef itself now directly works with an inference table. Sadly this has the effect of making it harder to use as an iterator, often requiring manual `while let` loops. (rustc works around this by using inner mutability in the inference context, so that things like unifying types don't require a unique reference.) - We now record the adjustments (autoref/deref) for method receivers and index expressions, which we didn't before. - Removed the redundant crate parameter from method resolution, since the trait_env contains the crate as well. - in the HIR API, the methods now take a scope to determine the trait env. `Type` carries a trait env, but I think that's probably a bad decision because it's easy to create it with the wrong env, e.g. by using `Adt::ty`. This mostly didn't matter so far because `iterate_method_candidates` took a crate parameter and ignored `self.krate`, but the trait env would still have been wrong in those cases, which I think would give some wrong results in some edge cases. Fixes #10058.
2022-02-25Add some testsFlorian Diebold-0/+82
2022-02-25feat: support concat_bytesihciah-0/+94
2022-02-25Add CSV output to analysis-statsFlorian Diebold-6/+68
For easy diffing.
2022-02-25Minor perf change: `vec.clone().into_iter()` => `vec.iter().cloned()`Chayim Refael Friedman-1/+1
2022-02-25Update references to macro_rules in the "Extract module" assistChayim Refael Friedman-0/+26
See https://github.com/rust-analyzer/ungrammar/pull/46#issuecomment-1049801890.
2022-02-25Do not change visibility of macro_rules in the "Extract module" assistChayim Refael Friedman-1/+0
See https://github.com/rust-analyzer/ungrammar/pull/46#issuecomment-1049801890.
2022-02-25Generate AST code after rust-analyzer/ungrammar#46Chayim Refael Friedman-0/+1
2022-02-24refactor(11422): make number unsigned, nest enums into each otherMoritz Vetter-13/+11
2022-02-24fix(11422): have two different funuctions - one for iterating breaks, one ↵Moritz Vetter-49/+104
for iteraating breaks and continues
2022-02-24add logic to highlight continue and break keywords according to expectationsMoritz Vetter-32/+60
2022-02-24refactor helper function to work with function taking expression enum ↵Moritz Vetter-10/+15
instead of break expression
2022-02-24add some breaking tests (TDD - style)Moritz Vetter-0/+109
2022-02-24Merge #11531bors[bot]-28/+427
11531: fix: Make fill_match_arms assist handle doc(hidden) and non_exhaustive r=Veykril a=OleStrohm Fixes #11499 Fixes #11500 This keeps track of the relevant attributes and adds in a wildcard pat at the end of the match when necessary. I decided to do them in the same PR since they both needed the ability to add a wildcard arm, and so their changes would overlap if done separately, but I'll split them up if that seems better. This is my first PR to rust-analyzer, so all feedback is greatly appreciated! Co-authored-by: Ole Strohm <strohm99@gmail.com>
2022-02-24Merge #11540bors[bot]-65/+63
11540: fix: Resolve private fields in type inference r=flodiebold a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10253#issuecomment-920962927 (the same issue probably exists for method calls, but I think fixing that might be trickier) Visibility checks were introduced in https://github.com/rust-analyzer/rust-analyzer/issues/7841 for autoderef to work properly, so now we just record the first field we find unconditionally, and then overwrite it if autoderef manages to find another field in a later cycle. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-24add `is_slice` method to `hir::Type`Akshay-0/+4
2022-02-23Ignore doc(hidden) for crate-local enumsOle Strohm-139/+176
2022-02-23fix: Resolve private fields in type inferenceLukas Wirth-1/+17
2022-02-23SimplifyLukas Wirth-64/+46
2022-02-23SimplifyLukas Wirth-30/+20
2022-02-23Reduce visibility of proc-macros to pub(crate)Lukas Wirth-98/+100
2022-02-23Resolve functions as proc-macros via FileAstIdLukas Wirth-5/+42
2022-02-22Added testOle Strohm-3/+27
2022-02-22Dedup codeOle Strohm-17/+21
2022-02-22Merge #11461bors[bot]-29/+203
11461: Extract struct from enum variant filters generics r=jo-goro a=jo-goro Fixes #11452. This PR updates extract_struct_from_enum_variant. Extracting a struct `A` form an enum like ```rust enum X<'a, 'b> { A { a: &'a () }, B { b: &'b () }, } ``` will now be correctly generated as ```rust struct A<'a> { a: &'a () } enum X<'a, 'b> { A(A<'a>), B { b: &'b () }, } ``` instead of the previous ```rust struct A<'a, 'b>{ a: &'a () } // <- should not have 'b enum X<'a, 'b> { A(A<'a, 'b>), B { b: &'b () }, } ``` This also works for generic type parameters and const generics. Bounds are also copied, however I have not yet implemented a filter for unneeded bounds. Extracting `B` from the following enum ```rust enum X<'a, 'b: 'a> { A { a: &'a () }, B { b: &'b () }, } ``` will be generated as ```rust struct B<'b: 'a> { b: &'b () } // <- should be `struct B<'b> { b: &'b () }` enum X<'a, 'b: 'a> { A { a: &'a () }, B(B<'b>), } ``` Extracting bounds with where clauses is also still not implemented. Co-authored-by: Jonas Goronczy <goronczy.jonas@gmail.com>
2022-02-22Replaced fold with for loopJonas Goronczy-32/+27
2022-02-22Merge #11472bors[bot]-13/+45
11472: fix: visibility in impl items and pub(crate) to pub in extract_module r=feniljain a=feniljain Should fix #11007 and #11443 Makes following changes: - Removes visiblity modifiers from trait items - Respect user given visibility - Updated tests for the same Co-authored-by: vi_mi <fkjainco@gmail.com> Co-authored-by: vi_mi <49019259+feniljain@users.noreply.github.com>
2022-02-22chore: reposition commentvi_mi-6/+2
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-22fix: Make match_arms assist handle doc(hidden) and non_exhaustiveOle Strohm-28/+362
2022-02-22fix: visibility in impl items and pub(crate) to pub in extract_modulevi_mi-13/+49
2022-02-22fix: Fix expand_macro always expanding the first listed deriveLukas Wirth-4/+18
2022-02-22update references::derive test outputLukas Wirth-2/+5
2022-02-22simplify and documentLukas Wirth-47/+52
2022-02-22SimplifyLukas Wirth-27/+37
2022-02-22Fix syntax highlighting not highlighting derives anymoreLukas Wirth-0/+38
2022-02-22Make replace_derive_with_manual_impl work againLukas Wirth-130/+118
2022-02-22Fix `expand_macro` not working for derive attributesLukas Wirth-18/+42
2022-02-22internal: Expand the derive attribute into a pseudo expansionLukas Wirth-155/+178
2022-02-22Merge #11527bors[bot]-104/+147
11527: internal: Split unresolve proc-macro error out of mbe r=Veykril a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>