Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic with nested tuple access syntax #4363

Closed
virtualritz opened this issue Aug 2, 2020 · 3 comments
Closed

Panic with nested tuple access syntax #4363

virtualritz opened this issue Aug 2, 2020 · 3 comments
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate

Comments

@virtualritz
Copy link

Running rustfmt on a source that uses a double dot syntax to access a nested tuple causes a panic:

thread 'main' panicked at 'bad span: `.`: ``', src/tools/rustfmt/src/source_map.rs:52:13
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: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: std::panicking::begin_panic_fmt
   8: <rustfmt_nightly::visitor::SnippetProvider as rustfmt_nightly::source_map::SpanUtils>::span_before::{{closure}}
   9: <rustfmt_nightly::visitor::SnippetProvider as rustfmt_nightly::source_map::SpanUtils>::span_before
  10: rustfmt_nightly::chains::rewrite_chain
  11: rustfmt_nightly::expr::format_expr
  12: <rustfmt_nightly::overflow::OverflowableItem as rustfmt_nightly::rewrite::Rewrite>::rewrite
  13: <rustfmt_nightly::lists::ListItems<I,F1,F2,F3> as core::iter::traits::iterator::Iterator>::next
  14: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  15: rustfmt_nightly::overflow::Context::rewrite_items
  16: rustfmt_nightly::overflow::Context::rewrite
  17: rustfmt_nightly::expr::format_expr
  18: rustfmt_nightly::closures::rewrite_closure_expr
  19: rustfmt_nightly::closures::rewrite_closure
  20: rustfmt_nightly::expr::format_expr
  21: rustfmt_nightly::closures::rewrite_last_closure
  22: rustfmt_nightly::overflow::Context::rewrite_items
  23: rustfmt_nightly::overflow::Context::rewrite
  24: rustfmt_nightly::expr::rewrite_call
  25: <rustfmt_nightly::chains::ChainItem as rustfmt_nightly::rewrite::Rewrite>::rewrite
  26: <rustfmt_nightly::chains::ChainFormatterBlock as rustfmt_nightly::chains::ChainFormatter>::format_children
  27: <rustfmt_nightly::chains::Chain as rustfmt_nightly::rewrite::Rewrite>::rewrite
  28: rustfmt_nightly::chains::rewrite_chain
  29: rustfmt_nightly::expr::format_expr
  30: rustfmt_nightly::stmt::format_stmt
  31: rustfmt_nightly::visitor::FmtVisitor::walk_stmts
  32: rustfmt_nightly::visitor::FmtVisitor::visit_block
  33: rustfmt_nightly::visitor::FmtVisitor::visit_fn
  34: rustfmt_nightly::visitor::FmtVisitor::visit_item
  35: rustfmt_nightly::reorder::<impl rustfmt_nightly::visitor::FmtVisitor>::visit_items_with_reordering
  36: rustfmt_nightly::visitor::FmtVisitor::walk_mod_items
  37: rustfmt_nightly::visitor::FmtVisitor::format_separate_mod
  38: rustfmt_nightly::formatting::format_project
  39: scoped_tls::ScopedKey<T>::set
  40: rustc_ap_rustc_ast::attr::with_session_globals
  41: rustfmt_nightly::Session<T>::format
  42: rustfmt::format_and_emit_report
  43: rustfmt::execute
  44: rustfmt::main
  45: std::rt::lang_start::{{closure}}
  46: std::rt::lang_start_internal
  47: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 8:13:42 PM] Request textDocument/formatting failed.
  Message: rustfmt exited with:
                           Status: exit code: 101
                           stdout: 
  Code: -32900 

To Reproduce

git clone https://github.com/virtualritz/polyhedron-operators.git
cargo fmt

Meta

  • rustfmt version: rustfmt 1.4.19-nightly (cef1c0d5 2020-07-21)
  • From where did you install rustfmt: rustup
  • How do you run rustfmt: cargo fmt
@virtualritz virtualritz added the bug Panic, non-idempotency, invalid code, etc. label Aug 2, 2020
@calebcartwright
Copy link
Member

thank you for the report @virtualritz. However, I believe this is a duplicate of #4355 and would rather close and track in one place. Will hold off on closing this for a bit in case you feel this is a different underlying issue and want to make that case.

@virtualritz
Copy link
Author

Yes, totally looks like a duplicate. Sorry about the noise, didn't see #4355 even though I tried searching for this.

@calebcartwright
Copy link
Member

No worries! Thanks again for reaching out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate
Projects
None yet
Development

No branches or pull requests

2 participants