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

Internal compiler error/panic while running rls #160

Closed
marcusball opened this issue Jan 27, 2017 · 9 comments · Fixed by rust-lang/rust#39453
Closed

Internal compiler error/panic while running rls #160

marcusball opened this issue Jan 27, 2017 · 9 comments · Fixed by rust-lang/rust#39453
Labels

Comments

@marcusball
Copy link

I've finally succeeded in getting rls to run, and be accessible by the rls_vscode plugin, however, once it's run, it appears to be experiencing a compiler error while building term-painter. I cloned term-painter and verified that I can build it through cargo separately.

My rust toolchain is:

nightly-x86_64-pc-windows-msvc
rustc 1.16.0-nightly (df8debf6d 2017-01-25)

The full panic is:

    Finished release [optimized] target(s) in 566.38 secs
     Running `C:\Users\Marcus\Source\rls\target\release\rls.exe`
{"message":"C:\\bot\\slave\\nightly-dist-rustc-win-msvc-64\\build\\src\\librustc_save_analysis\\span_utils.rs:236: Mis-counted brackets when breaking path? Parsing 'fmt::$fmt> fmt::$fmt for Painted<T> {\n            fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {\n                self.style.with(|| fmt::$fmt::fmt(&self.obj, f))\n            }\n        }\n    }\n}\n\nimpl_format!(\"{}\", Display' in C:\\Users\\Marcus\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\term-painter-0.2.3\\src\\lib.rs, line 583","code":null,"level":"error: internal compiler error","spans":[{"file_name":"C:\\Users\\Marcus\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\term-painter-0.2.3\\src\\lib.rs","byte_start":19360,"byte_end":19600,"line_start":583,"line_end":591,"column_start":17,"column_end":27,"is_primary":true,"text":[{"text":"        impl<T: fmt::$fmt> fmt::$fmt for Painted<T> {","highlight_start":17,"highlight_end":54},{"text":"            fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {","highlight_start":1,"highlight_end":78},{"text":"                self.style.with(|| fmt::$fmt::fmt(&self.obj, f))","highlight_start":1,"highlight_end":65},{"text":"            }","highlight_start":1,"highlight_end":14},{"text":"        }","highlight_start":1,"highlight_end":10},{"text":"    }","highlight_start":1,"highlight_end":6},{"text":"}","highlight_start":1,"highlight_end":2},{"text":"","highlight_start":1,"highlight_end":1},{"text":"impl_format!(\"{}\", Display);","highlight_start":1,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"C:\\Users\\Marcus\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\term-painter-0.2.3\\src\\lib.rs","byte_start":19574,"byte_end":19602,"line_start":591,"line_end":591,"column_start":1,"column_end":29,"is_primary":false,"text":[{"text":"impl_format!(\"{}\", Display);","highlight_start":1,"highlight_end":29}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"impl_format!","def_site_span":{"file_name":"C:\\Users\\Marcus\\.cargo\\registry\\src\\github.heygears.com-1ecc6299db9ec823\\term-painter-0.2.3\\src\\lib.rs","byte_start":19281,"byte_end":19572,"line_start":581,"line_end":589,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"macro_rules! impl_format {","highlight_start":1,"highlight_end":27},{"text":"    ($symbol:expr, $fmt:ident) => {","highlight_start":1,"highlight_end":36},{"text":"        impl<T: fmt::$fmt> fmt::$fmt for Painted<T> {","highlight_start":1,"highlight_end":54},{"text":"            fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {","highlight_start":1,"highlight_end":78},{"text":"                self.style.with(|| fmt::$fmt::fmt(&self.obj, f))","highlight_start":1,"highlight_end":65},{"text":"            }","highlight_start":1,"highlight_end":14},{"text":"        }","highlight_start":1,"highlight_end":10},{"text":"    }","highlight_start":1,"highlight_end":6},{"text":"}","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":null,"expansion":null}}}],"children":[],"rendered":null}
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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc_errors\lib.rs:375
stack backtrace:
   0:     0x7ff86d380a58 - std::panicking::Location::line::h8c528bbdf4eef8a3
   1:     0x7ff86d37fee2 - std::panicking::Location::line::h8c528bbdf4eef8a3
   2:     0x7ff86d38391d - std::panicking::rust_panic_with_hook::h7abc6e334345e341
   3:     0x7ff886f1505b - <unknown>
   4:     0x7ff886f27af9 - <unknown>
   5:     0x7ff886f27920 - <unknown>
   6:     0x7ff886f9fcec - rustc_save_analysis::span_utils::SpanUtils::sub_span_for_type_name::h4f598c7ef32ca18b
   7:     0x7ff886fa95fb - rustc_save_analysis::SaveContext::get_trait_ref_data::h87ebfa2cacf44ed0
   8:     0x7ff886f922c0 - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
   9:     0x7ff886f5d590 - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
  10:     0x7ff886f7557d - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
  11:     0x7ff886faf091 - rustc_save_analysis::process_crate::h42cb0a78c84361d5
  12:     0x7ff87eb6979a - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::hf8479bd05bccc9c7
  13:     0x7ff87eb69857 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::hf8479bd05bccc9c7
  14:     0x7ff87eb14fc6 - rustc_driver::driver::compile_input::h44e43be0fc34a1a1
  15:     0x7ff87eb39a2f - rustc_driver::driver::count_nodes::h761a1dba824a4f1e
  16:     0x7ff87ea7aeab - <unknown>
  17:     0x7ff87eb113ac - rustc_driver::driver::compile_input::h44e43be0fc34a1a1
  18:     0x7ff87eb62deb - rustc_driver::run_compiler::h5e34a930c0929e5c
  19:     0x7ff87ea3f15e - <unknown>
  20:     0x7ff86d3869d1 - _rust_maybe_catch_panic
  21:     0x7ff87ea6c786 - <unknown>
  22:     0x7ff86d37de9e - std::sys::imp::thread::Thread::new::h7a1b2b1b6bab390a
  23:     0x7ff8a6808363 - BaseThreadInitThunk

thread '<unnamed>' panicked at 'could not run cargo: ChainedError { error: Could not compile `term-painter`., cause: process didn't exit successfully: `rustc --crate-name term_painter C:\Users\Marcus\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\term-painter-0.2.3\src\lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 -C metadata=b159da21991c93e5 -C extra-filename=-b159da21991c93e5 --out-dir c:\Users\Marcus\Source\my_rust_project\target\rls\debug\deps -L dependency=c:\Users\Marcus\Source\my_rust_project\target\rls\debug\deps --extern term=c:\Users\Marcus\Source\my_rust_project\target\rls\debug\deps\libterm-a3b0393697123615.rmeta --cap-lints allow -Zunstable-options -Zsave-analysis --error-format=json -Zcontinue-parse-after-error` (exit code: 101) }', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libcore\result.rs:870
stack backtrace:
   0:     0x7ff86d380a58 - std::panicking::Location::line::h8c528bbdf4eef8a3
   1:     0x7ff86d37ff64 - std::panicking::Location::line::h8c528bbdf4eef8a3
   2:     0x7ff86d38391d - std::panicking::rust_panic_with_hook::h7abc6e334345e341
   3:     0x7ff86d3837b8 - std::panicking::begin_panic_fmt::h661e01bdd0e9618c
   4:     0x7ff86d3836d4 - std::panicking::begin_panic_fmt::h661e01bdd0e9618c
   5:     0x7ff86d383669 - rust_begin_unwind
   6:     0x7ff86d395907 - core::panicking::panic_fmt::hf3abcb5bc11ff49d
   7:     0x7ff78ddb9765 - __ImageBase
   8:     0x7ff78dda5a75 - __ImageBase
   9:     0x7ff86d3869d1 - _rust_maybe_catch_panic
  10:     0x7ff78ddcb353 - __ImageBase
  11:     0x7ff86d37de9e - std::sys::imp::thread::Thread::new::h7a1b2b1b6bab390a
  12:     0x7ff8a6808363 - BaseThreadInitThunk
@nrc
Copy link
Member

nrc commented Jan 27, 2017

Could you try running RUSTFLAGS=-Zsave-analysis cargo check please? That should fail with the same error. Could you let me know which crate is being built when it crashes and ideally give me a link to the source code so I can reproduce? Thanks!

FTR, this is a rustc/save-analysis bug. I'll investigate.

@nrc nrc added the bug label Jan 27, 2017
@marcusball
Copy link
Author

marcusball commented Jan 27, 2017

After looking at cargo tree, the term-painter dependency is coming from Rocket. Running cargo check in rocket's /lib directory does produce the same error:

Marcus@Marcus-Office MINGW64 ~/Source/Rocket/lib (master)
$ cargo check
   Compiling unicode-normalization v0.1.3
   Compiling semver v0.1.20
   Compiling libc v0.2.20
   Compiling version_check v0.1.0
   Compiling httparse v1.2.1
   Compiling winapi v0.2.8
   Compiling winapi-build v0.1.1
   Compiling language-tags v0.2.2
   Compiling toml v0.2.1
   Compiling kernel32-sys v0.2.2
   Compiling rustc_version v0.1.7
   Compiling ansi_term v0.9.0
   Compiling num_cpus v1.2.1
   Compiling traitobject v0.0.1
   Compiling rustc-serialize v0.3.22
   Compiling log v0.3.6
   Compiling rocket v0.1.6 (file:///C:/Users/Marcus/Source/Rocket/lib)
   Compiling mime v0.2.2
   Compiling typeable v0.1.2
   Compiling matches v0.1.4
   Compiling unicode-bidi v0.2.4
   Compiling unicase v1.4.0
   Compiling state v0.2.0
   Compiling idna v0.1.0
   Compiling url v1.4.0
   Compiling term v0.4.4
   Compiling time v0.1.36
   Compiling hyper v0.10.2
   Compiling cookie v0.6.0
   Compiling term-painter v0.2.3
error: internal compiler error: C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc_save_analysis\span_utils.rs:236: Mis-counted brackets when breaking path? Parsing 'fmt::$fmt> fmt::$fmt for Painted<T> {
            fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
                self.style.with(|| fmt::$fmt::fmt(&self.obj, f))
            }
        }
    }
}

impl_format!("{}", Display' in C:\Users\Marcus\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\term-painter-0.2.3\src\lib.rs, line 583
   --> C:\Users\Marcus\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\term-painter-0.2.3\src\lib.rs:583:17
    |
583 |           impl<T: fmt::$fmt> fmt::$fmt for Painted<T> {
    |  _________________^ starting here...
584 | |             fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
585 | |                 self.style.with(|| fmt::$fmt::fmt(&self.obj, f))
586 | |             }
587 | |         }
588 | |     }
589 | | }
590 | |
591 | | impl_format!("{}", Display);
    | | -------------------------^--
    | |_|________________________|
    |   |                        ...ending here
    |   in this macro invocation

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc_errors\lib.rs:375
stack backtrace:
   0:     0x7ff86d380a58 - std::panicking::Location::line::h8c528bbdf4eef8a3
   1:     0x7ff86d37fee2 - std::panicking::Location::line::h8c528bbdf4eef8a3
   2:     0x7ff86d38391d - std::panicking::rust_panic_with_hook::h7abc6e334345e341
   3:     0x7ff877c4505b - <unknown>
   4:     0x7ff877c57af9 - <unknown>
   5:     0x7ff877c57920 - <unknown>
   6:     0x7ff877ccfcec - rustc_save_analysis::span_utils::SpanUtils::sub_span_for_type_name::h4f598c7ef32ca18b
   7:     0x7ff877cd95fb - rustc_save_analysis::SaveContext::get_trait_ref_data::h87ebfa2cacf44ed0
   8:     0x7ff877cc22c0 - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
   9:     0x7ff877c8d590 - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
  10:     0x7ff877ca557d - <rustc_save_analysis::data::Visibility as core::convert::From<&'a rustc::hir::Visibility>>::from::h4a8b0327697cc8db
  11:     0x7ff877cdf091 - rustc_save_analysis::process_crate::h42cb0a78c84361d5
  12:     0x7ff87eb6979a - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::hf8479bd05bccc9c7
  13:     0x7ff87eb69857 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::hf8479bd05bccc9c7
  14:     0x7ff87eb14fc6 - rustc_driver::driver::compile_input::h44e43be0fc34a1a1
  15:     0x7ff87eb39a2f - rustc_driver::driver::count_nodes::h761a1dba824a4f1e
  16:     0x7ff87ea7aeab - <unknown>
  17:     0x7ff87eb113ac - rustc_driver::driver::compile_input::h44e43be0fc34a1a1
  18:     0x7ff87eb62deb - rustc_driver::run_compiler::h5e34a930c0929e5c
  19:     0x7ff87ea3f15e - <unknown>
  20:     0x7ff86d3869d1 - _rust_maybe_catch_panic
  21:     0x7ff87ea6c786 - <unknown>
  22:     0x7ff86d37de9e - std::sys::imp::thread::Thread::new::h7a1b2b1b6bab390a
  23:     0x7ff8a6808363 - BaseThreadInitThunk

Build failed, waiting for other jobs to finish...
error: Could not compile `term-painter`.

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

I can't share the crate I'm writing right now, but, I verified I get the same error if I try to use VSCode on the main Rocket library (code ~/Rocket/lib).

@nrc
Copy link
Member

nrc commented Jan 29, 2017

Term painter is https://github.com/LukasKalbertodt/term-painter (I'll investigate this during the week)

@marcusball
Copy link
Author

Alright, I appreciate you taking a look at it. Would it be better for me to bring this issue over to the term-painter repo, or perhaps rustc since the error itself says it's a compiler bug?

@nrc
Copy link
Member

nrc commented Jan 30, 2017

Nah, here is fine. It'll be me fixing it in any case and there's already info here.

@nrc
Copy link
Member

nrc commented Feb 1, 2017

The root of this problem is rust-lang/rust#39450

nrc added a commit to nrc/rust that referenced this issue Feb 2, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 4, 2017
save-analysis: be more paranoid about generated paths

fixes rust-lang/rls#160
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 4, 2017
save-analysis: be more paranoid about generated paths

fixes rust-lang/rls#160
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
save-analysis: be more paranoid about generated paths

fixes rust-lang/rls#160
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
save-analysis: be more paranoid about generated paths

fixes rust-lang/rls#160
@nrc
Copy link
Member

nrc commented Feb 6, 2017

Should be fixed now

@nrc nrc closed this as completed Feb 6, 2017
@KalitaAlexey
Copy link
Contributor

@nrc,
Did you check it?

@nrc
Copy link
Member

nrc commented Feb 6, 2017

yes, though not in the RLS - thus "should"

I'm not sure if it is in nightly yet.

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

Successfully merging a pull request may close this issue.

3 participants