Closed

Description
Description of Problem
I'm trying to run the roman numeral compiler plugin code in the documentation (here). The compiler panics with this error:
thread 'rustc' panicked at 'cannot access a scoped thread local variable without calling `set` first', /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:168:9
Code to Reproduce
My code is in this repo: github.com/mgoelzer/rust-macros-roman
Expected vs Actual Behavior
I run cargo build
from the root of that repo. I expect the code to compile without errors.
Instead, the compiler panics like this:
$ cargo build
Compiling roman-test v0.1.0 (/Users/mwg/code/rust-macros-roman-numerals/roman-test)
thread 'rustc' panicked at 'cannot access a scoped thread local variable without calling `set` first', /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error: unexpected panic
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.38.0-nightly (b0e40bfba 2019-08-02) running on x86_64-apple-darwin
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `roman-test`.
To learn more, run the command again with --verbose.
Meta
$ rustc --version --verbose
rustc 1.38.0-nightly (b0e40bfba 2019-08-02)
binary: rustc
commit-hash: b0e40bfba44836ad30051ffb077c1cfc5bf4a59f
commit-date: 2019-08-02
host: x86_64-apple-darwin
release: 1.38.0-nightly
LLVM version: 9.0
$ cargo --version --verbose
cargo 1.38.0-nightly (26092da33 2019-07-31)
release: 1.38.0
commit-hash: 26092da337b948719549cd5ed3d1051fd847afd7
commit-date: 2019-07-31
Backtrace
$ RUST_BACKTRACE=1 cargo build
Compiling roman-test v0.1.0 (/Users/mwg/code/rust-macros-roman-numerals/roman-test)
thread 'rustc' panicked at 'cannot access a scoped thread local variable without calling `set` first', /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:168:9
stack backtrace:
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: std::panicking::begin_panic
5: scoped_tls::ScopedKey<T>::with
6: core::ptr::real_drop_in_place
7: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
8: __rustc_plugin_registrar_7649699624c1ca169dcc2215a85ad889__
at roman/src/lib.rs:60
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: <unknown>
14: <unknown>
15: <unknown>
16: <unknown>
17: <unknown>
18: <unknown>
19: <unknown>
20: <unknown>
21: <unknown>
22: <unknown>
23: <unknown>
query stack during panic:
end of query stack
error: internal compiler error: unexpected panic
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.38.0-nightly (b0e40bfba 2019-08-02) running on x86_64-apple-darwin
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `roman-test`.
To learn more, run the command again with --verbose.
Related Issues
Searching in Google, another issue with the same error is #53469
#27271 is another user trying to compile the roman numeral example, but his problem is different.
Metadata
Metadata
Assignees
Labels
No labels