rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

thread 'main' panicked at src/tools/rustfmt/src/parse/session.rs:42:9: silent emitter attempted to translate a diagnostic

Open aDifferentJT opened this issue 2 years ago • 10 comments

rustc-ice-2024-02-19T01_32_59-84679.txt

Sorry, not a very helpful bug report, but it said to open an issue

aDifferentJT avatar Feb 19 '24 01:02 aDifferentJT

No worries. What version of rustfmt are you using?

ytmimi avatar Feb 19 '24 01:02 ytmimi

@aDifferentJT Do you also have an input snippet that we could run rustfmt on to reproduce the issue?

ytmimi avatar Feb 19 '24 02:02 ytmimi

No worries. What version of rustfmt are you using?

The latest nightly, I ran rustup update about an hour ago.

aDifferentJT avatar Feb 19 '24 02:02 aDifferentJT

@aDifferentJT Do you also have an input snippet that we could run rustfmt on to reproduce the issue?

Not to hand unfortunately, I haven't yet tried to narrow down the code that causes it, I'll try to do that in the morning, it's quite late here.

aDifferentJT avatar Feb 19 '24 02:02 aDifferentJT

@aDifferentJT I don't think this is an issue with a particular code snippet. If I had to guess Id say changes made in https://github.com/rust-lang/rust/pull/121085 are causing this issue.

ytmimi avatar Feb 19 '24 02:02 ytmimi

were you running rustfmt on a public repo? That might be enough to reproduce the issue.

ytmimi avatar Feb 19 '24 02:02 ytmimi

were you running rustfmt on a public repo? That might be enough to reproduce the issue.

Sorry, no, it's private for now, if I get time in the morning I'll try to get a more minimal case I can send

aDifferentJT avatar Feb 19 '24 03:02 aDifferentJT

I've minimised the file, this seems to be the smallest file that causes the issue

rustfmt_ice.rs

macro_rules! test {
    ($T:ident, $b:lifetime) => {
        Box<$T<$b>>
    };
}

aDifferentJT avatar Feb 19 '24 14:02 aDifferentJT

Perfect! I'm also able to reproduce the bug using the snippet. Thank you very much! I think this will help us figure out what's going on.

ytmimi avatar Feb 19 '24 14:02 ytmimi

https://github.com/rust-lang/rust/pull/121487 doesn't explicitly reference this issue, but I'm hoping that it also resolves the problem 🤞🏼

ytmimi avatar Feb 23 '24 15:02 ytmimi

@aDifferentJT when you have a moment can you confirm that this is resolved on the latest nightly (rustfmt 1.7.0-nightly (7d3702e4 2024-03-06)? I just ran your input snippet with a few recent nighty versions, and I can no longer reproduce the panic using the most recent nightly.

steps to verify:

  1. rustup install nightly or rustup install nightly-2024-03-07
  2. rustfmt +nightly

ytmimi avatar Mar 07 '24 22:03 ytmimi

@ytmimi Looks like it's working, thanks

aDifferentJT avatar Mar 08 '24 14:03 aDifferentJT