Commit graph

7302 commits

Author SHA1 Message Date
Aleksey Kladov
05d67a9a0e Move test data to test_data directory 2020-07-01 11:26:09 +02:00
Aleksey Kladov
adf624b433 Add file support to expect 2020-07-01 11:19:40 +02:00
Laurențiu Nicola
c1139a5a44 Use the existing Semantics in auto_import 2020-07-01 11:48:15 +03:00
Aleksey Kladov
82838f5eda Cleanup 2020-07-01 10:44:16 +02:00
Aleksey Kladov
977b688144 Don't fail tests when updating snapshot 2020-07-01 10:44:16 +02:00
David Lattimore
3d9997889b SSR: Add initial support for placeholder constraints 2020-07-01 18:44:11 +10:00
bors[bot]
dd3ad2bd41
Merge #5154 #5157
5154: Structured search debugging r=matklad a=davidlattimore

Adds a "search" mode to the rust-analyzer binary that does structured search (SSR without the replace part). This is intended primarily for debugging why a bit of code isn't matching a pattern.

5157: Use dynamic dispatch in AstDiagnostic r=matklad a=lnicola



Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 08:11:23 +00:00
bors[bot]
686e115e73
Merge #5158
5158: Use CrateName correctly r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-01 08:03:47 +00:00
Aleksey Kladov
80386ca5be Use Strings for display names 2020-07-01 10:03:07 +02:00
Aleksey Kladov
307c6fec61 Use CrateName for semantic names 2020-07-01 09:53:53 +02:00
Laurențiu Nicola
1be5e848b0 Use dynamic dispatch in AstDiagnostic 2020-07-01 10:46:27 +03:00
Laurențiu Nicola
331e6d8f16 Remove db from AssistsContext 2020-07-01 10:25:59 +03:00
bors[bot]
98ae447fa7
Merge #5153
5153: Make SemanticsScope non-generic r=matklad a=lnicola

This slightly reduces the build times:

![image](https://user-images.githubusercontent.com/308347/86210975-3a809480-bb7e-11ea-8975-788457f6b353.png)

(compare to https://github.com/rust-analyzer/rust-analyzer/issues/1987#issuecomment-652202248)

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 07:17:16 +00:00
Aleksey Kladov
e336a96998 FileSetConfig works with empty set of roots
Closes #5139
2020-07-01 09:06:51 +02:00
David Lattimore
95f8310514 Structured search debugging 2020-07-01 16:50:45 +10:00
Laurențiu Nicola
5953cbd7ae Make SemanticsScope non-generic 2020-07-01 09:34:45 +03: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
Aleksey Kladov
cec92407f4 Don't crash on empty out_dirs with older cargos
closes #5125
2020-06-30 22:12:27 +02:00
Aleksey Kladov
8b725a2f77 Switch to expect for the rest of inlay tests 2020-06-30 21:55:21 +02:00
Aleksey Kladov
442c13ba17 Simplify most of the inlay hints tests 2020-06-30 18:04:25 +02:00
Jonas Schievink
4602c2eeaa analysis-stats: allow parallel type inference 2020-06-30 17:00:17 +02:00
bors[bot]
0954d31bee
Merge #5138
5138: Refactor runnable tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-30 12:18:31 +00:00
Aleksey Kladov
de464f5e4a Refactor runnable tests 2020-06-30 14:12:55 +02:00
bors[bot]
3e70d0f308
Merge #5136
5136: Split namespace maps in `ItemScope` r=jonas-schievink a=jonas-schievink

Reduces memory usage of the CrateDefMap query by ~130 MB (50%) on r-a.

I was also looking into handling glob imports more efficiently (storing scope chains instead of always duplicating everything into the glob-importing module's scope), but it seems that this already gives the most significant wins.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-30 12:10:21 +00:00
Jonas Schievink
7c9b3d154c Remove entries_without_primitives 2020-06-30 14:06:23 +02:00
Jonas Schievink
a80e8fea85 Simplify entry API usage 2020-06-30 13:54:40 +02:00
Aleksey Kladov
af7e300041 Remove confusing API 2020-06-30 13:29:53 +02:00
Jonas Schievink
56fb8a401a Reorder imports 2020-06-30 13:25:15 +02:00
Jonas Schievink
0fcbc716fd Split namespace maps in ItemScope
Reduces memory usage of the CrateDefMap query by ~130 MB on r-a.
2020-06-30 13:23:42 +02:00
Aleksey Kladov
34072d53b6 Rewrite goto implementation tests 2020-06-30 13:20:16 +02:00
Aleksey Kladov
4484908a86 Rewrite goto definition tests 2020-06-30 13:03:08 +02:00
Aleksey Kladov
d34e725f09 Better factoring 2020-06-30 12:14:16 +02:00
Aleksey Kladov
d21c84abd4 Generalize annotations 2020-06-30 12:13:08 +02:00
bors[bot]
e87cba85ef
Merge #5132
5132: Fix some typos r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-30 08:45:16 +00: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
David Lattimore
ef49bbeec4 Fix some typos 2020-06-30 10:43:37 +10: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
David Lattimore
867f29559f Moved new deps to CLI-only section 2020-06-30 09:31:45 +10:00
bors[bot]
e1a5bd866e
Merge #5096 #5097
5096: Fix handling of whitespace when applying SSR within macro expansions. r=matklad a=davidlattimore

I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).

5097: Fix SSR prompt following #4919 r=matklad a=davidlattimore



Co-authored-by: David Lattimore <dml@google.com>
2020-06-29 16:03:10 +00:00
bors[bot]
86f1556f7c
Merge #5122
5122: Fix "Run | Debug" lens for examples r=matklad a=vsrs

Fixes #4974

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-29 15:55:42 +00:00
bors[bot]
4da0a78c4e
Merge #5126
5126: Use more of FxHash* r=matklad a=lnicola

```
-rwxr-xr-x 1 me me 37917528 Jun 29 17:26 /home/me/.cargo/bin/rust-analyzer
-rwxr-xr-x 1 me me 37904056 Jun 29 18:14 /home/me/.cargo/bin/rust-analyzer
```

Saved 13.5 KB there :-).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-29 15:39:51 +00:00
Aleksey Kladov
bbc4dc9956 Update the rest of the tests 2020-06-29 17:23:01 +02:00
Aleksey Kladov
e805e8c1d5 (T): make typification tests more data driven 2020-06-29 17:23:01 +02:00
Laurențiu Nicola
95d67ec401 Use more of FxHash* 2020-06-29 18:07:52 +03:00
bors[bot]
82ce5792ab
Merge #5124
5124: (Partially) fix handling of type params depending on type params r=matklad a=flodiebold

If the first type parameter gets inferred, that's still not handled correctly; it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before the `_` is instantiated into a type variable -- so afterwards, we have two type variables without any connection to each other.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-06-29 14:13:41 +00:00
Florian Diebold
8e8d2ffecb (Partially) fix handling of type params depending on type params
If the first type parameter gets inferred, that's still not handled correctly;
it'll require some more refactoring: E.g. if we have `Thing<T, F=fn() -> T>` and
then instantiate `Thing<_>`, that gets turned into `Thing<_, fn() -> _>` before
the `_` is instantiated into a type variable -- so afterwards, we have two type
variables without any connection to each other.
2020-06-29 16:10:20 +02:00
vsrs
05e6cbf310 Fix "Run | Debug" lens for examples 2020-06-29 14:05:52 +03:00
David Lattimore
93a91ae9de Add a simple SSR subcommand to the rust-analyzer command line binary 2020-06-29 13:34:45 +10:00
bors[bot]
ca31b1d63a
Merge #5105
5105: Simlify with matches!() r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 22:37:25 +00:00
Veetaha
36128c170d Get rid of unused imports 2020-06-29 01:23:39 +03:00
Veetaha
503f9498cd Follow matklad suggestions
- Move vis_offset() to utils.rs
- Shorten explicit ra_syntax::ast -> ast
- Undo refactoring exhaustive pattern to non-exhaustive
2020-06-29 01:18:50 +03:00
bors[bot]
11f31ae4c3
Merge #5114
5114: Cleanup cargo process handling in flycheck r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-28 21:43:18 +00:00
Aleksey Kladov
5cdd8d442e Cleanup cargo process handling in flycheck 2020-06-28 23:42:44 +02:00
Aleksey Kladov
32e85a1a89 More standard pattern for Cargo 2020-06-28 23:01:28 +02:00
Aleksey Kladov
eddb744d90 Naming 2020-06-28 22:35:18 +02:00
Aleksey Kladov
309b21f378 Rename 2020-06-28 22:31:40 +02:00
Florian Diebold
3fe0d73670 Update Chalk to released version 2020-06-28 21:24:20 +02:00
Aleksey Kladov
80ef52f0d5 Make sure to join the child 2020-06-28 20:00:04 +02:00
Aleksey Kladov
7cf1981a2d Don't show ra_fixture param hints 2020-06-28 13:11:41 +02:00
Veetaha
e75e2ae5b6 Simlify with matches!() 2020-06-28 04:03:59 +03:00
Aleksey Kladov
a4f934efa8
Update crates/rust-analyzer/src/handlers.rs
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-28 01:23:32 +02:00
Veetaha
39a58ed19a Simplify 2020-06-28 01:30:45 +03:00
Aleksey Kladov
3c1714d76d Fix potential overflow 2020-06-27 21:35:52 +02:00
Aleksey Kladov
53787c7eba style 2020-06-27 21:33:14 +02:00
Aleksey Kladov
a9b4fb034b Add colors 2020-06-27 21:14:25 +02:00
Aleksey Kladov
175e48e5be Remove fragile test
This test needs to be updated after every change (it contains line
number), which is annoying.

It also fails on windows due to \, so it's easier to remove it.
2020-06-27 20:50:16 +02:00
Aleksey Kladov
18e4e9fb0b Update crates/expect/src/lib.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-27 20:50:16 +02:00
Aleksey Kladov
d21dae738b Update crates/expect/src/lib.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-27 20:50:16 +02:00
Laurențiu Nicola
f8d37ff0b2 Add support for include_bytes 2020-06-27 21:02:47 +03: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
bors[bot]
446fd3f515
Merge #5100
5100: Add support for include_str r=edwin0cheng a=lnicola

r? @edwin0cheng 

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 16:36:38 +00:00
Laurențiu Nicola
b4420626fb Add support for include_str 2020-06-27 19:34:48 +03:00
Paul Daniel Faria
68a649d547 Simplify unsafe expr collection match 2020-06-27 12:00:46 -04:00
Paul Daniel Faria
b7e25ba854 Improve perf of finding unsafe exprs 2020-06-27 11:55:54 -04:00
Paul Daniel Faria
b1992b469c Remove unneeded code, filename from tests, fix rebasing issues 2020-06-27 11:38:34 -04:00
Paul Daniel Faria
28bb8ed9cb Cleanup changes leftover from previous tracking attempt 2020-06-27 10:16:19 -04:00
Paul Daniel Faria
2ca52bbb32 Revert ide highlighting changes (addressing on another branch) 2020-06-27 10:16:19 -04:00
Paul Daniel Faria
2fc92fa28c Remove track_parent and parent_map, replace with simple walk in missign unsafe validator 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
f78df42f81 Fix issues caused during rebase 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
2608a6fd3a unsafe: Clean up, improve tracking, add debug_assert
Move unsafe_expressions to unsafe_validation.rs, replace vec tracking of
child exprs with inline macro, add debug assert to ensure tracked
children match walked children exactly
2020-06-27 10:13:14 -04:00
Paul Daniel Faria
f678e0d837 Add HighlightTag::Operator, use it for unsafe deref. Move unsafe validation to its own file 2020-06-27 10:13:14 -04:00
Paul Daniel Faria
6c1682396c Account for deref token in syntax highlighting of unsafe, add test for that case 2020-06-27 10:11:10 -04:00
Paul Daniel Faria
7f2219dc76 Track expr parents during lowering, use parent map when checking if unsafe exprs are within unsafe blocks 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
9ce44be2ab Address review comments, have MissingUnsafe diagnostic point to each unsafe use, update tests 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
b9569886a9 Rename Expr::UnsafeBlock to Expr::Unsafe 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
278cbf12cd Track unsafe blocks, don't trigger missing unsafe diagnostic when unsafe exprs within unsafe block 2020-06-27 10:10:26 -04:00
Paul Daniel Faria
3df0f9ce7e Add missing self param to test 2020-06-27 10:09:42 -04:00
Paul Daniel Faria
c622551ec2 Fix typo in test 2020-06-27 10:09:42 -04:00
Paul Daniel Faria
499d4c454d Remove UnnecessaryUnsafe diagnostic, Fix Expr::Call unsafe analysis 2020-06-27 10:09:42 -04:00
Paul Daniel Faria
b358fbfdf8 Add tests covering unsafe blocks, more attempts to get call expr tests passing 2020-06-27 10:09:29 -04:00
Paul Daniel Faria
daf1cac9f8 Move diagnostics back into expr, add tests for diagnostics, fix logic to account for derefs of raw ptrs 2020-06-27 10:09:29 -04:00
Paul Daniel Faria
0b95bed83f Add unsafe diagnostics and unsafe highlighting 2020-06-27 10:08:14 -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
David Lattimore
64a49589e7 Fix handling of whitespace when applying SSR within macro expansions.
I originally did replacement by passing in the full file text. Then as some point I thought I could do without it. Turns out calling .text() on a node coming from a macro expansion isn't a great idea, especially when you then try and use ranges from the original source to cut that text. The test I added here actually panics without the rest of this change (sorry I didn't notice sooner).
2020-06-27 20:38:31 +10:00
Aleksey Kladov
491d000c27 Add :: to label for crate:: completion 2020-06-27 12:26:25 +02:00
Aleksey Kladov
4e3e8d1ab2 cleanup 2020-06-27 12:07:48 +02: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