Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Remove "edition" Cargo feature (it's stable now) #1058

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

Xanewok
Copy link
Member

@Xanewok Xanewok commented Sep 19, 2018

Gets rid of the

warning: the cargo feature `edition` is now stable and is no longer necessary to be listed in the manifest

warning message.

@nrc nrc merged commit 42c4a90 into rust-lang:master Sep 20, 2018
@Xanewok Xanewok deleted the stable-edition branch September 21, 2018 17:13
@alexheretic alexheretic mentioned this pull request Sep 21, 2018
bors-voyager bot added a commit that referenced this pull request Sep 30, 2018
1062: Rework cmd tests r=Xanewok a=alexheretic

* Rewrite all _tests/tests.rs_ "cmd" tests
* <s>cargo update</s>
* cmd test wait-for-rls-stdout timeout reduced 300 -> 30

The cmd tests aren't good enough because they don't fail very usefully. They either work or block for 300 seconds then say nothing. For example the build is currently failing in master, but can anyone see why?

The new code has
* Explicit timeouts for any blocking calls, meaning it's easy to see where we wait for stdout.
* More accurate dynamic json assertions. 
   ```rust
   assert_eq!(json["method"], "window/progress");
   assert_eq!(json["params"]["title"], "Indexing");
   ```
* Removed all but one test checking _window/progress_ messages.
* Removed outer timeout/closure which obfuscates test panics & adds complexity.

The `RlsHandle` now uses a thread to eagerly read stdout, and eprints that stdout when an assertion fails. This stdout allows us to debug the tests when they fail. To see the improvement here is the failure output of the tests with this change:

```
running 4 tests
test cmd_test_infer_bin ... FAILED
test cmd_test_complete_self_crate_name ... ok
test cmd_test_simple_workspace ... ok
test cmd_changing_workspace_lib_retains_bin_diagnostics ... ok

failures:

---- cmd_test_infer_bin stdout ----
thread 'cmd_test_infer_bin' panicked at 'assertion failed: `(left == right)`
  left: `String("window/showMessage")`,
 right: `"textDocument/publishDiagnostics"`', tests/tests.rs:58:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
---rls-stdout---
Content-Length: 607

{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[".",":"]},"definitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":true,"codeLensProvider":{"resolveProvider":false},"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"executeCommandProvider":{"commands":["rls.applySuggestion-29146","rls.deglobImports-29146"]}}}}Content-Length: 92

{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_1","title":"Building"}}Content-Length: 104

{"jsonrpc":"2.0","method":"window/progress","params":{"done":true,"id":"progress_1","title":"Building"}}Content-Length: 92

{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_0","title":"Indexing"}}Content-Length: 157

{"jsonrpc":"2.0","method":"window/showMessage","params":{"message":"Cargo failed: failed to parse manifest at `/home/alex/project/rls/Cargo.toml`","type":1}}Content-Length: 104

{"jsonrpc":"2.0","method":"window/progress","params":{"done":true,"id":"progress_0","title":"Indexing"}}
---------------


failures:
    cmd_test_infer_bin

test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
```

Once you have this output it's fairly easy to see **Cargo failed: failed to parse manifest at `/home/alex/project/rls/Cargo.toml`**. The recent update (#1058) to the main Cargo.toml <s>is</s> was interfering with the cmd tests.

And all this with ~100 lines net removed :)

Co-authored-by: Alex Butler <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants