Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

No errors / warnings are reported by extension when async-std with attributes feature is used #755

Open
Gozala opened this issue Apr 2, 2020 · 5 comments

Comments

@Gozala
Copy link

Gozala commented Apr 2, 2020

Here is a minimal reproducible test case I've created to illustrate the issue. Running cargo check reports issues as expected:

cargo check
    Checking adder v0.1.0 (/Users/gozala/Projects/rls-vscode-bug-report/adder)
error: cannot find macro `println2` in this scope
  --> adder/src/main.rs:2:5
   |
2  |       println2!("Hello, world!");
   |       ^^^^^^^^ help: a macro with a similar name exists: `println`

error: aborting due to previous error

error: could not compile `adder`.

To learn more, run the command again with --verbose.

Plugin however does not display this error, instead it reports error in
Cargo.toml.

screenshot

VSCode settings are included in the repo .vscode/settings.json.

Including additional setup information:

rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/gozala/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)

active toolchain
----------------

nightly-x86_64-apple-darwin (default)
rustc 1.44.0-nightly (f509b26a7 2020-03-18)
@Gozala
Copy link
Author

Gozala commented Apr 2, 2020

I have enable set "rust-client.trace.server": "messages" and did see following errors in output

[Trace - 1:17:01 PM] Sending request 'textDocument/codeAction - (12)'.
[Trace - 1:17:01 PM] Sending request 'textDocument/documentSymbol - (13)'.
[Trace - 1:17:01 PM] Received response 'textDocument/codeAction - (12)' in 10ms.
[Trace - 1:17:01 PM] Received response 'textDocument/documentSymbol - (13)' in 21ms.
[Trace - 1:17:01 PM] Sending request 'textDocument/codeLens - (14)'.
[Trace - 1:17:01 PM] Received response 'textDocument/codeLens - (14)' in 5ms.
[Trace - 1:17:02 PM] Sending request 'textDocument/formatting - (15)'.
[Trace - 1:17:02 PM] Received response 'textDocument/formatting - (15)' in 4ms.
[Trace - 1:17:02 PM] Sending notification 'textDocument/didSave'.
[Trace - 1:17:02 PM] Sending request 'textDocument/codeLens - (16)'.
[Trace - 1:17:02 PM] Received response 'textDocument/codeLens - (16)' in 6ms.
[Trace - 1:17:11 PM] Sending request 'textDocument/codeAction - (17)'.
[Trace - 1:17:11 PM] Sending request 'textDocument/documentSymbol - (18)'.
[Trace - 1:17:11 PM] Received response 'textDocument/codeAction - (17)' in 9ms.
[Trace - 1:17:11 PM] Received response 'textDocument/documentSymbol - (18)' in 7ms.
[Trace - 1:17:11 PM] Sending request 'textDocument/codeLens - (19)'.
[Trace - 1:17:11 PM] Received response 'textDocument/codeLens - (19)' in 2ms.
[Trace - 1:17:12 PM] Sending request 'textDocument/documentHighlight - (20)'.
[Trace - 1:17:12 PM] Received response 'textDocument/documentHighlight - (20)' in 3ms.
[Trace - 1:17:12 PM] Sending request 'textDocument/codeAction - (21)'.
[Trace - 1:17:12 PM] Received response 'textDocument/codeAction - (21)' in 0ms.
[Trace - 1:17:12 PM] Sending request 'textDocument/hover - (22)'.
[Trace - 1:17:12 PM] Received response 'textDocument/hover - (22)' in 2ms.
[Trace - 1:17:13 PM] Sending request 'textDocument/documentHighlight - (23)'.
[Trace - 1:17:13 PM] Received response 'textDocument/documentHighlight - (23)' in 11ms.
[Trace - 1:17:13 PM] Sending request 'textDocument/codeAction - (24)'.
[Trace - 1:17:13 PM] Received response 'textDocument/codeAction - (24)' in 1ms.
[Trace - 1:17:14 PM] Sending notification 'textDocument/didChange'.
[Trace - 1:17:14 PM] Received notification 'window/progress'.
[Trace - 1:17:14 PM] Received notification 'window/progress'.
[Trace - 1:17:14 PM] Sending request 'textDocument/codeLens - (25)'.
[Trace - 1:17:14 PM] Received response 'textDocument/codeLens - (25)' in 1ms.
[Trace - 1:17:14 PM] Sending request 'textDocument/codeAction - (26)'.
[Trace - 1:17:14 PM] Sending request 'textDocument/documentSymbol - (27)'.
[Trace - 1:17:14 PM] Received response 'textDocument/codeAction - (26)' in 3ms.
[Trace - 1:17:14 PM] Received response 'textDocument/documentSymbol - (27)' in 5ms.
[Trace - 1:17:14 PM] Sending request 'textDocument/formatting - (28)'.
[Trace - 1:17:14 PM] Received response 'textDocument/formatting - (28)' in 1ms.
[Trace - 1:17:14 PM] Sending notification 'textDocument/didSave'.
{"message":"cannot lex `source_file` without source: /Users/gozala/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.3/src/lib.rs","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror: internal compiler error\u001b[0m\u001b[0m\u001b[1m: cannot lex `source_file` without source: /Users/gozala/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.3/src/lib.rs\u001b[0m\n\n"}
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f509b26a7 2020-03-18) running on x86_64-apple-darwin

note: compiler flags: -C prefer-dynamic -C debuginfo=2 --crate-type proc-macro

note: some of the compiler flags provided by cargo are hidden

{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m\n\n"}
[Trace - 1:17:14 PM] Received notification 'window/progress'.
[Trace - 1:17:14 PM] Received notification 'window/progress'.
[Trace - 1:17:14 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 1:17:14 PM] Received notification 'window/progress'.
[Trace - 1:17:15 PM] Sending request 'textDocument/codeLens - (29)'.
[Trace - 1:17:15 PM] Received response 'textDocument/codeLens - (29)' in 8ms.

@Gozala
Copy link
Author

Gozala commented Apr 2, 2020

If I do run Rust: cargo check task from the vscode then I do see error being picked up. But than again fixing that error or any changes really are not picked up unless I re-run the task.

@Gozala
Copy link
Author

Gozala commented Apr 2, 2020

It also appears that actual issue is async-attributes crate not the async-std, in other words changing dependencies to async-attributes = "1.1.1" exhibits same problem.

@Gozala
Copy link
Author

Gozala commented Apr 2, 2020

I found a way to reproduce this without vscode plugin that is:

RUSTFLAGS="-Z save-analysis" RUST_BACKTRACE=1 cargo check --verbose
       Fresh unicode-xid v0.2.0
       Fresh proc-macro2 v1.0.10
       Fresh quote v1.0.3
       Fresh syn v1.0.17
   Compiling async-attributes v1.1.1
     Running `rustc --crate-name async_attributes --edition=2018 /Users/gozala/.cargo/registry/src/github.com-1ecc6299db9ec823/async-attributes-1.1.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C debuginfo=2 -C metadata=8af7ea4b736f4259 -C extra-filename=-8af7ea4b736f4259 --out-dir /Users/gozala/Projects/ws-rs/target/debug/deps -L dependency=/Users/gozala/Projects/ws-rs/target/debug/deps --extern quote=/Users/gozala/Projects/ws-rs/target/debug/deps/libquote-b294abe5359d6464.rlib --extern syn=/Users/gozala/Projects/ws-rs/target/debug/deps/libsyn-5f2ec3f0dc10fbfc.rlib --extern proc_macro --cap-lints allow -Z save-analysis`
error: internal compiler error: cannot lex `source_file` without source: /Users/gozala/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.3/src/lib.rs

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::begin_panic
   8: rustc_errors::HandlerInner::bug
   9: rustc_errors::Handler::bug
  10: rustc_parse::lexer::StringReader::new
  11: rustc_parse::lexer::StringReader::retokenize
  12: rustc_save_analysis::span_utils::SpanUtils::sub_span_of_token
  13: rustc_save_analysis::dump_visitor::DumpVisitor::process_use_tree
  14: <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_item
  15: rustc_ast::visit::walk_expr
  16: rustc_ast::visit::walk_expr
  17: rustc_ast::visit::walk_expr
  18: rustc_ast::visit::walk_expr
  19: <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_expr
  20: rustc_ast::visit::walk_expr
  21: <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_item
  22: <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_ast::visit::Visitor>::visit_mod
  23: rustc_ast::visit::walk_crate
  24: rustc::dep_graph::graph::DepGraph::with_ignore
  25: rustc_session::utils::<impl rustc_session::session::Session>::time
  26: rustc::ty::context::tls::enter_global
  27: rustc_interface::interface::run_compiler_in_existing_thread_pool
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (f509b26a7 2020-03-18) running on x86_64-apple-darwin

note: compiler flags: -Z save-analysis -C prefer-dynamic -C debuginfo=2 --crate-type proc-macro

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to previous error

error: could not compile `async-attributes`.

Caused by:
  process didn't exit successfully: `rustc --crate-name async_attributes --edition=2018 /Users/gozala/.cargo/registry/src/github.com-1ecc6299db9ec823/async-attributes-1.1.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C debuginfo=2 -C metadata=8af7ea4b736f4259 -C extra-filename=-8af7ea4b736f4259 --out-dir /Users/gozala/Projects/ws-rs/target/debug/deps -L dependency=/Users/gozala/Projects/ws-rs/target/debug/deps --extern quote=/Users/gozala/Projects/ws-rs/target/debug/deps/libquote-b294abe5359d6464.rlib --extern syn=/Users/gozala/Projects/ws-rs/target/debug/deps/libsyn-5f2ec3f0dc10fbfc.rlib --extern proc_macro --cap-lints allow -Z save-analysis` (exit code: 101)

@Gozala
Copy link
Author

Gozala commented Apr 2, 2020

Discovered rust-lang/rust#69933 that seems related. It appears fixed, however downgrading to nightly-2020-03-09 as per discussion there seems to resolve issue on my end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant