Skip to content

ICE: trimmed_def_paths called, diagnostics were expected but none were emitted #135289

Closed

Description

@djc

beta triggered an ICE in Quinn's CI today:

https://github.com/quinn-rs/quinn/actions/runs/12691355015/job/35374229601?pr=2130

Maybe similar/related to:

Maybe a fix that could be backported?

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:646:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging. Backtraces are currently disabled: set `RUST_BACKTRACE=1` and re-run to see where it happened.
stack backtrace:
   0:     0x7fc24a2de3ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4877db58cd1f68da
   1:     0x7fc24aa135e6 - core::fmt::write::ha314f3a66d347c48
   2:     0x7fc24b903a11 - std::io::Write::write_fmt::h50f19c6ac271d942
   3:     0x7fc24a2de212 - std::sys::backtrace::BacktraceLock::print::hf8fc8e4f6df76466
   4:     0x7fc24a2e07b7 - std::panicking::default_hook::{{closure}}::hc1cbccbc75363945
   5:     0x7fc24a2e05a0 - std::panicking::default_hook::ha6ac61b9282038d9
   6:     0x7fc249453168 - std[a5195d1e2fc22c41]::panicking::update_hook::<alloc[20639d31ccb56773]::boxed::Box<rustc_driver_impl[5024ff76ded81fa1]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7fc24a2e1003 - std::panicking::rust_panic_with_hook::h5663cbee266e1761
   8:     0x7fc24a2e0cfa - std::panicking::begin_panic_handler::{{closure}}::hbbe6da1959d575ac
   9:     0x7fc24a2de889 - std::sys::backtrace::__rust_end_short_backtrace::h8c70aabd292ca3dd
  10:     0x7fc24a2e09bd - rust_begin_unwind
  11:     0x7fc246f9ff80 - core::panicking::panic_fmt::h044f8a6ac8b759ab
  12:     0x7fc24b850471 - <rustc_errors[697e64861a5c752e]::DiagCtxtInner as core[355654ca938a17d7]::ops::drop::Drop>::drop
  13:     0x7fc24b850f9c - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_errors[697e64861a5c752e]::DiagCtxt>
  14:     0x7fc24b9a551a - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_session[7408041faf332997]::parse::ParseSess>
  15:     0x7fc24b9a64a0 - core[355654ca938a17d7]::ptr::drop_in_place::<rustc_interface[2b78e7c3f7f2a3ff]::interface::Compiler>
  16:     0x7fc24b9ada79 - rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler::<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}
  17:     0x7fc24b853b95 - std[a5195d1e2fc22c41]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_pool_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  18:     0x7fc24b854048 - <<std[a5195d1e2fc22c41]::thread::Builder>::spawn_unchecked_<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::util::run_in_thread_pool_with_globals<rustc_interface[2b78e7c3f7f2a3ff]::interface::run_compiler<(), rustc_driver_impl[5024ff76ded81fa1]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[355654ca938a17d7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  19:     0x7fc24b855601 - std::sys::pal::unix::thread::Thread::new::thread_start::h535af24502242ac5
  20:     0x7fc245a9ca94 - <unknown>
  21:     0x7fc245b29c3c - <unknown>
  22:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.85.0-beta.1 (e30eefff4 2025-01-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `quinn-proto` (lib test)

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/rustc --crate-name quinn_proto --edition=2021 quinn-proto/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg 'cfg(fuzzing)' --test --cfg 'feature="default"' --cfg 'feature="log"' --cfg 'feature="platform-verifier"' --cfg 'feature="ring"' --cfg 'feature="rustls-ring"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("arbitrary", "aws-lc-rs", "aws-lc-rs-fips", "default", "log", "platform-verifier", "ring", "rustls", "rustls-aws-lc-rs", "rustls-aws-lc-rs-fips", "rustls-log", "rustls-ring"))' -C metadata=e4cd9ebb7814c565 -C extra-filename=-875e02898ea8dd6b --out-dir /home/runner/work/quinn/quinn/target/debug/deps -L dependency=/home/runner/work/quinn/quinn/target/debug/deps --extern assert_matches=/home/runner/work/quinn/quinn/target/debug/deps/libassert_matches-ff215179dd669654.rlib --extern bytes=/home/runner/work/quinn/quinn/target/debug/deps/libbytes-a85ea1e0de84b215.rlib --extern hex_literal=/home/runner/work/quinn/quinn/target/debug/deps/libhex_literal-26f17529c9d73dcc.rlib --extern lazy_static=/home/runner/work/quinn/quinn/target/debug/deps/liblazy_static-b03541b63c18dba7.rlib --extern rand=/home/runner/work/quinn/quinn/target/debug/deps/librand-717c8c34580787c0.rlib --extern rcgen=/home/runner/work/quinn/quinn/target/debug/deps/librcgen-86629bfa01ffb0b4.rlib --extern ring=/home/runner/work/quinn/quinn/target/debug/deps/libring-b326a68ecfa48aef.rlib --extern rustc_hash=/home/runner/work/quinn/quinn/target/debug/deps/librustc_hash-311bd3609ea046c6.rlib --extern rustls=/home/runner/work/quinn/quinn/target/debug/deps/librustls-df6c75c11fb1ff22.rlib --extern rustls_platform_verifier=/home/runner/work/quinn/quinn/target/debug/deps/librustls_platform_verifier-11787e01b1085472.rlib --extern slab=/home/runner/work/quinn/quinn/target/debug/deps/libslab-3c03d7cf5b378de6.rlib --extern thiserror=/home/runner/work/quinn/quinn/target/debug/deps/libthiserror-efb27899156c3206.rlib --extern tinyvec=/home/runner/work/quinn/quinn/target/debug/deps/libtinyvec-1f34b1656bcd04e6.rlib --extern tracing=/home/runner/work/quinn/quinn/target/debug/deps/libtracing-908c8b1357dbbdf0.rlib --extern tracing_subscriber=/home/runner/work/quinn/quinn/target/debug/deps/libtracing_subscriber-d313c5fd47fc560a.rlib --extern wasm_bindgen_test=/home/runner/work/quinn/quinn/target/debug/deps/libwasm_bindgen_test-35a5da5beb78a7c9.rlib -L native=/home/runner/work/quinn/quinn/target/debug/build/ring-f079ed4dd15e693d/out` (exit status: 101)

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 9, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 9, 2025
  3. lqd commented on Jan 9, 2025

    @lqd
    Member

    What are the steps to reproduce? cargo check on quinn?

  4. djc commented on Jan 9, 2025

    @djc
    ContributorAuthor

    CI ran cargo build --all-targets against the Quinn repo.

  5. lqd commented on Jan 9, 2025

    @lqd
    Member

    Thanks you saved me a click 👍.

    Maybe a fix that could be backported?

    This is still happening on nightly with cargo check --all-targets so there's unfortunately nothing to backport yet.

    Bisection points at #132658 but it's unclear whether that's actually correct yet -- I'll cc the author @estebank for due diligence -- but such issues are sometimes easy so I'll see if I have the time to look into it soon.

  6. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    A-patternsRelating to patterns and pattern matching
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 9, 2025
  7. lqd commented on Jan 9, 2025

    @lqd
    Member

    Some context for esteban:

    • I believe this is triggered here https://github.com/quinn-rs/quinn/blob/fbc795e3cea722996232f2c853772390e05d51fe/quinn-proto/src/tests/mod.rs#L1638-L1641
    • it seems some match arms are thought as unreachable, report_unreachable_pattern calls the const typo check from Detect const in pattern with typo #132658 -- I don't know for sure if there are false positives in the unreachable arm computation (there must be), but overall 2 match arms pass through diagnostics as unreachable in that crate and its tests.
    • however, on the parent commit of the rollup where this landed, no patterns related warnings are emitted, and it seems no #[allow(unreachable_patterns) are present in the repo or the dependency where that macro comes from so find_fallback_pattern_typo runs.
    • I don't know if some later process eats them or something, but this lack of warnings causes the ICE of course
  8. estebank commented on Jan 9, 2025

    @estebank
    Contributor

    I think that we can side-step the issue quickly by removing the call to with_no_trimmed_paths!. accessible_paths could instead collect Ty<'_>s and that might work too.

  9. lqd commented on Jan 9, 2025

    @lqd
    Member

    There’s no rush, right?

  10. added a commit that references this issue on Jan 9, 2025
    93a1950
  11. 8 remaining items

  12. estebank commented on Jan 20, 2025

    @estebank
    Contributor

    Let's keep it open even after backport for E-needs-test's sake.

  13. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Jan 20, 2025
  14. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jan 20, 2025
  15. lqd commented on Jan 21, 2025

    @lqd
    Member

    @djc btw, in the piece of code where I found the ICE and linked earlier: the assert_matches! is on _next_retire_prior_to, but is it supposed to match the local var next_retire_prior_to? edit: maybe not, but this macro seems "interesting" if you pass it something that doesn't exist.

  16. djc commented on Jan 21, 2025

    @djc
    ContributorAuthor

    @lqd huh, thanks for calling that out -- fixing it.

  17. lqd commented on Jan 21, 2025

    @lqd
    Member

    This ICE resisted minimization a lot. Obviously any error is a no no, but it was the same for many warnings as well: any unused variable, useless mut, unused import, etc and the ICE disappears like a frightened tortoise 🐢. Once I discovered that, things became less unpleasant.

    • dependency (edition <2021)
    #[macro_export]
    macro_rules! assert_matches {
        ( $e:expr , $($pat:pat)|+ ) => {
            match $e {
                $($pat)|+ => (),
                _ => (),
            }
        };
    }
    • repro
    const _A: u64 = 0;
    pub fn f() -> u64 {
        0
    }
    fn main() {
        fake_matches::assert_matches!(f(), _non_existent);
    }

    I've opened #135833 to add this as a test for now, but the fix should now be easier to clean up.

  18. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jan 21, 2025
  19. added a commit that references this issue on Jan 21, 2025
  20. added a commit that references this issue on Jan 22, 2025
  21. added a commit that references this issue on Jan 22, 2025
  22. added a commit that references this issue on Jan 24, 2025
    a41d236
  23. apiraino commented on Jan 29, 2025

    @apiraino
    Contributor

    Closing since #135310 was merged

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions