Commit Graph

11182 Commits

Author SHA1 Message Date
Veetaha
39a58ed19a Simplify 2020-06-28 01:30:45 +03:00
Laurențiu Nicola
9ef4e85f17 Bump @rollup/plugin-commonjs 2020-06-27 22:37:03 +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
bors[bot]
513924a7e0
Merge #5102
5102: Add support for include_bytes! r=edwin0cheng a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-27 19:10:56 +00: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
Laurențiu Nicola
30a246bb99 Bump some npm deps 2020-06-27 20:41:22 +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
bors[bot]
45fc8d5c84
Merge #4587
4587: Add "missing unsafe" diagnostics r=Nashenas88 a=Nashenas88

Addresses #190 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-06-27 16:03:29 +00:00
Paul Daniel Faria
9777d2cb2d Remove html from gitignore so highlight snapshots are not ignored 2020-06-27 12:02:49 -04: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]
9d1e2c4d9d
Merge #5099
5099: Escape space in path for MacOS binary location r=matklad a=LeSeulArtichaut

This makes it possible and easier to copy paste the path to the binary server, without needing to add quotes.

Co-authored-by: LeSeulArtichaut <leseulartichaut@gmail.com>
2020-06-27 12:34:32 +00:00
LeSeulArtichaut
44a164b338
Escape space in path for MacOS binary location 2020-06-27 14:13:14 +02:00
David Lattimore
2a18ef0b09 Fix SSR prompt following #4919 2020-06-27 21:26:28 +10: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
bors[bot]
67b1dfba50
Merge #5095
5095: Add `::` to label for  `crate::` completion r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-27 10:26:54 +00:00
Aleksey Kladov
491d000c27 Add :: to label for crate:: completion 2020-06-27 12:26:25 +02:00
bors[bot]
b081018363
Merge #5094
5094: cleanup r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-27 10:11:00 +00: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
bors[bot]
dd3f9eaceb
Merge #5007
5007: SSR: Allow matching within macro calls r=matklad a=davidlattimore

#3186 

Co-authored-by: David Lattimore <dml@google.com>
2020-06-27 09:43:08 +00:00