Stream: t-compiler/wg-rls-2.0

Topic: proptest in ra_text_edit


Laurențiu Nicola (Oct 03 2019 at 12:23, on Zulip):

@matklad in https://github.com/rust-analyzer/rust-analyzer/pull/1926#issuecomment-535849720 and https://github.com/rust-analyzer/rust-analyzer/issues/1925#issuecomment-535842174 you mention implementing Arbitrary and how moving some code around isn't possible due to the coherence rules. This might change in the future (also quickcheck), but right now there's no Arbitrary instance in ra_text_edit

Laurențiu Nicola (Oct 03 2019 at 12:24, on Zulip):

I checked, and moving that code around fixes #1925, but it might go against your plans

Laurențiu Nicola (Oct 03 2019 at 12:28, on Zulip):

On the other hand, proptest itself is not the issue here. ra_text_edit has a dependency on proptest, while ra_ide_api has a dev-dependency on it. For some reason, if I build everything, touch the code in ra_syntax, build ra_cli, then build ra_lsp_server, a lot of the RA crates will get rebuilt.

Laurențiu Nicola (Oct 03 2019 at 12:28, on Zulip):

Removing proptest from ra_text_edit fixes this.

Laurențiu Nicola (Oct 03 2019 at 12:42, on Zulip):

Maybe cargo could be smarter here, but it's a bit icky that a crate should pull a heavyweight dependency just in case others want to use it for testing

matklad (Oct 04 2019 at 08:56, on Zulip):

Ah, right, we directly provide a function that yields arbitrary text and edits.... Still, I think it makes sense to provide this function as part of TextEdit crate.

matklad (Oct 04 2019 at 08:57, on Zulip):

The problem here is that proptest is heavy weight: really, providing a strategy for generation shouldn't require that much code to be compiled

Laurențiu Nicola (Oct 04 2019 at 09:19, on Zulip):

That's what I'm trying to say. Even if proptest took one second to build, with the current setup touching a file in ra_syntax makes cargo rebuild every RA crate twice.

Laurențiu Nicola (Oct 04 2019 at 09:20, on Zulip):

At least if you're building both ra_cli and ra_lsp_server

Laurențiu Nicola (Oct 04 2019 at 09:20, on Zulip):

I'm not sure why, though, but it seems to be caused by the extra non-dev proptest dependency

Laurențiu Nicola (Oct 04 2019 at 09:27, on Zulip):
$ cargo build --release
   Finished release [optimized + debuginfo] target(s) in 0.06s
$ touch crates/ra_syntax/src/lib.rs
$ cargo build --release -p ra_cli
  Compiling proptest v0.9.4
  Compiling ra_text_edit v0.1.0 (~/rust-analyzer/crates/ra_text_edit)
  Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
  Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
  Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
  Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
  Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
  Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
  Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
  Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
  Compiling ra_batch v0.1.0 (~/rust-analyzer/crates/ra_batch)
  Compiling ra_cli v0.1.0 (~/rust-analyzer/crates/ra_cli)
   Finished release [optimized + debuginfo] target(s) in 1m 52s
$ cargo build --release
  Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
  Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
  Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
  Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
  Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
  Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
  Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
  Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
  Compiling ra_lsp_server v0.1.0 (~/rust-analyzer/crates/ra_lsp_server)
  Compiling ra_batch v0.1.0 (~/rust-analyzer/crates/ra_batch)
  Compiling ra_cli v0.1.0 (~/rust-analyzer/crates/ra_cli)
   Finished release [optimized + debuginfo] target(s) in 14.48s
$ cargo build --release -p ra_lsp_server
   Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
   Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
   Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
   Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
   Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
   Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
   Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
   Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
   Compiling ra_lsp_server v0.1.0 (~/rust-analyzer/crates/ra_lsp_server)
    Finished release [optimized + debuginfo] target(s) in 8.15s
$ cargo build --release
    Finished release [optimized + debuginfo] target(s) in 0.05s
Laurențiu Nicola (Oct 04 2019 at 09:30, on Zulip):

Maybe it only happens with -p

Last update: Nov 19 2019 at 18:25UTC