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 on the latest rustc-ap-syntax #2532

Closed
topecongiro opened this Issue Mar 15, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@topecongiro
Member

topecongiro commented Mar 15, 2018

After updating rustc-ap-syntax to 67.0.0 (or later), rustfmt panics:

thread 'main' panicked at 'cannot access a scoped thread local variable without calling `set` first', /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.1/src/lib.rs:186:9

Backtrace

thread 'main' panicked at 'cannot access a scoped thread local variable without calling `set` first', /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.1/src/lib.rs:186:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:402
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:365
   6: <scoped_tls::ScopedKey<T>>::with
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax_pos-67.0.0/<panic macros>:3
   7: syntax_pos::symbol::with_interner
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax_pos-67.0.0/symbol.rs:336
   8: syntax_pos::symbol::Symbol::intern
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax_pos-67.0.0/symbol.rs:93
   9: syntax_pos::symbol::Ident::from_str
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax_pos-67.0.0/symbol.rs:35
  10: syntax::parse::lexer::StringReader::mk_ident
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:77
  11: syntax::parse::lexer::StringReader::next_token_inner::{{closure}}
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:1141
  12: syntax::parse::lexer::StringReader::with_str_from_to
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:389
  13: syntax::parse::lexer::StringReader::with_str_from
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:367
  14: syntax::parse::lexer::StringReader::next_token_inner
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:1136
  15: syntax::parse::lexer::StringReader::advance_token
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:349
  16: syntax::parse::lexer::StringReader::try_next_token
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:132
  17: syntax::parse::lexer::StringReader::try_real_token
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:98
  18: syntax::parse::lexer::StringReader::real_token
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/mod.rs:112
  19: syntax::parse::lexer::tokentrees::<impl syntax::parse::lexer::StringReader<'a>>::parse_token_tree
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/tokentrees.rs:130
  20: syntax::parse::lexer::tokentrees::<impl syntax::parse::lexer::StringReader<'a>>::parse_all_token_trees
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/lexer/tokentrees.rs:21
  21: syntax::parse::filemap_to_stream
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/mod.rs:232
  22: syntax::parse::filemap_to_parser
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/mod.rs:192
  23: syntax::parse::new_parser_from_file
             at /home/topecongiro/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-syntax-67.0.0/parse/mod.rs:172
  24: rustfmt_nightly::parse_input
             at src/lib.rs:545
  25: rustfmt_nightly::format_input
             at src/lib.rs:700
  26: rustfmt_nightly::run
             at src/lib.rs:864
  27: rustfmt::execute
             at src/bin/main.rs:319
  28: rustfmt::main
             at src/bin/main.rs:341
  29: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  30: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:306
  31: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  32: std::rt::lang_start_internal
             at libstd/panicking.rs:285
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  33: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  34: main
  35: __libc_start_main
  36: _start
@topecongiro

This comment has been minimized.

Member

topecongiro commented Mar 15, 2018

Looks like we just need to call syntax::with_globals before using parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment