Skip to content

[ICE]: assertion failed: !parts.is_empty() #165052

Open

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait Reference: 'static {
    type Ref<'a>;
}

struct SliceRef<'a, T: ?Sized + 'static> {
    inner: &'static T,
}

impl<SR: 'static> Reference for Vec<SR> {
    type Ref<'a> = SliceRef<'a, [SR]>;

    fn get_ref(&self) -> Self::Ref<'_> {
        SliceRef { inner: self }
    }
}

original:

trait Reference: 'static {
    type Ref<'a>;
    fn get_ref(&self) -> Self::Ref<'_>;
}

struct SliceRef<'a, T: ?Sized + 'static> {
    inner: &'static T,
}

impl<SR: 'static> Reference for Vec<SR> {
    type Ref<'a> = SliceRef<'a, [SR]>;

    fn get_ref(&self) -> Self::Ref<'_> {
        SliceRef { inner: self }
    }
}

fn main() {}

Version information

rustc 1.101.0-nightly (16d1ffac1 2026-10-26)
binary: rustc
commit-hash: 16d1ffac17ad8b739e32483ac2e65fe7e1804977
commit-date: 2026-10-26
host: x86_64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.4

Possibly related line of code:

let parts = suggestion
.into_iter()
.map(|(span, snippet)| SubstitutionPart { snippet, span })
.collect::<Vec<_>>();
assert!(!parts.is_empty());
debug_assert_eq!(
parts.iter().find(|part| part.span.is_empty() && part.snippet.is_empty()),
None,
"Span must not be empty and have no suggestion",
);
debug_assert_eq!(

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

`--edition` is unspecified, defaulting to `2015` while the latest is `2024`; it must be one of: <2015|2018|2021|2024|future>

error[E0407]: method `get_ref` is not a member of trait `Reference`
  --> /tmp/icemaker_global_tempdir.O89QqsIytXhi/rustc_testrunner_tmpdir_reporting.ax0HfJtwB3vR/mvce.rs:12:5
   |
12 | /     fn get_ref(&self) -> Self::Ref<'_> {
13 | |         SliceRef { inner: self }
14 | |     }
   | |_____^ not a member of trait `Reference`

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.O89QqsIytXhi/rustc_testrunner_tmpdir_reporting.ax0HfJtwB3vR/mvce.rs:15:2
   |
15 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.O89QqsIytXhi/rustc_testrunner_tmpdir_reporting.ax0HfJtwB3vR/mvce.rs`

error[E0392]: lifetime parameter `'a` is never used
 --> /tmp/icemaker_global_tempdir.O89QqsIytXhi/rustc_testrunner_tmpdir_reporting.ax0HfJtwB3vR/mvce.rs:5:17
  |
5 | struct SliceRef<'a, T: ?Sized + 'static> {
  |                 ^^ unused lifetime parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`


thread 'rustc' (146452) panicked at /rustc-dev/16d1ffac17ad8b739e32483ac2e65fe7e1804977/compiler/rustc_errors/src/diagnostic.rs:795:9:
assertion failed: !parts.is_empty()
stack backtrace:
   0:     0x7f1aafc1bc66 - <<std[330264cedda0dde7]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[c3c47457b203f732]::fmt::Display>::fmt
   1:     0x7f1ab020bf69 - core[c3c47457b203f732]::fmt::write
   2:     0x7f1aafc31d4c - <std[330264cedda0dde7]::sys::stdio::unix::Stderr as core[c3c47457b203f732]::io::write::Write>::write_fmt
   3:     0x7f1aafbecdaa - std[330264cedda0dde7]::panicking::default_hook::{closure#0}
   4:     0x7f1aafc0f5b3 - std[330264cedda0dde7]::panicking::default_hook
   5:     0x7f1aae9d7dd9 - std[330264cedda0dde7]::panicking::update_hook::<alloc[af84d0cd032748a3]::boxed::Box<rustc_driver_impl[854d066a38aab513]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1aafc0fa52 - std[330264cedda0dde7]::panicking::panic_with_hook
   7:     0x7f1aafbece94 - std[330264cedda0dde7]::panicking::panic_handler::{closure#0}
   8:     0x7f1aafbe3509 - std[330264cedda0dde7]::sys::backtrace::__rust_end_short_backtrace::<std[330264cedda0dde7]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f1aafbeebbd - __rustc[a38ff76b5c4f9c0]::rust_begin_unwind
  10:     0x7f1aac4eb5dc - core[c3c47457b203f732]::panicking::panic_fmt
  11:     0x7f1aacf512d2 - core[c3c47457b203f732]::panicking::panic
  12:     0x7f1aae58b6d1 - <rustc_errors[9ab7b5d3ce2cdd56]::diagnostic::Diag>::multipart_suggestion_with_style::<&str>
  13:     0x7f1aae677631 - <rustc_borrowck[e1fd4d0d9c3617a1]::MirBorrowckCtxt>::report_general_error
  14:     0x7f1aae66fdd2 - <rustc_borrowck[e1fd4d0d9c3617a1]::MirBorrowckCtxt>::report_region_error
  15:     0x7f1aae67885c - <rustc_borrowck[e1fd4d0d9c3617a1]::MirBorrowckCtxt>::report_region_errors
  16:     0x7f1ab15d31d5 - rustc_borrowck[e1fd4d0d9c3617a1]::borrowck_check_region_constraints
  17:     0x7f1ab15a7e5b - <rustc_borrowck[e1fd4d0d9c3617a1]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
  18:     0x7f1ab05741d5 - rustc_borrowck[e1fd4d0d9c3617a1]::mir_borrowck
  19:     0x7f1ab0573ef9 - rustc_query_impl[41e30d1e9fe6e894]::query_vtables::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
  20:     0x7f1ab057290e - rustc_query_impl[41e30d1e9fe6e894]::execution::try_execute_query::<rustc_data_structures[f4d1bc18c8885aa4]::vec_cache::VecCache<rustc_span[fd67e99fbaac7070]::def_id::LocalDefId, rustc_middle[3fdf4e28e066cfea]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[3fdf4e28e066cfea]::dep_graph::graph::DepNodeIndex>, false>
  21:     0x7f1ab0572475 - rustc_query_impl[41e30d1e9fe6e894]::query_vtables::mir_borrowck::execute_query_non_incr::__rust_end_short_backtrace
  22:     0x7f1ab05704e9 - <rustc_middle[3fdf4e28e066cfea]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[330c1f918d396dc7]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
  23:     0x7f1ab056f7b1 - rustc_interface[330c1f918d396dc7]::passes::analysis
  24:     0x7f1ab13aff87 - rustc_query_impl[41e30d1e9fe6e894]::execution::try_execute_query::<rustc_middle[3fdf4e28e066cfea]::query::caches::SingleCache<rustc_middle[3fdf4e28e066cfea]::query::erase::ErasedData<[u8; 0usize]>>, false>
  25:     0x7f1ab13afd6b - rustc_query_impl[41e30d1e9fe6e894]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  26:     0x7f1ab14e3e05 - rustc_interface[330c1f918d396dc7]::interface::run_compiler::<(), rustc_driver_impl[854d066a38aab513]::compiler_entrypoint::{closure#0}>::{closure#2}
  27:     0x7f1ab15637c1 - std[330264cedda0dde7]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[330c1f918d396dc7]::util::run_in_thread_with_globals<rustc_interface[330c1f918d396dc7]::util::run_in_thread_pool_with_globals<rustc_interface[330c1f918d396dc7]::interface::run_compiler<(), rustc_driver_impl[854d066a38aab513]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  28:     0x7f1ab156356d - <std[330264cedda0dde7]::thread::lifecycle::spawn_unchecked<rustc_interface[330c1f918d396dc7]::util::run_in_thread_with_globals<rustc_interface[330c1f918d396dc7]::util::run_in_thread_pool_with_globals<rustc_interface[330c1f918d396dc7]::interface::run_compiler<(), rustc_driver_impl[854d066a38aab513]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c3c47457b203f732]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7f1ab142e82d - <std[330264cedda0dde7]::sys::thread::unix::Thread>::new::thread_start
  30:     0x7f1aaa4980a2 - <unknown>
  31:     0x7f1aaa52080c - <unknown>
  32:                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: please make sure that you have updated to the latest nightly

note: rustc 1.101.0-nightly (16d1ffac1 2026-10-26) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /tmp/icemaker_global_tempdir.O89QqsIytXhi/rustc_testrunner_tmpdir_reporting.ax0HfJtwB3vR/mvce.rs:9:1: 9:40>::get_ref`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0392, E0407, E0601.
For more information about an error, try `rustc --explain E0392`.

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Oct 27, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 27, 2026
  3. cushionbadak commented on Oct 28, 2026

    @cushionbadak

    Regression in nightly-2026-10-27.

    searched nightlies: from nightly-2026-01-01 to nightly-2026-10-28
    regressed nightly: nightly-2026-10-27
    searched commit range: 76456a6...16d1ffa
    regressed commit: 16d1ffa

    bisected with cargo-bisect-rustc v0.6.12

    Host triple: x86_64-apple-darwin
    Reproduce with:

    cargo bisect-rustc --start=2026-01-01 --end=2026-10-28 --regress ice --preserve --script rustc -- 165052.rs --edition 2024 
  4. matthiaskrgr commented on Oct 29, 2026

    @matthiaskrgr
    MemberAuthor

    simpler:

    struct S<'a> {
        n: &'static u8, // changing 'static to 'a makes it compile
    }
    fn b(n: &u8) -> S {
        S { n }
    }
    
    fn main() {}
  5. matthiaskrgr commented on Oct 29, 2026

    @matthiaskrgr
    MemberAuthor

    Let's also mark this as a regression, going from pass -> ice by just misnaming a single lifetime is a bit bad 😅

  6. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Oct 29, 2026
  7. matthiaskrgr commented on Oct 29, 2026

    @matthiaskrgr
    MemberAuthor

    also available with free RegionError

    enum Ast<'a> {
        Add(&'a Ast<'static>, &'a Ast<'a>),
    }
    fn mk_add_bad1<'a, 'b>(x: &'a Ast, y: &'b Ast) -> Ast<'a> {
        Ast::Add(x, y)
    }
    
    fn main() {}
    `--edition` is unspecified, defaulting to `2015` while the latest is `2024`; it must be one of: <2015|2018|2021|2024|future>
    
    
    thread 'rustc' (2524641) panicked at /rustc-dev/92ffebeceaa0a071066f233873c2438e73d70fe7/compiler/rustc_errors/src/diagnostic.rs:795:9:
    assertion failed: !parts.is_empty()
    stack backtrace:
       0:     0x7f945b62aa86 - <<std[79e685616d8acb06]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[37f3b5327d2a8d81]::fmt::Display>::fmt
       1:     0x7f945bc0c3e9 - core[37f3b5327d2a8d81]::fmt::write
       2:     0x7f945b640b6c - <std[79e685616d8acb06]::sys::stdio::unix::Stderr as core[37f3b5327d2a8d81]::io::write::Write>::write_fmt
       3:     0x7f945b5fbbda - std[79e685616d8acb06]::panicking::default_hook::{closure#0}
       4:     0x7f945b61e3d3 - std[79e685616d8acb06]::panicking::default_hook
       5:     0x7f945a3df1c9 - std[79e685616d8acb06]::panicking::update_hook::<alloc[c9af9d88734a640]::boxed::Box<rustc_driver_impl[a9bc65168640fad2]::install_ice_hook::{closure#1}>>::{closure#0}
       6:     0x7f945b61e872 - std[79e685616d8acb06]::panicking::panic_with_hook
       7:     0x7f945b5fbcc4 - std[79e685616d8acb06]::panicking::panic_handler::{closure#0}
       8:     0x7f945b5f30c9 - std[79e685616d8acb06]::sys::backtrace::__rust_end_short_backtrace::<std[79e685616d8acb06]::panicking::panic_handler::{closure#0}, !>
       9:     0x7f945b5fd9ed - __rustc[24b41f7b1eaff5c4]::rust_begin_unwind
      10:     0x7f9457e9d34c - core[37f3b5327d2a8d81]::panicking::panic_fmt
      11:     0x7f94589cfd02 - core[37f3b5327d2a8d81]::panicking::panic
      12:     0x7f9459f91ca1 - <rustc_errors[562a20e589be4a37]::diagnostic::Diag>::multipart_suggestion_with_style::<&str>
      13:     0x7f945a07e8a1 - <rustc_borrowck[473f42d474e5f443]::MirBorrowckCtxt>::report_general_error
      14:     0x7f945a077042 - <rustc_borrowck[473f42d474e5f443]::MirBorrowckCtxt>::report_region_error
      15:     0x7f945a07facc - <rustc_borrowck[473f42d474e5f443]::MirBorrowckCtxt>::report_region_errors
      16:     0x7f945d01a318 - rustc_borrowck[473f42d474e5f443]::borrowck_check_region_constraints
      17:     0x7f945cfeef9b - <rustc_borrowck[473f42d474e5f443]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
      18:     0x7f945bf3d355 - rustc_borrowck[473f42d474e5f443]::mir_borrowck
      19:     0x7f945bf3d079 - rustc_query_impl[94ea310137c91be9]::query_vtables::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
      20:     0x7f945bf3ba8e - rustc_query_impl[94ea310137c91be9]::execution::try_execute_query::<rustc_data_structures[765348a730531b4f]::vec_cache::VecCache<rustc_span[8d99a68682bc74a4]::def_id::LocalDefId, rustc_middle[65aed009adb63715]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[65aed009adb63715]::dep_graph::graph::DepNodeIndex>, false>
      21:     0x7f945bf3b5f5 - rustc_query_impl[94ea310137c91be9]::query_vtables::mir_borrowck::execute_query_non_incr::__rust_end_short_backtrace
      22:     0x7f945bf39669 - <rustc_middle[65aed009adb63715]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[ee1467d4bce41807]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
      23:     0x7f945bf389d2 - rustc_interface[ee1467d4bce41807]::passes::analysis
      24:     0x7f945ccdcf5f - rustc_query_impl[94ea310137c91be9]::execution::try_execute_query::<rustc_middle[65aed009adb63715]::query::caches::SingleCache<rustc_middle[65aed009adb63715]::query::erase::ErasedData<[u8; 0usize]>>, false>
      25:     0x7f945ccdcd53 - rustc_query_impl[94ea310137c91be9]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
      26:     0x7f945cf009c0 - rustc_interface[ee1467d4bce41807]::interface::run_compiler::<(), rustc_driver_impl[a9bc65168640fad2]::compiler_entrypoint::{closure#0}>::{closure#2}
      27:     0x7f945cf59101 - std[79e685616d8acb06]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ee1467d4bce41807]::util::run_in_thread_with_globals<rustc_interface[ee1467d4bce41807]::util::run_in_thread_pool_with_globals<rustc_interface[ee1467d4bce41807]::interface::run_compiler<(), rustc_driver_impl[a9bc65168640fad2]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      28:     0x7f945cf58ead - <std[79e685616d8acb06]::thread::lifecycle::spawn_unchecked<rustc_interface[ee1467d4bce41807]::util::run_in_thread_with_globals<rustc_interface[ee1467d4bce41807]::util::run_in_thread_pool_with_globals<rustc_interface[ee1467d4bce41807]::interface::run_compiler<(), rustc_driver_impl[a9bc65168640fad2]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[37f3b5327d2a8d81]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      29:     0x7f945cf53e6d - <std[79e685616d8acb06]::sys::thread::unix::Thread>::new::thread_start
      30:     0x7f9455e980a2 - <unknown>
      31:     0x7f9455f2080c - <unknown>
      32:                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: please make sure that you have updated to the latest nightly
    
    note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-10-29T18_54_40-2524572.txt` to your bug report
    
    note: rustc 1.101.0-nightly (92ffebece 2026-10-28) running on x86_64-unknown-linux-gnu
    
    query stack during panic:
    #0 [mir_borrowck] borrow-checking `mk_add_bad1`
    #1 [analysis] running analysis passes on crate `code`
    end of query stack
    note: no errors encountered even though delayed bugs were created
    
    note: those delayed bugs will now be shown as internal compiler errors
    
    error: internal compiler error: RegionError { fr_origin: FreeRegion, longer_fr: '?2, shorter_fr: '?1, is_reported: true }
      |
      = note: delayed at /rustc-dev/92ffebeceaa0a071066f233873c2438e73d70fe7/compiler/rustc_borrowck/src/region_infer/region_context.rs:1522:31 - disabled backtrace
    
    error: internal compiler error: RegionError { fr_origin: FreeRegion, longer_fr: '?3, shorter_fr: '?0, is_reported: true }
      |
      = note: delayed at /rustc-dev/92ffebeceaa0a071066f233873c2438e73d70fe7/compiler/rustc_borrowck/src/region_infer/region_context.rs:1500:31 - disabled backtrace
    
    error: internal compiler error: RegionError { fr_origin: FreeRegion, longer_fr: '?4, shorter_fr: '?1, is_reported: true }
      |
      = note: delayed at /rustc-dev/92ffebeceaa0a071066f233873c2438e73d70fe7/compiler/rustc_borrowck/src/region_infer/region_context.rs:1522:31 - disabled backtrace
    
    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: please make sure that you have updated to the latest nightly
    
    note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-10-29T18_54_40-2524572.txt` to your bug report
    
    note: rustc 1.101.0-nightly (92ffebece 2026-10-28) running on x86_64-unknown-linux-gnu
    
    query stack during panic:
    end of query stack
    
  8. zachs18 commented on Oct 29, 2026

    @zachs18
    Contributor

    Regression in e1057ef. Note that if it is a legacy rollup build, it might be available in rust-lang-ci@e1057ef.
    The PR introducing the regression in this rollup is #164776: Account for trait object with implicit 'static lifetime i…

    cc @estebank

    bisected with cargo-bisect-rustc v0.6.12

    Host triple: x86_64-unknown-linux-gnu
    Reproduce with:

    cargo bisect-rustc --regress ice --preserve --start 2026-10-22 
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

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions