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

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

Closed
aDifferentJT opened this issue Feb 19, 2024 · 12 comments · Fixed by rust-lang/rust#121301

Comments

@aDifferentJT
Copy link

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

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

@ytmimi
Copy link
Contributor

ytmimi commented Feb 19, 2024

No worries. What version of rustfmt are you using?

@ytmimi
Copy link
Contributor

ytmimi commented Feb 19, 2024

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

@aDifferentJT
Copy link
Author

No worries. What version of rustfmt are you using?

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

@aDifferentJT
Copy link
Author

@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.

@ytmimi
Copy link
Contributor

ytmimi commented Feb 19, 2024

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

@ytmimi
Copy link
Contributor

ytmimi commented Feb 19, 2024

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

@aDifferentJT
Copy link
Author

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
Copy link
Author

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>>
    };
}

@ytmimi
Copy link
Contributor

ytmimi commented Feb 19, 2024

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
Copy link
Contributor

ytmimi commented Feb 23, 2024

rust-lang/rust#121487 doesn't explicitly reference this issue, but I'm hoping that it also resolves the problem 🤞🏼

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
…r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
…r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
…r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
…r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
…r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2024
Rollup merge of rust-lang#121301 - davidtwco:rustfmt-silent-emitter, r=pnkfelix

errors: share `SilentEmitter` between rustc and rustfmt

Fixes rust-lang/rustfmt#6082.

Shares the `SilentEmitter` between rustc and rustfmt, and gives it a fallback bundle (since it can emit diagnostics in some contexts).
@ytmimi
Copy link
Contributor

ytmimi commented Mar 7, 2024

@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

@aDifferentJT
Copy link
Author

@ytmimi Looks like it's working, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants