Commit Graph

767 Commits

Author SHA1 Message Date
Aleksey Kladov
7db795e747 ⬆️ deps 2020-07-08 22:02:54 +02:00
Aleksey Kladov
dab7f3d2c6 Remove relative_path dependency 2020-07-08 19:32:36 +02:00
bors[bot]
41feb816c9
Merge #5255
5255: Replace ad hocery with science r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-07 21:32:08 +00:00
Aleksey Kladov
69b79e3a73 Replace ad hocery with science 2020-07-07 23:28:48 +02:00
Veetaha
f92bfb5807 Gzip artifacts
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>

Override miniz_oxide to build it with optimizations

Building this crate with optimizations decreases the gzipping
part of `cargo xtask dist` from `30-40s` down to `3s`,
the overhead for `rustc` to apply optimizations is miserable on this background
2020-07-07 23:30:11 +03:00
Aleksey Kladov
1e6336c4b9 ⬆️ backtrace 2020-07-07 16:26:33 +02:00
Aleksey Kladov
74223de7c4 Upstream salsa 2020-07-07 16:01:05 +02:00
Aleksey Kladov
4bbc385277 Switch to fully dynamically dispatched salsa
This improves compile times quite a bit
2020-07-07 10:14:48 +02:00
kjeremy
b03dbd2c74 Update crates 2020-07-06 13:44:41 -04:00
Jonas Schievink
0da5ce0b59 Update salsa 2020-07-06 11:47:11 +02:00
Jeremy Kolb
b48dc22fbf update deps 2020-07-04 10:49:13 -04:00
Aleksey Kladov
b6ac5952cf ⬆️ salsa 2020-07-03 16:41:58 +02:00
David Lattimore
3d9997889b SSR: Add initial support for placeholder constraints 2020-07-01 18:44:11 +10:00
bors[bot]
b1a2d01645
Merge #5142
5142: analysis-stats: allow parallel type inference r=matklad a=jonas-schievink

This is mostly just for testing/fun, but it looks like type inference can be sped up massively with little to no effort (since it runs after the serial phases are already done).

Without `--parallel`:

```
Item Collection: 16.43597698s, 683mb allocated 720mb resident
Inference: 25.429774879s, 1720mb allocated 1781mb resident
Total: 41.865866352s, 1720mb allocated 1781mb resident
```

With `--parallel`:

```
Item Collection: 16.380369815s, 683mb allocated 735mb resident
Parallel Inference: 7.449166445s, 1721mb allocated 1812mb resident
Inference: 143.437157ms, 1721mb allocated 1812mb resident
Total: 23.973303611s, 1721mb allocated 1812mb resident
```

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-30 21:17:54 +00:00
kjeremy
a05fba0213 Bump console and insta (removes clicolors-control and atty) 2020-06-30 15:12:36 -04:00
Jonas Schievink
4602c2eeaa analysis-stats: allow parallel type inference 2020-06-30 17:00:17 +02:00
Zac Pullar-Strecker
d6f9e8806a Remove unintentional changes 2020-06-30 21:42:44 +12:00
bors[bot]
d13ded6cbc
Merge #5101
5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad

This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs  a test with env-var set). 

Here's workflow for updating a failing test:

![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif)

Here's workflow for adding a new test:

![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif)

Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). 

Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!):
* self-updating tests, no need for a separate tool
* fewer features (only inline snapshots, no redactions)
* fewer deps (no yaml, no persistence)
* tighter integration with editor
* first-class snapshot object, which can be used to write test functions (as opposed to testing macros)
* trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. 

I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). 

# Editor Integration Implementation 

The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. 

The ideal UI here would be a code action (💡). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. 

For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given #5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. 

closes #3835 


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 08:34:08 +00:00
Zac Pullar-Strecker
6bba4158cb Switch to pulldown-cmark, tidy imports 2020-06-30 20:10:23 +12:00
Zac Pullar-Strecker
1d6f291335 Move resolver into impls, work on tests 2020-06-30 20:07:08 +12:00
Zac Pullar-Strecker
5f52a516de Working intra-doc-links 2020-06-30 20:02:47 +12:00
Zac Pullar-Strecker
8f56e7c3b1 Generate correct symbol filename for relative links 2020-06-30 20:02:46 +12:00
Zac Pullar-Strecker
2023af53f0 Hover doc link rewriting 2020-06-30 20:02:46 +12:00
bors[bot]
2bd7171399
Merge #5120
5120: Add a simple SSR subcommand to the rust-analyzer command line binary r=davidlattimore a=davidlattimore

Is adding the dependency on ra_ide_db OK? It's needed for the call to `db.local_roots()`

Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 23:33:34 +00:00
kjeremy
ff08ae9266 Update serde_json and cc 2020-06-29 14:09:29 -04:00
David Lattimore
93a91ae9de Add a simple SSR subcommand to the rust-analyzer command line binary 2020-06-29 13:34:45 +10:00
Jeremy Kolb
c3b38dcca9 Update instant 2020-06-28 16:07:44 -04:00
Florian Diebold
3fe0d73670 Update Chalk to released version 2020-06-28 21:24:20 +02:00
Aleksey Kladov
a9b4fb034b Add colors 2020-06-27 21:14:25 +02:00
Aleksey Kladov
be265ece02 Add example expect test for goto definition 2020-06-27 19:22:31 +02:00
Aleksey Kladov
03c5a6690d Add light-weight snapshot testing library with editor integration 2020-06-27 19:22:31 +02:00
Paul Daniel Faria
b1992b469c Remove unneeded code, filename from tests, fix rebasing issues 2020-06-27 11:38:34 -04:00
bors[bot]
6a067ce947
Merge #5090
5090: Bump deps r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 11:00:51 +00:00
Laurențiu Nicola
52a488982f Bump rustc_lexer 2020-06-27 13:56:54 +03:00
Laurențiu Nicola
d036006c95 Bump deps 2020-06-27 13:56:54 +03:00
bors[bot]
18a6dd4635
Merge #4982
4982: Bump chalk r=matklad a=lnicola

This passes the tests, but fails in a weird way on `analysis-stats`:

```
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-solve-0.14.0/src/clauses/builtin_traits/fn_family.rs:96:20
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  11: rust_begin_unwind
             at src/libstd/panicking.rs:385
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:86
  13: core::panicking::panic
             at src/libcore/panicking.rs:51
  14: chalk_solve::clauses::builtin_traits::fn_family::add_fn_trait_program_clauses
  15: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
  16: chalk_solve::clauses::program_clauses_that_could_match
  17: chalk_solve::clauses::program_clauses_for_goal
  18: chalk_solve::recursive::Solver<I>::solve_new_subgoal
  19: <chalk_solve::recursive::Solver<I> as chalk_solve::recursive::solve::SolveDatabase<I>>::solve_goal
  20: chalk_solve::recursive::Solver<I>::solve_root_goal
  21: chalk_solve::solve::Solver<I>::solve_limited
  22: ra_hir_ty::traits::trait_solve_query
  23: salsa::runtime::Runtime<DB>::execute_query_implementation
  24: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade
  25: salsa::derived::slot::Slot<DB,Q,MP>::read
  26: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
  27: salsa::QueryTable<DB,Q>::get
  28: <T as ra_hir_ty::db::HirDatabase>::trait_solve
  29: ra_hir_ty::infer::InferenceContext::resolve_ty_as_possible
  30: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  31: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
  32: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::check_call_arguments
  33: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call
  34: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  35: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr
  36: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_method_call
  37: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  38: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
  39: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  40: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  41: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
  42: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_inner
  43: ra_hir_ty::infer::expr::<impl ra_hir_ty::infer::InferenceContext>::infer_expr_coerce
  44: ra_hir_ty::infer::infer_query
  45: salsa::runtime::Runtime<DB>::execute_query_implementation
  46: salsa::derived::slot::Slot<DB,Q,MP>::read_upgrade
  47: salsa::derived::slot::Slot<DB,Q,MP>::read
  48: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
  49: ra_hir_ty::db::infer_wait
  50: rust_analyzer::cli::analysis_stats::analysis_stats
  51: rust_analyzer::main
  52: std::rt::lang_start::{{closure}}
  53: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  54: std::panicking::try::do_call
             at src/libstd/panicking.rs:297
  55: std::panicking::try
             at src/libstd/panicking.rs:274
  56: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  57: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  58: main
  59: __libc_start_main
  60: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

It's as if we're returning `None` for a well-known trait that `chalk` asks about. That seems to happen for `Deref`, `CoerceUnsized` and `Try`.

r? @flodiebold

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 09:50:08 +00:00
Aleksey Kladov
9617bb4f07 Try to find rustfmt in more places 2020-06-27 01:28:06 +02:00
Laurențiu Nicola
7e104ea4a8 Bump chalk 2020-06-26 13:00:55 +03:00
Aleksey Kladov
0ec5d4f55c Rename ra_flycheck -> flycheck 2020-06-25 09:13:46 +02:00
Jonas Schievink
696a7a5a41 lower traits 2020-06-24 16:52:37 +02:00
Aleksey Kladov
e6c61d5072 Cleanup project.json deserialization 2020-06-24 16:16:52 +02:00
Aleksey Kladov
154cb8243b Be more explicit about absolute paths at various places 2020-06-24 14:39:34 +02:00
Aleksey Kladov
84cd28fddc Cut problematic dependency 2020-06-23 18:56:26 +02:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
Aleksey Kladov
676e82bb83 Remove relative-path dependency 2020-06-23 17:04:10 +02:00
David Lattimore
662ab2ecc8 Allow SSR to match type references, items, paths and patterns
Part of #3186
2020-06-22 21:42:55 +10:00
Jeremy Kolb
3dfcf4b5ed cargo update 2020-06-21 11:53:52 -04:00
Aleksey Kladov
f3cf85ab48 Move ReqQueue to lsp-server 2020-06-20 23:24:16 +02:00
kjeremy
31c8476a11 cargo update 2020-06-16 13:21:38 -04:00
Aleksey Kladov
c002322bde New VFS API 2020-06-16 13:42:29 +02:00
Aleksey Kladov
a32cff333d Introduce paths crate
It's a good idea to distinguish between absolute and relative paths at
the type level, to avoid accidental dependency on the cwd, which
really shouldn't matter for rust-analyzer service
2020-06-14 14:15:36 +02:00
kjeremy
c383bc8094 Update crates 2020-06-11 08:55:41 -04:00
kjeremy
b2aefc2e02 Updated yanked crate 2020-06-11 08:43:35 -04:00
bors[bot]
32157d48f4
Merge #4843
4843: Don't guess macro expansion crate r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-11 10:18:53 +00:00
Aleksey Kladov
d8a5d39c2d Make relevant_crates return a Set 2020-06-11 11:30:06 +02:00
Jonas Schievink
dd22657407 ImportMap: use IndexMap internally
It iterates in insertion order, which makes the ordering more
predictable.
2020-06-10 16:15:49 +02:00
Jonas Schievink
4bcf8c8c68 Add an FST index to ImportMap 2020-06-10 12:38:58 +02:00
Jeremy Kolb
0d01be7e18 Update quote 2020-06-07 18:21:38 -04:00
Florian Diebold
69854f7795 Upgrade Chalk to published version 2020-06-05 17:06:07 +02:00
Aleksey Kladov
d103d4b071 Update inotify
https://github.com/rust-analyzer/rust-analyzer/issues/4224#issuecomment-639328191
2020-06-05 15:33:55 +02:00
kjeremy
bc2edc1d1a Cargo update 2020-06-03 09:43:27 -04:00
bors[bot]
e644f64f2a
Merge #4678
4678: Unsquish parameter types in tooltips for macro-generated functions r=aloucks a=aloucks

Note the missing whitespace between `:` and the parameter type.

Before:
![image](https://user-images.githubusercontent.com/221559/83364680-faf13d80-a370-11ea-96b7-a041969a4954.png)

After:
![image](https://user-images.githubusercontent.com/221559/83364685-03e20f00-a371-11ea-9668-4e6ebcb81947.png)


Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-06-03 11:27:10 +00:00
Aaron Loucks
f06b2bcd91 Use split1 when formatting function signature params 2020-06-03 07:26:15 -04:00
bors[bot]
131ccd9540
Merge #4580
4580: Fix invoking cargo without consulting CARGO env var or standard installation paths r=matklad a=Veetaha

Followup for #4329

The pr essentially fixes [this bug](https://youtu.be/EzQ7YIIo1rY?t=2189)

cc @lefticus

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-06-02 11:58:28 +00:00
Jeremy Kolb
51b675a70d Update deps 2020-05-31 11:38:09 -04:00
veetaha
d605ec9c32 Change Runnable.bin -> Runnable.kind
As per matklad, we now pass the responsibility for finding the binary to the frontend.
Also, added caching for finding the binary path to reduce
the amount of filesystem interactions.
2020-05-31 05:21:45 +03:00
veetaha
a419cedb1c Fix tests, apply code review proposals 2020-05-31 03:10:23 +03:00
veetaha
030d78345f Fix invoking cargo without consulting CARGO or standard installation paths 2020-05-31 03:10:23 +03:00
Florian Diebold
ab28f6c249 Upgrade Chalk
Fixes #4072.
2020-05-29 16:49:52 +02:00
Florian Diebold
c8a4bb1445 Upgrade Chalk
Chalk newly added TypeName::Never and Array; I implemented the conversion for
Never, but not Array since that expects a const argument.
2020-05-27 21:07:08 +02:00
kjeremy
9a0353a81e Update lexer 2020-05-26 14:35:09 -04:00
kjeremy
154e376842 Update crates 2020-05-26 14:32:56 -04:00
Aleksey Kladov
733956617e Fix Cargo.lock 2020-05-24 15:42:11 +02:00
Aleksey Kladov
130318b823
Merge pull request #4548 from bnjjj/fix_4464
add support of feature flag for runnables
2020-05-24 15:34:35 +02:00
Julian Wollersberger
cd4ffc1945 Update to rustc_lexer version 660.
Change `unescape_*()` to `unescape_literal()`.
2020-05-24 13:12:16 +02:00
Benjamin Coenen
48d7c61e26 add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-23 20:59:18 +02:00
Florian Diebold
06ed140fc7 Update Chalk
As always, this just makes compilation work, we don't use the newly available
functionality yet.
2020-05-22 16:40:42 +02:00
kjeremy
6bf4fc27d9 LSP: Two stage initialization
Fills in server information.

Derives CodeAction capabilities from the client. If code action literals
are unsupported we fall back to the "simple support" which just sends back
commands (this is already supported in our config). The difference being
that we did not adjust our server capabilities so that if the client was
checking for `CodeActionProvider: "true"` in the response that would have failed.
2020-05-19 11:56:51 -04:00
kjeremy
f76f737b91 Update crates 2020-05-19 10:11:34 -04:00
Florian Diebold
050601ef7b Chalk upgrade 2020-05-16 11:43:48 +02:00
Aleksey Kladov
f1a5c489fd Better structure 2020-05-15 01:58:39 +02:00
Aleksey Kladov
220813dcb0 Move LSP bits from flycheck to rust-analyzer
There should be only one place that knows about LSP, and that place is
right before we spit JSON on stdout.
2020-05-15 01:52:25 +02:00
kjeremy
02903c8b60 Update crates
Documentation improvements
2020-05-13 08:44:15 -04:00
kjeremy
735fdebd87 Update crates 2020-05-12 16:49:42 -04:00
Aleksey Kladov
ded460146b ⬆️ ra_vfs
Fix a critical bug where \r\n line endings would accidentally sneak in
after in-memory overlay removal.
2020-05-11 00:52:11 +02:00
bors[bot]
a3dbd272e0
Merge #4406 #4410 #4411 #4417
4406: Update cargo-metadata r=matklad a=edwin0cheng

This PR update `cargo-metadata` to  0.10.0 and it also relax the` serde-derive` deps to 1.0 for tests in `proc-macro-srv`.

cc @robojumper 

r= @matklad  , I think you would have something to say related to https://github.com/serde-rs/json/issues/647#issue-593788429 ?





4410: Improve wording in comment r=matklad a=edwin0cheng



4411: do not remove then block when you unwrap else block #4361 r=matklad a=bnjjj

close #4361 

4417: Omit default types in HirDisplay SourceCode mode r=matklad a=TimoFreiberg

Closes #4390

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-10 17:37:07 +00:00
Edwin Cheng
2400d70442 Update cargo-metadata 2020-05-10 06:22:26 +08:00
Aleksey Kladov
ecff5dc141 Cleanup 2020-05-08 14:55:28 +02:00
Aleksey Kladov
6713be0b13 Rename ra_env -> ra_toolchain 2020-05-08 12:25:36 +02:00
bors[bot]
8295a9340c
Merge #4329
4329: Look for `cargo`, `rustc`, and `rustup` in standard installation path r=matklad a=cdisselkoen

Discussed in #3118.  This is approximately a 90% fix for the issue described there.

This PR creates a new crate `ra_env` with a function `get_path_for_executable()`; see docs there.  `get_path_for_executable()` improves and generalizes the function `cargo_binary()` which was previously duplicated in the `ra_project_model` and `ra_flycheck` crates.  (Both of those crates now depend on the new `ra_env` crate.)  The new function checks (e.g.) `$CARGO` and `$PATH`, but also falls back on `~/.cargo/bin` manually before erroring out.  This should allow most users to not have to worry about setting the `$CARGO` or `$PATH` variables for VSCode, which can be difficult e.g. on macOS as discussed in #3118.

I've attempted to replace all calls to `cargo`, `rustc`, and `rustup` in rust-analyzer with appropriate invocations of `get_path_for_executable()`; I don't think I've missed any in Rust code, but there is at least one invocation in TypeScript code which I haven't fixed.  (I'm not sure whether it's affected by the same problem or not.) a4778ddb7a/editors/code/src/cargo.ts (L79)

I'm sure this PR could be improved a bunch, so I'm happy to take feedback/suggestions on how to solve this problem better, or just bikeshedding variable/function/crate names etc.

cc @Veetaha 

Fixes #3118.

Co-authored-by: Craig Disselkoen <craigdissel@gmail.com>
Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-08 10:11:19 +00:00
kjeremy
88a45a2ee3 Update deps 2020-05-07 16:22:53 -04:00
Craig Disselkoen
3077eae2a6 use home crate instead of dirs 2020-05-07 12:06:44 -07:00
Craig Disselkoen
303b444dbb pull function out into new crate ra_env; use in ra_flycheck as well 2020-05-05 16:12:56 -07:00
Craig Disselkoen
ffaef1b7ae ra_project_model: look for Cargo in more places
See #3118
2020-05-05 16:12:56 -07:00
kjeremy
810c961961 Update crates 2020-05-01 18:26:42 -04:00
Laurențiu Nicola
1e20467c3a Bump deps 2020-05-01 15:29:03 +03:00
Laurențiu Nicola
1a2d4e2921 Add support for incremental text synchronization 2020-04-30 21:26:57 +03:00
kjeremy
61f1c0a990 lsp-types 0.74
* Fixes a bunch of param types to take partial progress into account.
* Will allow us to support insert/replace text in completions
2020-04-26 16:05:22 -04:00
Aleksey Kladov
bd9ede0ec9 Extract messy tree handling out of profiling code 2020-04-25 21:22:40 +02:00
Aleksey Kladov
e873469500 text-size 1.0.0 2020-04-25 12:15:32 +02:00
Aleksey Kladov
b1d5817dd1 Convert code to text-size 2020-04-25 11:59:18 +02:00
Aleksey Kladov
aa9a9d7ac5 ⬆️ crates (to bust the caches) 2020-04-24 02:58:21 +02:00
kjeremy
08e5654076 cargo update 2020-04-22 10:34:53 -04:00
Edwin Cheng
4a303366c8 Improve remove dervie attrs 2020-04-22 01:44:21 +08:00
Florian Diebold
0be68a4825 Update Chalk, and cache Chalk env elaboration through a query
This should fix some of the worst performance problems.
2020-04-20 19:16:01 +02:00
Jeremy Kolb
5c760a96b6 Update regex 2020-04-19 13:17:14 -04:00
Laurențiu Nicola
93fcf1c133 Use mmap for proc macro libs 2020-04-17 12:38:38 +03:00
bors[bot]
10d8cb913c
Merge #3958
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng

This PR do the following things:

1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros. 

To test it out: 

1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.

[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-16 20:21:59 +00:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
kjeremy
45b0826499 cargo update 2020-04-16 09:13:44 -04:00
Florian Diebold
e8d0d79a0c Update Chalk 2020-04-16 12:39:00 +02:00
bors[bot]
d61909f904
Merge #3964 #3965 #3967
3964: Nicer Chalk debug logs r=matklad a=flodiebold

I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer...

3965: Implement inline associated type bounds r=matklad a=flodiebold

Like `Iterator<Item: SomeTrait>`.

This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)

(This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...)

3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold

It was implemented for other generic parameters for the trait, but not for `Self`.

(Last one off my recursive solver branch 😄 )

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:19:46 +00:00
bors[bot]
9726401eae
Merge #3963
3963: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:08:39 +00:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00
Florian Diebold
c216a93da7 Upgrade Chalk 2020-04-13 16:18:25 +02:00
Florian Diebold
2e7b88b525 Nicer display of projections in Chalk logs 2020-04-13 14:46:03 +02:00
bors[bot]
0ecdba20df
Merge #3920
3920: Implement expand_task and list_macros in proc_macro_srv r=matklad a=edwin0cheng

This PR finish up the remain `proc_macro_srv` implementation :

1. Added dylib loading code for proc-macro crate dylib. Note that we have to add some special flags for unix loading because of a bug in old version of glibc, see https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1 and https://github.com/rust-lang/rust/issues/60593 for details.

2. Added tests for proc-macro expansion: We use a trick here by adding `serde_derive` to dev-dependencies and calling `cargo-metadata` for searching its dylib path, and expand it in our tests. 

[EDIT]
Note that this PR **DO NOT** implement the final glue code with rust-analzyer and proc-macro-srv yet.
 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-11 11:49:07 +00:00
kjeremy
51b1750cfa cargo update 2020-04-10 13:48:25 -04:00
Florian Diebold
a0a80a4103 Implement Chalk's debug methods using TLS
Chalk now panics if we don't implement these methods and run with CHALK_DEBUG,
so I thought I'd try to implement them 'properly'. Sadly, it seems impossible to
do without transmuting lifetimes somewhere. The problem is that we need a `&dyn
HirDatabase` to get names etc., which we can't just put into TLS. I thought I
could just use `scoped-tls`, but that doesn't support references to unsized
types. So I put the `&dyn` into another struct and put the reference to *that*
into the TLS, but I have to transmute the lifetime to 'static for that to work.
2020-04-10 15:04:06 +02:00
Edwin Cheng
460ddde176 Add tests 2020-04-10 02:05:54 +08:00
Edwin Cheng
f7f121d60d Add dylib loading code 2020-04-10 01:18:47 +08:00
Edwin Cheng
6af1015f74 Add rustc_server (ra_tt rustc bridge) 2020-04-09 12:22:45 +08:00
Josh Mcguigan
8c378af721 missing match arms diagnostic 2020-04-07 05:12:08 -07:00
Edwin Cheng
40616fdb49 Refactor deps 2020-04-06 23:07:48 +08:00
bors[bot]
972816b6d4
Merge #3843
3843: Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer r=est31 a=est31

The latter is auto-published on a regular schedule (Right now weekly).

See also https://github.com/alexcrichton/rustc-auto-publish

Co-authored-by: est31 <MTest31@outlook.com>
2020-04-06 08:42:52 +00:00
est31
2f6914824a Remove rustc_lexer dependency in favour of rustc-ap-rustc_lexer
The latter is auto-published on a regular schedule (Right now weekly).
2020-04-06 10:08:51 +02:00
bors[bot]
a93a04fc9e
Merge #3744
3744: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-06 07:49:09 +00:00
kjeremy
66c20495e7 Update serde_json 2020-04-05 16:03:21 -04:00
Florian Diebold
952714685a Upgrade Chalk again
The big change here is counting binders, not
variables (https://github.com/rust-lang/chalk/pull/360). We have to adapt to the
same scheme for our `Ty::Bound`. It's mostly fine though, even makes some things
more clear.
2020-04-05 19:23:18 +02:00
Florian Diebold
3659502816 Upgrade Chalk 2020-04-05 19:23:18 +02:00
kjeremy
e37e8d52f1 Cargo update 2020-04-04 17:47:19 -04:00
est31
dc142152e6 Remove unused dependencies 2020-04-04 19:22:14 +02:00
Edwin Cheng
84fb9b44c3 Introduce ra_proc_macro_srv 2020-04-03 19:01:44 +08:00
kjeremy
e5cd48940d filetime and proc-macro-hack 2020-04-01 10:36:00 -04:00
Aleksey Kladov
8d27829781 Reduce deps 2020-03-31 19:29:11 +02:00
Aleksey Kladov
70730d7655 Rename cargo_watch -> flycheck 2020-03-31 17:29:40 +02:00
Edwin Cheng
7f7a16675d Use jod_thread 2020-03-31 22:20:19 +08:00
Edwin Cheng
fa621f80fa Fix test 2020-03-31 22:20:18 +08:00
Edwin Cheng
503cbd3f4b Implement ra_proc_macro client logic 2020-03-31 22:20:18 +08:00
kjeremy
a1c5905d8d Update deps 2020-03-31 09:09:16 -04:00
Aleksey Kladov
f7df0b56a7 Use automatic thread joining for cargo-watch 2020-03-30 11:33:01 +02:00
Aleksey Kladov
8bea5ace7e ⬆️ jod-thread 2020-03-30 11:33:01 +02:00
Aleksey Kladov
6596e7cddf Nice string formatting 2020-03-28 12:27:54 +01:00
Aleksey Kladov
b764c38436 Start stdx
This crate will hold everything to small to be worth publishing
2020-03-28 11:01:25 +01:00
bors[bot]
b1594f1080
Merge #3727
3727: Introduce ra_proc_macro r=matklad a=edwin0cheng

This PR implemented:

1.  Reading dylib path of proc-macro crate from cargo check , similar to how `OUTDIR` is obtained.
2.  Added a new crate `ra_proc_macro` and implement the foot-work for reading result from external proc-macro expander. 
3. Added a struct `ProcMacroClient` , which will be responsible to the client side communication to the External process.



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-26 17:09:32 +00:00
Edwin Cheng
db162df264 Remove deps on tt_mbe 2020-03-27 00:46:40 +08:00
kjeremy
49144deb1b Update deps 2020-03-26 09:41:53 -04:00
Edwin Cheng
d0b6ed4441 Add ProcMacroClient 2020-03-26 03:29:45 +08:00
Edwin Cheng
a617f24eae Add ra_proc_macro 2020-03-26 01:30:39 +08:00
Kirill Bulatov
944f28fe5b Use more generic public api 2020-03-24 10:43:22 +02:00