ExplicitBug crash on `m!(a. X::Y)`
Open
Nobody has claimed this yet.
A-macros
C-bug
P-low
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Repro against current master (c19b14539b79d44f5f433ac189d70e07fb152354):
$ echo 'm!(a. X::Y);' | RUST_BACKTRACE=1 cargo run --bin rustfmt
m!(a. X::Y);
thread 'main' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: std::panic::panic_any::<rustc_errors::ExplicitBug>
2: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
3: core::ptr::drop_in_place<rustc_errors::HandlerInner>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
4: core::ptr::drop_in_place<core::cell::UnsafeCell<rustc_errors::HandlerInner>>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
5: core::ptr::drop_in_place<core::cell::RefCell<rustc_errors::HandlerInner>>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
6: core::ptr::drop_in_place<rustc_data_structures::sync::Lock<rustc_errors::HandlerInner>>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
7: core::ptr::drop_in_place<rustc_errors::Handler>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
8: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
9: core::ptr::drop_in_place<rustfmt_nightly::parse::session::ParseSess>
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/library/core/src/ptr/mod.rs:487:1
10: rustfmt_nightly::formatting::format_project
at ./src/formatting.rs:175:1
11: rustfmt_nightly::formatting::<impl rustfmt_nightly::Session<T>>::format_input_inner::{{closure}}
at ./src/formatting.rs:48:33
12: scoped_tls::ScopedKey<T>::with
at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:171:13
13: rustc_span::create_session_if_not_set_then::{{closure}}
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/compiler/rustc_span/src/lib.rs:141:50
14: scoped_tls::ScopedKey<T>::set
at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
15: rustc_span::create_session_if_not_set_then
at /rustc/5750a6aa2777382bf421b726f234da23f990a953/compiler/rustc_span/src/lib.rs:141:9
16: rustfmt_nightly::formatting::<impl rustfmt_nightly::Session<T>>::format_input_inner
at ./src/formatting.rs:38:9
17: rustfmt_nightly::Session<T>::format
at ./src/lib.rs:453:9
18: rustfmt::format_and_emit_report
at ./src/bin/main.rs:359:11
19: rustfmt::format_string
at ./src/bin/main.rs:281:5
20: rustfmt::execute
at ./src/bin/main.rs:241:39
21: rustfmt::main
at ./src/bin/main.rs:26:27
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash with the shown cargo run --bin rustfmt command, then trace the formatting path through src/formatting.rs and src/bin/main.rs toward the parser and compiler/rustc_errors/src/lib.rs. Determine why this input reaches ExplicitBug; done means the same input no longer panics and instead produces the expected formatter behavior or diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100