ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.43k stars 2.81k forks source link

[RUST] YCM shows an error that doesn't appear when compiling #3831

Closed ajgae closed 3 years ago

ajgae commented 3 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

What I did

I am following this blog post: https://os.phil-opp.com/freestanding-rust-binary/.

  1. cargo new rust_os
  2. cd rust_os
  3. edit Cargo.toml, and append the [profile.dev] and [profile.release] sections, resulting in the following contents:
[package]
name = "rust_os"
version = "0.1.0"
authors = ["author <author@example.com>"]
edition = "2018"

[dependencies]

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"
  1. vim -Nu /path/to/YCM/ycm_vimrc_minimal
  2. :edit src/main.rs
  3. edit the contents of main.rs to match the following:
#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[no_mangle]
pub extern "C" fn _start() -> ! {
    loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    loop {}
}

What I expected to happen

The output of cargo rustc -- -C link-arg=-nostartfiles should match the errors indicated in the buffer by YCM, that is, show no errors or warnings.

What actually happened

The output of cargo rustc -- -C link-arg=-nostartfiles completes successfully, showing no errors or warnings, as expected. However, YCM indicates the following error on line 12 (obtained via :YcmShowDetailedDiagnostic):

found duplicate lang item `panic_impl`
the lang item is first defined in crate `std` (which `test` depends on)
first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib
second definition in the local crate (`rust_os`)

It seems some part of the YCM rust analyzer makes YCM think that a panic handler has been defined somewhere else in the freshly created rust_os codebase, when clearly it hasn't.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 15 2020 16:46:37)
Included patches: 1-1989
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl/dyn
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl/dyn          +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           +ruby/dyn          +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_17wlnvzq.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.9.0
-- Server has Clang support compiled in: True
-- Clang version: clang version 11.0.0 (git@github.com:ycm-core/llvm ff1d9b2bb8f62c1924db137b544598b8e974ada8)
-- No extra configuration file found
-- Rust completer debug information:
--   Rust Language Server running
--   Rust Language Server process ID: 25777
--   Rust Language Server executable: ['/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/bin/rust-analyzer']
--   Rust Language Server logfiles:
--     /tmp/rust_language_server_stderr83wy787p.log
--   Rust Language Server Server State: Initialized
--   Rust Language Server Project Directory: /home/adel/repos/rust-os
--   Rust Language Server Settings: {}
--   Rust Language Server Project State: ready
--   Rust Language Server Version: 0d03fe6
--   Rust Language Server Rust Root: /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer
-- Server running at: http://127.0.0.1:33555
-- Server process ID: 25736
-- Server logfiles:
--   /tmp/ycmd_33555_stdout_e1d496_9.log
--   /tmp/ycmd_33555_stderr_k378dq9u.log

Output of YcmDiags

src/main.rs|12 col 1 error| found duplicate lang item `panic_impl` the lang item is first defined in crate `std` (which `test` depends on) first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib second definition in the local crate (`rust_os`) [E0152]                                         

Output of git rev-parse HEAD in YouCompleteMe installation directory

e252f6512f1f4a9a515dfc42401baf30a5fe72c8

Contents of YCM, ycmd and completion engine logfiles

/tmp/rust_language_server_stderr2o9avkkd.log

[INFO rust_analyzer] server will start
[INFO rust_analyzer] InitializeParams: {"capabilities":{"experimental":{"statusNotification":true},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"]},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"contentFormat":["plaintext","markdown"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true}},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"documentChanges":true}}},"initializationOptions":{},"processId":2019,"rootPath":"/home/adel/repos/rust-os","rootUri":"file:///home/adel/repos/rust-os"}
[INFO rust_analyzer::config] Config::update({})
[INFO rust_analyzer] discovered projects: [CargoToml(AbsPathBuf("/home/adel/repos/rust-os/Cargo.toml"))]
[INFO rust_analyzer::main_loop] initial config: Config {
    client_caps: ClientCapsConfig {
        location_link: false,
        line_folding_only: false,
        hierarchical_symbols: false,
        code_action_literals: true,
        work_done_progress: false,
        code_action_group: false,
        resolve_code_action: false,
        hover_actions: false,
        status_notification: true,
        signature_help_label_offsets: true,
    },
    publish_diagnostics: true,
    diagnostics: DiagnosticsConfig {
        disable_experimental: false,
        disabled: {},
    },
    diagnostics_map: DiagnosticsMapConfig {
        warnings_as_info: [],
        warnings_as_hint: [],
    },
    lru_capacity: None,
    proc_macro_srv: None,
    files: FilesConfig {
        watcher: Notify,
        exclude: [],
    },
    notifications: NotificationsConfig {
        cargo_toml_not_found: true,
    },
    cargo_autoreload: true,
    cargo: CargoConfig {
        no_default_features: false,
        all_features: false,
        features: [],
        load_out_dirs_from_check: false,
        target: None,
    },
    rustfmt: Rustfmt {
        extra_args: [],
    },
    flycheck: Some(
        CargoCommand {
            command: "check",
            target_triple: None,
            all_targets: true,
            no_default_features: false,
            all_features: false,
            features: [],
            extra_args: [],
        },
    ),
    inlay_hints: InlayHintsConfig {
        type_hints: true,
        parameter_hints: true,
        chaining_hints: true,
        max_length: None,
    },
    completion: CompletionConfig {
        enable_postfix_completions: true,
        add_call_parenthesis: true,
        add_call_argument_snippets: true,
        snippet_cap: None,
    },
    assist: AssistConfig {
        snippet_cap: None,
        allowed: None,
    },
    call_info_full: true,
    lens: LensConfig {
        run: true,
        debug: true,
        implementations: true,
    },
    hover: HoverConfig {
        implementations: true,
        run: true,
        debug: true,
        goto_type_def: true,
    },
    with_sysroot: true,
    linked_projects: [
        ProjectManifest(
            CargoToml(
                AbsPathBuf(
                    "/home/adel/repos/rust-os/Cargo.toml",
                ),
            ),
        ),
    ],
    root_path: AbsPathBuf(
        "/home/adel/repos/rust-os",
    ),
}
[INFO rust_analyzer::reload] will fetch workspaces
[INFO rust_analyzer::main_loop] handle_event(Notification(Notification { method: "workspace/didChangeConfiguration", params: Object({"settings": Object({})}) }))
[INFO rust_analyzer::main_loop] handle_event(Notification { method: "textDocument/didOpen" })
[INFO rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(U64(0)), result: None, error: None }))
[INFO rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(U64(1)), result: Some(Array([Null])), error: None }))
[DEBUG rust_analyzer::main_loop] config update response: 'Response { id: RequestId(U64(1)), result: Some(Array([Null])), error: None }
[INFO rust_analyzer::config] Config::update(null)
[INFO rust_analyzer::reload] did fetch workspaces [Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]
[INFO rust_analyzer::main_loop] handle_event(Workspaces([Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]))
[INFO rust_analyzer::reload] will switch workspaces: [Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]
[INFO rust_analyzer::reload] did switch workspaces
[WARN rust_analyzer::main_loop] overly long loop turn: 105.304025ms
[INFO rust_analyzer::main_loop] handle_event(Progress { n_total: 11, n_done: 0 })
[TRACE rust_analyzer::main_loop] updating notifications for [FileId(0)]
[INFO rust_analyzer::main_loop] handle_event(Progress(DidStart))
[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: "/home/adel/repos/rust-os", diagnostic: Diagnostic { message: "found duplicate lang item `panic_impl`", code: Some(DiagnosticCode { code: "E0152", explanation: Some("A lang item was redefined.\n\nErroneous code example:\n\n```compile_fail,E0152\n#![feature(lang_items)]\n\n#[lang = \"owned_box\"]\nstruct Foo; // error: duplicate lang item found: `owned_box`\n```\n\nLang items are already implemented in the standard library. Unless you are\nwriting a free-standing application (e.g., a kernel), you do not need to provide\nthem yourself.\n\nYou can build a free-standing crate by adding `#![no_std]` to the crate\nattributes:\n\n```ignore (only-for-syntax-highlight)\n#![no_std]\n```\n\nSee also the [unstable book][1].\n\n[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib\n"), __do_not_match_exhaustively: () }), level: Error, spans: [DiagnosticSpan { file_name: "src/main.rs", byte_start: 132, byte_end: 164, line_start: 12, line_end: 12, column_start: 1, column_end: 33, is_primary: true, text: [DiagnosticSpanLine { text: "fn panic(_info: &PanicInfo) -> ! {", highlight_start: 1, highlight_end: 33, __do_not_match_exhaustively: () }], label: None, suggested_replacement: None, suggestion_applicability: None, expansion: None, __do_not_match_exhaustively: () }], children: [Diagnostic { message: "the lang item is first defined in crate `std` (which `test` depends on)", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }, Diagnostic { message: "first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }, Diagnostic { message: "second definition in the local crate (`rust_os`)", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }], rendered: Some("error[E0152]: found duplicate lang item `panic_impl`\n  --> src/main.rs:12:1\n   |\n12 | fn panic(_info: &PanicInfo) -> ! {\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: the lang item is first defined in crate `std` (which `test` depends on)\n   = note: first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\n   = note: second definition in the local crate (`rust_os`)\n\n"), __do_not_match_exhaustively: () } })
[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: "/home/adel/repos/rust-os", diagnostic: Diagnostic { message: "aborting due to previous error", code: None, level: Error, spans: [], children: [], rendered: Some("error: aborting due to previous error\n\n"), __do_not_match_exhaustively: () } })
[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: "/home/adel/repos/rust-os", diagnostic: Diagnostic { message: "For more information about this error, try `rustc --explain E0152`.", code: None, level: Unknown, spans: [], children: [], rendered: Some("For more information about this error, try `rustc --explain E0152`.\n"), __do_not_match_exhaustively: () } })
[INFO rust_analyzer::main_loop] handle_event(Progress(DidFinish(Ok(()))))
[INFO rust_analyzer::main_loop] handle_event(Diagnostics([(FileId(0), [])]))
[INFO rust_analyzer::main_loop] handle_event(Unit)

/tmp/ycm_hv4vv4uy.log

2020-12-23 21:23:41,432 - DEBUG - GET b'http://127.0.0.1:45363/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'ShCoQOLgRB40QDrUwn8bPQj0Dvn63Ev7IgyHq3wNpMo='}
2020-12-23 21:23:41,500 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=45363): Max retries exceeded with url: /ready (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd7598c09a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-12-23 21:23:41,600 - DEBUG - GET b'http://127.0.0.1:45363/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'ShCoQOLgRB40QDrUwn8bPQj0Dvn63Ev7IgyHq3wNpMo='}
2020-12-23 21:23:41,602 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=45363): Max retries exceeded with url: /ready (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd7590644f0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-12-23 21:23:41,702 - DEBUG - GET b'http://127.0.0.1:45363/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'ShCoQOLgRB40QDrUwn8bPQj0Dvn63Ev7IgyHq3wNpMo='}
2020-12-23 21:23:41,710 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:23:41,712 - DEBUG - GET b'http://127.0.0.1:45363/signature_help_available' ({'subserver': 'rust'})
{'content-type': 'application/json', 'x-ycm-hmac': b'o+dVk5mgfa4cazlG82ihy/kzyua09FIGjJE1ZcC5xko='}
2020-12-23 21:23:41,715 - DEBUG - POST b'http://127.0.0.1:45363/event_notification'
{'content-type': 'application/json', 'x-ycm-hmac': b'sjhBPgHz7+GDBO8vtoInA+o3itChGNY5QaAxrQDFEi0='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}, "event_name": "BufferVisit"}'
2020-12-23 21:23:41,720 - DEBUG - POST b'http://127.0.0.1:45363/event_notification'
{'content-type': 'application/json', 'x-ycm-hmac': b'uUPCPupJOLhvvWK120MPbr+cgr3SDqrK0UhHKDP6b38='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}, "event_name": "FileReadyToParse"}'
2020-12-23 21:23:41,812 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:41,825 - DEBUG - POST b'http://127.0.0.1:45363/semantic_completion_available'
{'content-type': 'application/json', 'x-ycm-hmac': b'CU+FJIlbDOze1yk6LyMK0rW+QDRSN1WOUaMmwe+mkmk='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}, "filetypes": "rust"}'
2020-12-23 21:23:41,831 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:23:41,832 - DEBUG - RX: <Response [200]>
{}
2020-12-23 21:23:42,025 - DEBUG - RX: <Response [200]>
[{"message":"Initializing Rust completer: {'status': 'loading'}"}]
2020-12-23 21:23:42,026 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:42,128 - DEBUG - RX: <Response [200]>
[{"message":"Initializing Rust completer: {'status': 'ready'}"}]
2020-12-23 21:23:42,128 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:42,230 - DEBUG - RX: <Response [200]>
[{"diagnostics":[{"ranges":[{"start":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"end":{"line_num":12,"column_num":33,"filepath":"/home/adel/repos/rust-os/src/main.rs"}}],"location":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"location_extent":{"start":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"end":{"line_num":12,"column_num":33,"filepath":"/home/adel/repos/rust-os/src/main.rs"}},"text":"found duplicate lang item `panic_impl`\nthe lang item is first defined in crate `std` (which `test` depends on)\nfirst definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\nsecond definition in the local crate (`rust_os`) [E0152]","kind":"ERROR","fixit_available":false}],"filepath":"/home/adel/repos/rust-os/src/main.rs"}]
2020-12-23 21:23:42,231 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:45,498 - DEBUG - POST b'http://127.0.0.1:45363/debug_info'
{'content-type': 'application/json', 'x-ycm-hmac': b'hs1FcTuju66/hN/lFqcsOBwbsGvMDCrokHsIRgn2aqY='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:45,507 - DEBUG - RX: <Response [200]>
{"python":{"executable":"/usr/bin/python3","version":"3.9.1"},"clang":{"has_support":true,"version":"clang version 11.0.0 (git@github.com:ycm-core/llvm ff1d9b2bb8f62c1924db137b544598b8e974ada8)"},"extra_conf":{"path":null,"is_loaded":false},"completer":{"name":"Rust","servers":[{"name":"Rust Language Server","is_running":true,"executable":["/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/bin/rust-analyzer"],"address":null,"port":null,"pid":2060,"logfiles":["/tmp/rust_language_server_stderr2o9avkkd.log"],"extras":[{"key":"Server State","value":"Initialized"},{"key":"Project Directory","value":"/home/adel/repos/rust-os"},{"key":"Settings","value":"{}"},{"key":"Project State","value":"ready"},{"key":"Version","value":"0d03fe6"},{"key":"Rust Root","value":"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer"}]}],"items":[]}}
2020-12-23 21:23:47,526 - DEBUG - RX: <Response [200]>
[{"diagnostics":[{"ranges":[{"start":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"end":{"line_num":12,"column_num":33,"filepath":"/home/adel/repos/rust-os/src/main.rs"}}],"location":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"location_extent":{"start":{"line_num":12,"column_num":1,"filepath":"/home/adel/repos/rust-os/src/main.rs"},"end":{"line_num":12,"column_num":33,"filepath":"/home/adel/repos/rust-os/src/main.rs"}},"text":"found duplicate lang item `panic_impl`\nthe lang item is first defined in crate `std` (which `test` depends on)\nfirst definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\nsecond definition in the local crate (`rust_os`) [E0152]","kind":"ERROR","fixit_available":false}],"filepath":"/home/adel/repos/rust-os/src/main.rs"}]
2020-12-23 21:23:47,527 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:23:49,742 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'PYYYQL9XNIIsaqKTQctPVyXi9Jf8BjBDvBmUSvlZw2o='}
b'{"filepath": "/tmp/rust_language_server_stderr2o9avkkd.log", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/tmp/rust_language_server_stderr2o9avkkd.log": {"contents": "[INFO rust_analyzer] server will start\\n[INFO rust_analyzer] InitializeParams: {\\"capabilities\\":{\\"experimental\\":{\\"statusNotification\\":true},\\"textDocument\\":{\\"codeAction\\":{\\"codeActionLiteralSupport\\":{\\"codeActionKind\\":{\\"valueSet\\":[\\"\\",\\"quickfix\\",\\"refactor\\",\\"refactor.extract\\",\\"refactor.inline\\",\\"refactor.rewrite\\",\\"source\\",\\"source.organizeImports\\"]}}},\\"completion\\":{\\"completionItem\\":{\\"documentationFormat\\":[\\"plaintext\\",\\"markdown\\"]},\\"completionItemKind\\":{\\"valueSet\\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},\\"hover\\":{\\"contentFormat\\":[\\"plaintext\\",\\"markdown\\"]},\\"signatureHelp\\":{\\"signatureInformation\\":{\\"documentationFormat\\":[\\"plaintext\\",\\"markdown\\"],\\"parameterInformation\\":{\\"labelOffsetSupport\\":true}}},\\"synchronization\\":{\\"didSave\\":true}},\\"workspace\\":{\\"applyEdit\\":true,\\"configuration\\":true,\\"didChangeWatchedFiles\\":{\\"dynamicRegistration\\":true},\\"symbol\\":{\\"symbolKind\\":{\\"valueSet\\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},\\"workspaceEdit\\":{\\"documentChanges\\":true}}},\\"initializationOptions\\":{},\\"processId\\":2019,\\"rootPath\\":\\"/home/adel/repos/rust-os\\",\\"rootUri\\":\\"file:///home/adel/repos/rust-os\\"}\\n[INFO rust_analyzer::config] Config::update({})\\n[INFO rust_analyzer] discovered projects: [CargoToml(AbsPathBuf(\\"/home/adel/repos/rust-os/Cargo.toml\\"))]\\n[INFO rust_analyzer::main_loop] initial config: Config {\\n    client_caps: ClientCapsConfig {\\n        location_link: false,\\n        line_folding_only: false,\\n        hierarchical_symbols: false,\\n        code_action_literals: true,\\n        work_done_progress: false,\\n        code_action_group: false,\\n        resolve_code_action: false,\\n        hover_actions: false,\\n        status_notification: true,\\n        signature_help_label_offsets: true,\\n    },\\n    publish_diagnostics: true,\\n    diagnostics: DiagnosticsConfig {\\n        disable_experimental: false,\\n        disabled: {},\\n    },\\n    diagnostics_map: DiagnosticsMapConfig {\\n        warnings_as_info: [],\\n        warnings_as_hint: [],\\n    },\\n    lru_capacity: None,\\n    proc_macro_srv: None,\\n    files: FilesConfig {\\n        watcher: Notify,\\n        exclude: [],\\n    },\\n    notifications: NotificationsConfig {\\n        cargo_toml_not_found: true,\\n    },\\n    cargo_autoreload: true,\\n    cargo: CargoConfig {\\n        no_default_features: false,\\n        all_features: false,\\n        features: [],\\n        load_out_dirs_from_check: false,\\n        target: None,\\n    },\\n    rustfmt: Rustfmt {\\n        extra_args: [],\\n    },\\n    flycheck: Some(\\n        CargoCommand {\\n            command: \\"check\\",\\n            target_triple: None,\\n            all_targets: true,\\n            no_default_features: false,\\n            all_features: false,\\n            features: [],\\n            extra_args: [],\\n        },\\n    ),\\n    inlay_hints: InlayHintsConfig {\\n        type_hints: true,\\n        parameter_hints: true,\\n        chaining_hints: true,\\n        max_length: None,\\n    },\\n    completion: CompletionConfig {\\n        enable_postfix_completions: true,\\n        add_call_parenthesis: true,\\n        add_call_argument_snippets: true,\\n        snippet_cap: None,\\n    },\\n    assist: AssistConfig {\\n        snippet_cap: None,\\n        allowed: None,\\n    },\\n    call_info_full: true,\\n    lens: LensConfig {\\n        run: true,\\n        debug: true,\\n        implementations: true,\\n    },\\n    hover: HoverConfig {\\n        implementations: true,\\n        run: true,\\n        debug: true,\\n        goto_type_def: true,\\n    },\\n    with_sysroot: true,\\n    linked_projects: [\\n        ProjectManifest(\\n            CargoToml(\\n                AbsPathBuf(\\n                    \\"/home/adel/repos/rust-os/Cargo.toml\\",\\n                ),\\n            ),\\n        ),\\n    ],\\n    root_path: AbsPathBuf(\\n        \\"/home/adel/repos/rust-os\\",\\n    ),\\n}\\n[INFO rust_analyzer::reload] will fetch workspaces\\n[INFO rust_analyzer::main_loop] handle_event(Notification(Notification { method: \\"workspace/didChangeConfiguration\\", params: Object({\\"settings\\": Object({})}) }))\\n[INFO rust_analyzer::main_loop] handle_event(Notification { method: \\"textDocument/didOpen\\" })\\n[INFO rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(U64(0)), result: None, error: None }))\\n[INFO rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(U64(1)), result: Some(Array([Null])), error: None }))\\n[DEBUG rust_analyzer::main_loop] config update response: \'Response { id: RequestId(U64(1)), result: Some(Array([Null])), error: None }\\n[INFO rust_analyzer::config] Config::update(null)\\n[INFO rust_analyzer::reload] did fetch workspaces [Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]\\n[INFO rust_analyzer::main_loop] handle_event(Workspaces([Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]))\\n[INFO rust_analyzer::reload] will switch workspaces: [Ok(Cargo { n_packages: 1, n_sysroot_crates: 10 })]\\n[INFO rust_analyzer::reload] did switch workspaces\\n[WARN rust_analyzer::main_loop] overly long loop turn: 105.304025ms\\n[INFO rust_analyzer::main_loop] handle_event(Progress { n_total: 11, n_done: 0 })\\n[TRACE rust_analyzer::main_loop] updating notifications for [FileId(0)]\\n[INFO rust_analyzer::main_loop] handle_event(Progress(DidStart))\\n[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: \\"/home/adel/repos/rust-os\\", diagnostic: Diagnostic { message: \\"found duplicate lang item `panic_impl`\\", code: Some(DiagnosticCode { code: \\"E0152\\", explanation: Some(\\"A lang item was redefined.\\\\n\\\\nErroneous code example:\\\\n\\\\n```compile_fail,E0152\\\\n#![feature(lang_items)]\\\\n\\\\n#[lang = \\\\\\"owned_box\\\\\\"]\\\\nstruct Foo; // error: duplicate lang item found: `owned_box`\\\\n```\\\\n\\\\nLang items are already implemented in the standard library. Unless you are\\\\nwriting a free-standing application (e.g., a kernel), you do not need to provide\\\\nthem yourself.\\\\n\\\\nYou can build a free-standing crate by adding `#![no_std]` to the crate\\\\nattributes:\\\\n\\\\n```ignore (only-for-syntax-highlight)\\\\n#![no_std]\\\\n```\\\\n\\\\nSee also the [unstable book][1].\\\\n\\\\n[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib\\\\n\\"), __do_not_match_exhaustively: () }), level: Error, spans: [DiagnosticSpan { file_name: \\"src/main.rs\\", byte_start: 132, byte_end: 164, line_start: 12, line_end: 12, column_start: 1, column_end: 33, is_primary: true, text: [DiagnosticSpanLine { text: \\"fn panic(_info: &PanicInfo) -> ! {\\", highlight_start: 1, highlight_end: 33, __do_not_match_exhaustively: () }], label: None, suggested_replacement: None, suggestion_applicability: None, expansion: None, __do_not_match_exhaustively: () }], children: [Diagnostic { message: \\"the lang item is first defined in crate `std` (which `test` depends on)\\", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }, Diagnostic { message: \\"first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\\", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }, Diagnostic { message: \\"second definition in the local crate (`rust_os`)\\", code: None, level: Note, spans: [], children: [], rendered: None, __do_not_match_exhaustively: () }], rendered: Some(\\"error[E0152]: found duplicate lang item `panic_impl`\\\\n  --> src/main.rs:12:1\\\\n   |\\\\n12 | fn panic(_info: &PanicInfo) -> ! {\\\\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\\\n   |\\\\n   = note: the lang item is first defined in crate `std` (which `test` depends on)\\\\n   = note: first definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\\\\n   = note: second definition in the local crate (`rust_os`)\\\\n\\\\n\\"), __do_not_match_exhaustively: () } })\\n[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: \\"/home/adel/repos/rust-os\\", diagnostic: Diagnostic { message: \\"aborting due to previous error\\", code: None, level: Error, spans: [], children: [], rendered: Some(\\"error: aborting due to previous error\\\\n\\\\n\\"), __do_not_match_exhaustively: () } })\\n[INFO rust_analyzer::main_loop] handle_event(AddDiagnostic { workspace_root: \\"/home/adel/repos/rust-os\\", diagnostic: Diagnostic { message: \\"For more information about this error, try `rustc --explain E0152`.\\", code: None, level: Unknown, spans: [], children: [], rendered: Some(\\"For more information about this error, try `rustc --explain E0152`.\\\\n\\"), __do_not_match_exhaustively: () } })\\n[INFO rust_analyzer::main_loop] handle_event(Progress(DidFinish(Ok(()))))\\n[INFO rust_analyzer::main_loop] handle_event(Diagnostics([(FileId(0), [])]))\\n[INFO rust_analyzer::main_loop] handle_event(Unit)\\n", "filetypes": ["ycm_nofiletype"]}}}'
2020-12-23 21:23:49,846 - DEBUG - RX: <Response [200]>
false
2020-12-23 21:24:33,137 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:24:33,138 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:24:36,937 - DEBUG - POST b'http://127.0.0.1:45363/debug_info'
{'content-type': 'application/json', 'x-ycm-hmac': b'hs1FcTuju66/hN/lFqcsOBwbsGvMDCrokHsIRgn2aqY='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:24:36,957 - DEBUG - RX: <Response [200]>
{"python":{"executable":"/usr/bin/python3","version":"3.9.1"},"clang":{"has_support":true,"version":"clang version 11.0.0 (git@github.com:ycm-core/llvm ff1d9b2bb8f62c1924db137b544598b8e974ada8)"},"extra_conf":{"path":null,"is_loaded":false},"completer":{"name":"Rust","servers":[{"name":"Rust Language Server","is_running":true,"executable":["/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/bin/rust-analyzer"],"address":null,"port":null,"pid":2060,"logfiles":["/tmp/rust_language_server_stderr2o9avkkd.log"],"extras":[{"key":"Server State","value":"Initialized"},{"key":"Project Directory","value":"/home/adel/repos/rust-os"},{"key":"Settings","value":"{}"},{"key":"Project State","value":"ready"},{"key":"Version","value":"0d03fe6"},{"key":"Rust Root","value":"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer"}]}],"items":[]}}
2020-12-23 21:24:43,165 - DEBUG - POST b'http://127.0.0.1:45363/defined_subcommands'
{'content-type': 'application/json', 'x-ycm-hmac': b'OZl6HY59ryn1auiXvHjItR2AdNaxm4x6BFkhM9sGjC8='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:24:43,174 - DEBUG - RX: <Response [200]>
["FixIt","Format","GetDoc","GetType","GoTo","GoToDeclaration","GoToDefinition","GoToImplementation","GoToReferences","GoToSymbol","GoToType","RefactorRename","RestartServer"]
2020-12-23 21:24:43,175 - DEBUG - POST b'http://127.0.0.1:45363/run_completer_command'
{'content-type': 'application/json', 'x-ycm-hmac': b'Fejd7pjRRGUU0izfBbUhypzLvkc6XK8v1c0lTwM0rRI='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}, "options": {"tab_size": 4, "insert_spaces": true}, "command_arguments": ["GetDoc"]}'
2020-12-23 21:24:43,211 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:24:43,212 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:24:43,279 - DEBUG - RX: <Response [500]>
{"exception":{"TYPE":"RuntimeError"},"message":"No documentation available.","traceback":"Traceback (most recent call last):\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/rust/rust_completer.py\", line 191, in GetDoc\n    hover_response = self.GetHoverResponse( request_data )\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py\", line 2343, in GetHoverResponse\n    raise NoHoverInfoException( NO_HOVER_INFORMATION )\nycmd.completers.language_server.language_server_completer.NoHoverInfoException: No hover information.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py\", line 868, in _handle\n    return route.call(**args)\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py\", line 1748, in wrapper\n    rv = callback(*a, **ka)\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/watchdog_plugin.py\", line 97, in wrapper\n    return callback( *args, **kwargs )\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/hmac_plugin.py\", line 62, in wrapper\n    body = callback( *args, **kwargs )\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/handlers.py\", line 94, in RunCompleterCommand\n    return _JsonResponse( completer.OnUserCommand(\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/completer.py\", line 472, in OnUserCommand\n    return command( self, request_data, arguments[ 1: ] )\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py\", line 1648, in <lambda>\n    lambda self, request_data, args: self.GetDoc( request_data )\n  File \"/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/rust/rust_completer.py\", line 193, in GetDoc\n    raise RuntimeError( 'No documentation available.' )\nRuntimeError: No documentation available.\n"}
2020-12-23 21:24:43,279 - ERROR - Error while handling server response
Traceback (most recent call last):
  File "/home/adel/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 73, in HandleFuture
    return _JsonFromFuture( future )
  File "/home/adel/.vim/bundle/YouCompleteMe/python/ycm/client/base_request.py", line 256, in _JsonFromFuture
    raise MakeServerException( response.json() )
ycmd.responses.ServerError: RuntimeError: No documentation available.
2020-12-23 21:24:53,274 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:24:53,275 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'
2020-12-23 21:25:03,335 - DEBUG - RX: <Response [200]>
true
2020-12-23 21:25:03,336 - DEBUG - POST b'http://127.0.0.1:45363/receive_messages'
{'content-type': 'application/json', 'x-ycm-hmac': b'620XUNcCf5T9kdbP/BM87Du4mOdHmCfxQDv5R3ThCgM='}
b'{"filepath": "/home/adel/repos/rust-os/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/adel/repos/rust-os", "file_data": {"/home/adel/repos/rust-os/src/main.rs": {"contents": "#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n", "filetypes": ["rust"]}}}'

/tmp/ycmd_45363_stderr__nyq4x9n.log

2020-12-23 21:23:41,581 - DEBUG - No global extra conf, not calling method YcmCorePreload
2020-12-23 21:23:41,628 - INFO - Completion config: 50, detailing -1 candiates
2020-12-23 21:23:41,628 - INFO - Completion config: 50, detailing -1 candiates
2020-12-23 21:23:41,629 - INFO - Completion config: 50, detailing -1 candiates
2020-12-23 21:23:41,629 - INFO - Completion config: 50, detailing -1 candiates
2020-12-23 21:23:41,707 - INFO - Received ready request
2020-12-23 21:23:41,716 - INFO - Received signature help available request
2020-12-23 21:23:41,719 - INFO - Completion config: 50, detailing -1 candiates
2020-12-23 21:23:41,721 - INFO - Received event notification
2020-12-23 21:23:41,722 - DEBUG - Event name: BufferVisit
2020-12-23 21:23:41,726 - INFO - Received event notification
2020-12-23 21:23:41,726 - DEBUG - Event name: FileReadyToParse
2020-12-23 21:23:41,726 - INFO - Adding buffer identifiers for file: /home/adel/repos/rust-os/src/main.rs
2020-12-23 21:23:41,729 - INFO - Starting Rust Language Server: ['/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/bin/rust-analyzer']
2020-12-23 21:23:41,738 - INFO - Rust Language Server started with PID 2060
2020-12-23 21:23:41,740 - DEBUG - TX: Sending message: b'Content-Length: 1115\r\n\r\n{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"experimental":{"statusNotification":true},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"]},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"contentFormat":["plaintext","markdown"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true}},"workspace":{"applyEdit":true,"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"documentChanges":true}}},"initializationOptions":{},"processId":2019,"rootPath":"/home/adel/repos/rust-os","rootUri":"file:///home/adel/repos/rust-os"}}'
2020-12-23 21:23:41,743 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"]},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"triggerCharacters":[":","."]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">"]},"documentSymbolProvider":true,"experimental":{"joinLines":true,"onEnter":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["documentation","declaration","definition","static","abstract","deprecated","readonly","constant","controlFlow","injected","mutable","consuming","unsafe","attribute"],"tokenTypes":["comment","keyword","string","number","regexp","operator","namespace","type","struct","class","interface","enum","enumMember","typeParameter","function","member","property","macro","variable","parameter","attribute","boolean","builtinType","escapeSequence","formatSpecifier","generic","lifetime","punctuation","selfKeyword","typeAlias","union","unresolvedReference"]},"range":true},"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":{"change":2,"openClose":true,"save":{}},"typeDefinitionProvider":true,"workspaceSymbolProvider":true},"serverInfo":{"name":"rust-analyzer","version":"0d03fe6"}}}'
2020-12-23 21:23:41,743 - INFO - None: Language server does not require resolve request
2020-12-23 21:23:41,743 - INFO - None: Language server requires sync type of Incremental
2020-12-23 21:23:41,744 - DEBUG - rust: Server declares trigger characters: [':', '.']
2020-12-23 21:23:41,744 - DEBUG - rust: Server declares signature trigger characters: ['(', ',']
2020-12-23 21:23:41,744 - INFO - rust: Using characters for signature triggers: (,,
2020-12-23 21:23:41,745 - DEBUG - TX: Sending notification: b'Content-Length: 52\r\n\r\n{"jsonrpc":"2.0","method":"initialized","params":{}}'
2020-12-23 21:23:41,745 - DEBUG - TX: Sending notification: b'Content-Length: 86\r\n\r\n{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}'
2020-12-23 21:23:41,746 - DEBUG - Refreshing file /home/adel/repos/rust-os/src/main.rs: State is Open/action Open
2020-12-23 21:23:41,746 - DEBUG - TX: Sending notification: b'Content-Length: 368\r\n\r\n{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"#![no_std]\\n#![no_main]\\n\\nuse core::panic::PanicInfo;\\n\\n#[no_mangle]\\npub extern \\"C\\" fn _start() -> ! {\\n    loop {}\\n}\\n\\n#[panic_handler]\\nfn panic(_info: &PanicInfo) -> ! {\\n    loop {}\\n}\\n","uri":"file:///home/adel/repos/rust-os/src/main.rs","version":1}}}'
2020-12-23 21:23:41,752 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":0,"method":"client/registerCapability","params":{"registrations":[{"id":"textDocument/didSave","method":"textDocument/didSave","registerOptions":{"documentSelector":[{"pattern":"**/*.rs"},{"pattern":"**/Cargo.toml"},{"pattern":"**/Cargo.lock"}],"includeText":false}}]}}'
2020-12-23 21:23:41,752 - DEBUG - TX: Sending response: b'Content-Length: 38\r\n\r\n{"id":0,"jsonrpc":"2.0","result":null}'
2020-12-23 21:23:41,752 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]}}'
2020-12-23 21:23:41,753 - DEBUG - TX: Sending response: b'Content-Length: 40\r\n\r\n{"id":1,"jsonrpc":"2.0","result":[null]}'
2020-12-23 21:23:41,829 - INFO - Received filetype completion available request
2020-12-23 21:23:41,951 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"rust-analyzer/status","params":{"status":"loading"}}'
2020-12-23 21:23:41,957 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"rust-analyzer/status","params":{"status":"ready"}}'
2020-12-23 21:23:42,137 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"E0152","message":"found duplicate lang item `panic_impl`\\nthe lang item is first defined in crate `std` (which `test` depends on)\\nfirst definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\\nsecond definition in the local crate (`rust_os`)","range":{"end":{"character":32,"line":11},"start":{"character":0,"line":11}},"severity":1,"source":"rustc"}],"uri":"file:///home/adel/repos/rust-os/src/main.rs","version":1}}'
2020-12-23 21:23:45,500 - INFO - Received debug info request
2020-12-23 21:23:47,461 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"E0152","message":"found duplicate lang item `panic_impl`\\nthe lang item is first defined in crate `std` (which `test` depends on)\\nfirst definition in `std` loaded from /home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-edfba68bd3501617.rlib\\nsecond definition in the local crate (`rust_os`)","range":{"end":{"character":32,"line":11},"start":{"character":0,"line":11}},"severity":1,"source":"rustc"}],"uri":"file:///home/adel/repos/rust-os/src/main.rs","version":1}}'
2020-12-23 21:24:36,942 - INFO - Received debug info request
2020-12-23 21:24:43,170 - INFO - Received defined subcommands request
2020-12-23 21:24:43,170 - INFO - No support for ExecuteCommand command in server for rust
2020-12-23 21:24:43,170 - INFO - Found codeActionProvider support for command FixIt in rust
2020-12-23 21:24:43,171 - INFO - Found definitionProvider support for command GoToDefinition in rust
2020-12-23 21:24:43,171 - INFO - Found definitionProvider support for command GoToDeclaration in rust
2020-12-23 21:24:43,171 - INFO - Found definitionProvider support for command GoTo in rust
2020-12-23 21:24:43,171 - INFO - Found typeDefinitionProvider support for command GoToType in rust
2020-12-23 21:24:43,171 - INFO - Found implementationProvider support for command GoToImplementation in rust
2020-12-23 21:24:43,171 - INFO - Found referencesProvider support for command GoToReferences in rust
2020-12-23 21:24:43,171 - INFO - Found renameProvider support for command RefactorRename in rust
2020-12-23 21:24:43,171 - INFO - Found documentFormattingProvider support for command Format in rust
2020-12-23 21:24:43,171 - INFO - Found workspaceSymbolProvider support for command GoToSymbol in rust
2020-12-23 21:24:43,171 - INFO - Always supporting StopServer for rust
2020-12-23 21:24:43,171 - INFO - Always supporting RestartServer for rust
2020-12-23 21:24:43,171 - INFO - Always supporting GetDoc for rust
2020-12-23 21:24:43,172 - INFO - Always supporting GetType for rust
2020-12-23 21:24:43,179 - INFO - Received command request
2020-12-23 21:24:43,179 - INFO - No support for ExecuteCommand command in server for rust
2020-12-23 21:24:43,179 - INFO - Found codeActionProvider support for command FixIt in rust
2020-12-23 21:24:43,179 - INFO - Found definitionProvider support for command GoToDefinition in rust
2020-12-23 21:24:43,179 - INFO - Found definitionProvider support for command GoToDeclaration in rust
2020-12-23 21:24:43,180 - INFO - Found definitionProvider support for command GoTo in rust
2020-12-23 21:24:43,180 - INFO - Found typeDefinitionProvider support for command GoToType in rust
2020-12-23 21:24:43,180 - INFO - Found implementationProvider support for command GoToImplementation in rust
2020-12-23 21:24:43,180 - INFO - Found referencesProvider support for command GoToReferences in rust
2020-12-23 21:24:43,180 - INFO - Found renameProvider support for command RefactorRename in rust
2020-12-23 21:24:43,180 - INFO - Found documentFormattingProvider support for command Format in rust
2020-12-23 21:24:43,180 - INFO - Found workspaceSymbolProvider support for command GoToSymbol in rust
2020-12-23 21:24:43,180 - INFO - Always supporting StopServer for rust
2020-12-23 21:24:43,180 - INFO - Always supporting RestartServer for rust
2020-12-23 21:24:43,180 - INFO - Always supporting GetDoc for rust
2020-12-23 21:24:43,180 - INFO - Always supporting GetType for rust
2020-12-23 21:24:43,181 - DEBUG - Refreshing file /home/adel/repos/rust-os/src/main.rs: State is Open/action None
2020-12-23 21:24:43,181 - DEBUG - TX: Sending message: b'Content-Length: 170\r\n\r\n{"id":2,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":0,"line":0},"textDocument":{"uri":"file:///home/adel/repos/rust-os/src/main.rs"}}}'
2020-12-23 21:24:43,183 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":2,"result":null}'
Traceback (most recent call last):
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/rust/rust_completer.py", line 191, in GetDoc
    hover_response = self.GetHoverResponse( request_data )
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 2343, in GetHoverResponse
    raise NoHoverInfoException( NO_HOVER_INFORMATION )
ycmd.completers.language_server.language_server_completer.NoHoverInfoException: No hover information.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 868, in _handle
    return route.call(**args)
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1748, in wrapper
    rv = callback(*a, **ka)
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/watchdog_plugin.py", line 97, in wrapper
    return callback( *args, **kwargs )
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/hmac_plugin.py", line 62, in wrapper
    body = callback( *args, **kwargs )
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 94, in RunCompleterCommand
    return _JsonResponse( completer.OnUserCommand(
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/completer.py", line 472, in OnUserCommand
    return command( self, request_data, arguments[ 1: ] )
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 1648, in <lambda>
    lambda self, request_data, args: self.GetDoc( request_data )
  File "/home/adel/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/rust/rust_completer.py", line 193, in GetDoc
    raise RuntimeError( 'No documentation available.' )
RuntimeError: No documentation available.
2020-12-23 21:26:28,380 - INFO - Received debug info request

/tmp/ycmd_45363_stdout_nobwjhfe.log

serving on http://localhost:45363

OS version, distribution, etc.

I am running Arch Linux, having just fully upgraded my system.

bstaletic commented 3 years ago

I'll try to repro later. For now, check out :h g:ycm_rust_toolchain_root. YCM's bundled rust-analyzer/toolchain might not be appropriate for your project.

puremourning commented 3 years ago

My guess is that RA just doesn’t work with no-stdlib projects. But that’s a question for RA people...

ajgae commented 3 years ago

My guess is that RA just doesn’t work with no-stdlib projects. But that’s a question for RA people...

This seems to be the case. Following the blog post further, I noticed that YCM also complains about the first line:

#![no_std]

, saying that it "can't find crate for 'test' [E0463]". So this issue probably does lie in writing rust crates with the #![no_std] attribute

ajgae commented 3 years ago

UPDATE: I have since continued following along the blog posts, and it turns out that enabling the unstable custom_test_frameworks feature makes the compiler complaint can't find crate for 'test' [E0463] on line 1 (which I mentioned above) disappear.

#![no_std]
#![no_main]

#![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]

// ...

#[cfg(test)]
fn test_runner(tests: &[&dyn Fn()]) {
    println!("Running {} tests.", tests.len());
    for test in tests {
        test();
    }
}

With this, YCM indicates no more errors, as expected. It seems there is sort of a grey zone between using "standard" features (stdlib, default testing framework) and not using them at all where YCM freaks out and doesn't quite understand what's going on, displaying errors about missing crates, but then it stops complaining when you have truly detached yourself from using any of these "standard" features

puremourning commented 3 years ago

I think we can close this, there’s clearly nothing YCM can do differently here. If there’s anything to change, it’s in rust-analyzer