Skip to content

ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
#[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

original:

//~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
#[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
= T;this(&x);}

Version information

rustc 1.87.0-nightly (fd17deacc 2025-03-04)
binary: rustc
commit-hash: fd17deacce374a4185c882795be162e17b557050
commit-date: 2025-03-04
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
returnOk(());
}
let(before_predicates, after_predicates) =
ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
let span = ty_alias.where_clauses.before.span;
let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
{
letmut state = State::new();

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

Program output


thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
mid > len
stack backtrace:
0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
10: 0x7550207dd6fd - rust_begin_unwind
11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
26: 0x75501c0a370a - <unknown>
27: 0x75501c127aac - <unknown>
28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack

@rustbot label +F-lazy_type_alias

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    , 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
     blocks
    (function() {
    function addCopyButtons() {
    document.querySelectorAll('pre code').forEach(function(codeBlock) {
    if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
    codeBlock.parentElement.setAttribute('data-copy-added', 'true');
    var btn = document.createElement('button');
    btn.textContent = 'Copy';
    btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
    btn.onmouseover = function() { this.style.opacity = '1'; };
    btn.onmouseout = function() { this.style.opacity = '0.7'; };
    btn.onclick = function() {
    navigator.clipboard.writeText(codeBlock.textContent).then(function() {
    btn.textContent = 'Copied!';
    setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
    });
    };
    codeBlock.parentElement.style.position = 'relative';
    codeBlock.parentElement.appendChild(btn);
    });
    }
    addCopyButtons();
    // Re-run on dynamic content
    var observer = new MutationObserver(addCopyButtons);
    observer.observe(document.body, { childList: true, subtree: true });
    })();
    }
    } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
    })();
    (function(){
    try {
    var __m = "github.com";
    var __re = new RegExp('^' + "github\\.com" + '
    ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
    Skip to content

    ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

    Description

    @matthiaskrgr

    auto-reduced (treereduce-rust):

    #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
    #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

    original:

    //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
    foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
    #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
    = T;this(&x);}

    Version information

    rustc 1.87.0-nightly (fd17deacc 2025-03-04)
    binary: rustc
    commit-hash: fd17deacce374a4185c882795be162e17b557050
    commit-date: 2025-03-04
    host: x86_64-unknown-linux-gnu
    release: 1.87.0-nightly
    LLVM version: 20.1.0
    

    Possibly related line of code:

    ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
    if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
    returnOk(());
    }
    let(before_predicates, after_predicates) =
    ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
    let span = ty_alias.where_clauses.before.span;
    let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
    {
    letmut state = State::new();

    Command:
    /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

    Program output

    
    thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
    mid > len
    stack backtrace:
    0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
    1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
    2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
    3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
    4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
    5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
    6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
    7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
    8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
    9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
    10: 0x7550207dd6fd - rust_begin_unwind
    11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
    12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
    13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
    14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
    15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
    16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
    17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
    18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
    19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
    20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
    21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
    22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
    23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
    24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
    26: 0x75501c0a370a - <unknown>
    27: 0x75501c127aac - <unknown>
    28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
    note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
    query stack during panic:
    #0 [resolver_for_lowering_raw] getting the resolver for lowering
    end of query stack
    

    @rustbot label +F-lazy_type_alias

    Metadata

    Metadata

    Assignees

    Labels

    C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      , 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
      Skip to content

      ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

      Description

      @matthiaskrgr

      auto-reduced (treereduce-rust):

      #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
      #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

      original:

      //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
      foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
      #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
      = T;this(&x);}

      Version information

      rustc 1.87.0-nightly (fd17deacc 2025-03-04)
      binary: rustc
      commit-hash: fd17deacce374a4185c882795be162e17b557050
      commit-date: 2025-03-04
      host: x86_64-unknown-linux-gnu
      release: 1.87.0-nightly
      LLVM version: 20.1.0
      

      Possibly related line of code:

      ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
      if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
      returnOk(());
      }
      let(before_predicates, after_predicates) =
      ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
      let span = ty_alias.where_clauses.before.span;
      let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
      {
      letmut state = State::new();

      Command:
      /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

      Program output

      
      thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
      mid > len
      stack backtrace:
      0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
      1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
      2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
      3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
      4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
      5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
      6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
      7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
      8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
      9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
      10: 0x7550207dd6fd - rust_begin_unwind
      11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
      12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
      13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
      14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
      15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
      16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
      17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
      18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
      19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
      20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
      21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
      22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
      23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
      26: 0x75501c0a370a - <unknown>
      27: 0x75501c127aac - <unknown>
      28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
      note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
      query stack during panic:
      #0 [resolver_for_lowering_raw] getting the resolver for lowering
      end of query stack
      

      @rustbot label +F-lazy_type_alias

      Metadata

      Metadata

      Assignees

      Labels

      C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

      Type

      No type

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        , 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
        Skip to content

        ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

        Description

        @matthiaskrgr

        auto-reduced (treereduce-rust):

        #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
        #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

        original:

        //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
        foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
        #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
        = T;this(&x);}

        Version information

        rustc 1.87.0-nightly (fd17deacc 2025-03-04)
        binary: rustc
        commit-hash: fd17deacce374a4185c882795be162e17b557050
        commit-date: 2025-03-04
        host: x86_64-unknown-linux-gnu
        release: 1.87.0-nightly
        LLVM version: 20.1.0
        

        Possibly related line of code:

        ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
        if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
        returnOk(());
        }
        let(before_predicates, after_predicates) =
        ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
        let span = ty_alias.where_clauses.before.span;
        let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
        {
        letmut state = State::new();

        Command:
        /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

        Program output

        
        thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
        mid > len
        stack backtrace:
        0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
        1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
        2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
        3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
        4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
        5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
        6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
        7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
        8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
        9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
        10: 0x7550207dd6fd - rust_begin_unwind
        11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
        12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
        13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
        14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
        15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
        16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
        17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
        18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
        19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
        20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
        21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
        23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
        26: 0x75501c0a370a - <unknown>
        27: 0x75501c127aac - <unknown>
        28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
        note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
        query stack during panic:
        #0 [resolver_for_lowering_raw] getting the resolver for lowering
        end of query stack
        

        @rustbot label +F-lazy_type_alias

        Metadata

        Metadata

        Assignees

        Labels

        C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

        Type

        No type

        Projects

        No projects

          Milestone

          No milestone

          Relationships

          None yet

          Development

          No branches or pull requests

          Issue actions

          , 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
          Skip to content

          ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

          Description

          @matthiaskrgr

          auto-reduced (treereduce-rust):

          #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
          #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

          original:

          //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
          foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
          #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
          = T;this(&x);}

          Version information

          rustc 1.87.0-nightly (fd17deacc 2025-03-04)
          binary: rustc
          commit-hash: fd17deacce374a4185c882795be162e17b557050
          commit-date: 2025-03-04
          host: x86_64-unknown-linux-gnu
          release: 1.87.0-nightly
          LLVM version: 20.1.0
          

          Possibly related line of code:

          ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
          if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
          returnOk(());
          }
          let(before_predicates, after_predicates) =
          ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
          let span = ty_alias.where_clauses.before.span;
          let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
          {
          letmut state = State::new();

          Command:
          /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

          Program output

          
          thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
          mid > len
          stack backtrace:
          0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
          1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
          2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
          3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
          4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
          5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
          6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
          7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
          8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
          9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
          10: 0x7550207dd6fd - rust_begin_unwind
          11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
          12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
          13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
          14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
          15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
          16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
          17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
          18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
          19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
          20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
          21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
          22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
          23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
          24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
          25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
          26: 0x75501c0a370a - <unknown>
          27: 0x75501c127aac - <unknown>
          28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
          note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
          query stack during panic:
          #0 [resolver_for_lowering_raw] getting the resolver for lowering
          end of query stack
          

          @rustbot label +F-lazy_type_alias

          Metadata

          Metadata

          Assignees

          Labels

          C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

          Type

          No type

          Projects

          No projects

            Milestone

            No milestone

            Relationships

            None yet

            Development

            No branches or pull requests

            Issue actions

            , 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
            Skip to content

            ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

            Description

            @matthiaskrgr

            auto-reduced (treereduce-rust):

            #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
            #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

            original:

            //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
            foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
            #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
            = T;this(&x);}

            Version information

            rustc 1.87.0-nightly (fd17deacc 2025-03-04)
            binary: rustc
            commit-hash: fd17deacce374a4185c882795be162e17b557050
            commit-date: 2025-03-04
            host: x86_64-unknown-linux-gnu
            release: 1.87.0-nightly
            LLVM version: 20.1.0
            

            Possibly related line of code:

            ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
            if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
            returnOk(());
            }
            let(before_predicates, after_predicates) =
            ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
            let span = ty_alias.where_clauses.before.span;
            let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
            {
            letmut state = State::new();

            Command:
            /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

            Program output

            
            thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
            mid > len
            stack backtrace:
            0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
            1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
            2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
            3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
            4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
            5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
            6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
            7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
            8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
            9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
            10: 0x7550207dd6fd - rust_begin_unwind
            11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
            12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
            13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
            14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
            15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
            16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
            17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
            18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
            19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
            20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
            21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
            22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
            23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
            26: 0x75501c0a370a - <unknown>
            27: 0x75501c127aac - <unknown>
            28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
            note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
            query stack during panic:
            #0 [resolver_for_lowering_raw] getting the resolver for lowering
            end of query stack
            

            @rustbot label +F-lazy_type_alias

            Metadata

            Metadata

            Assignees

            Labels

            C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

            Type

            No type

            Projects

            No projects

              Milestone

              No milestone

              Relationships

              None yet

              Development

              No branches or pull requests

              Issue actions

              , 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
              Skip to content

              ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

              Description

              @matthiaskrgr

              auto-reduced (treereduce-rust):

              #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
              #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

              original:

              //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
              foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
              #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
              = T;this(&x);}

              Version information

              rustc 1.87.0-nightly (fd17deacc 2025-03-04)
              binary: rustc
              commit-hash: fd17deacce374a4185c882795be162e17b557050
              commit-date: 2025-03-04
              host: x86_64-unknown-linux-gnu
              release: 1.87.0-nightly
              LLVM version: 20.1.0
              

              Possibly related line of code:

              ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
              if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
              returnOk(());
              }
              let(before_predicates, after_predicates) =
              ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
              let span = ty_alias.where_clauses.before.span;
              let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
              {
              letmut state = State::new();

              Command:
              /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

              Program output

              
              thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
              mid > len
              stack backtrace:
              0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
              1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
              2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
              3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
              4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
              5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
              6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
              7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
              8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
              9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
              10: 0x7550207dd6fd - rust_begin_unwind
              11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
              12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
              13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
              14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
              15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
              16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
              17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
              18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
              19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
              20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
              21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
              22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
              23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
              24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
              25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
              26: 0x75501c0a370a - <unknown>
              27: 0x75501c127aac - <unknown>
              28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
              note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
              query stack during panic:
              #0 [resolver_for_lowering_raw] getting the resolver for lowering
              end of query stack
              

              @rustbot label +F-lazy_type_alias

              Metadata

              Metadata

              Assignees

              Labels

              C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

              Type

              No type

              Projects

              No projects

                Milestone

                No milestone

                Relationships

                None yet

                Development

                No branches or pull requests

                Issue actions

                , 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); ICE: `mid > len` on leading assoc ty / lazy type alias where clause with attributes · Issue #138010 · rust-lang/rust · GitHub
                Skip to content

                ICE: mid > len on leading assoc ty / lazy type alias where clause with attributes #138010

                Description

                @matthiaskrgr

                auto-reduced (treereduce-rust):

                #![feature(lazy_type_alias)]fnneeds_copy<T>(){typeF<T>where
                #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,():,():, = T;this(&x);}

                original:

                //~ ERROR: cannot find type `Foo`#![allow(non_upper_case_globals)]traitTheTrait{fndummy(&self){}}// should require *all* lifetimes.implTheTraitfor&'staticisize{}fnfoo<'a,F>(b)where&'aT:TheTrait{}fnneeds_copy<T>(_:&'staticT)where&'staticT:TheTrait{fnmain(){static x:isize = 1;
                foo(PhantomData<T>),}#[allow(type_alias_bounds)]typeF<T>where
                #[cfg(a)]T:TraitA,#[cfg(b)]T:TraitB,#[cfg_attr(a, cfg(a))]T:TraitAA,#[cfg_attr(b, cfg(b))]T:TraitBB,#[derive(Clone)]():,//~^ ERROR most attributes are not supported in `where` clauses//~| ERROR expected non-macro attribute, found attribute macro `derive`#[rustfmt::skip]():,//~ ERROR most attributes are not supported in `where` clauses
                = T;this(&x);}

                Version information

                rustc 1.87.0-nightly (fd17deacc 2025-03-04)
                binary: rustc
                commit-hash: fd17deacce374a4185c882795be162e17b557050
                commit-date: 2025-03-04
                host: x86_64-unknown-linux-gnu
                release: 1.87.0-nightly
                LLVM version: 20.1.0
                

                Possibly related line of code:

                ) -> Result<(), errors::WhereClauseBeforeTypeAlias>{
                if ty_alias.ty.is_none() || !ty_alias.where_clauses.before.has_where_token{
                returnOk(());
                }
                let(before_predicates, after_predicates) =
                ty_alias.generics.where_clause.predicates.split_at(ty_alias.where_clauses.split);
                let span = ty_alias.where_clauses.before.span;
                let sugg = if !before_predicates.is_empty() || !ty_alias.where_clauses.after.has_where_token
                {
                letmut state = State::new();

                Command:
                /home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

                Program output

                
                thread 'rustc' panicked at compiler/rustc_ast_passes/src/ast_validation.rs:140:55:
                mid > len
                stack backtrace:
                0: 0x7550207dad94 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h38d103f25b5fc9da
                1: 0x7550210057e2 - core::fmt::write::h51e5c982d87d838d
                2: 0x7550222d4511 - std::io::Write::write_fmt::h24e7c9ef42bcecab
                3: 0x7550207dabf2 - std::sys::backtrace::BacktraceLock::print::h2f36236a0c89f5ad
                4: 0x7550207dd4d2 - std::panicking::default_hook::{{closure}}::hfa3a01d30bf38a16
                5: 0x7550207dd0c4 - std::panicking::default_hook::h73a43ec84dfb2d2e
                6: 0x75501f92bdd7 - std[5b59e6f68f39e4a3]::panicking::update_hook::<alloc[a5cfa563521ef073]::boxed::Box<rustc_driver_impl[3a7877a37badcc56]::install_ice_hook::{closure#1}>>::{closure#0}
                7: 0x7550207ddd43 - std::panicking::rust_panic_with_hook::h7086c047409dd55a
                8: 0x7550207dda06 - std::panicking::begin_panic_handler::{{closure}}::hbcc7938463cd12bd
                9: 0x7550207db259 - std::sys::backtrace::__rust_end_short_backtrace::hf8fc633b7853f6d2
                10: 0x7550207dd6fd - rust_begin_unwind
                11: 0x75501d45e500 - core::panicking::panic_fmt::h416190ca0b61f92d
                12: 0x7550215a8be3 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator>::check_type_alias_where_clause_location
                13: 0x7550215aca53 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
                14: 0x7550215b2c9f - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_fn
                15: 0x7550215aa474 - <rustc_ast_passes[e09985d241b551c4]::ast_validation::AstValidator as rustc_ast[8d12759f5817a2f9]::visit::Visitor>::visit_item
                16: 0x7550215a5694 - rustc_interface[2148282fb0834f58]::passes::resolver_for_lowering_raw
                17: 0x7550215a480d - rustc_query_impl[d10ddfe12c3a8e74]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>
                18: 0x7550215a47eb - <rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[436ac50667b45076]::ops::function::FnOnce<(rustc_middle[20fb34f80dd5af75]::ty::context::TyCtxt, ())>>::call_once
                19: 0x755022054ed8 - rustc_query_system[3033f91d22641c6f]::query::plumbing::try_execute_query::<rustc_query_impl[d10ddfe12c3a8e74]::DynamicConfig<rustc_query_system[3033f91d22641c6f]::query::caches::SingleCache<rustc_middle[20fb34f80dd5af75]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d10ddfe12c3a8e74]::plumbing::QueryCtxt, false>
                20: 0x755022054a47 - rustc_query_impl[d10ddfe12c3a8e74]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
                21: 0x755022079a2d - rustc_interface[2148282fb0834f58]::passes::create_and_enter_global_ctxt::<core[436ac50667b45076]::option::Option<rustc_interface[2148282fb0834f58]::queries::Linker>, rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
                22: 0x7550220f19e0 - rustc_interface[2148282fb0834f58]::interface::run_compiler::<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}
                23: 0x755021f20608 - std[5b59e6f68f39e4a3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
                24: 0x755021f20ef4 - <<std[5b59e6f68f39e4a3]::thread::Builder>::spawn_unchecked_<rustc_interface[2148282fb0834f58]::util::run_in_thread_with_globals<rustc_interface[2148282fb0834f58]::util::run_in_thread_pool_with_globals<rustc_interface[2148282fb0834f58]::interface::run_compiler<(), rustc_driver_impl[3a7877a37badcc56]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[436ac50667b45076]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                25: 0x755021f222f7 - std::sys::pal::unix::thread::Thread::new::thread_start::hbb5e0f14d5ca8b98
                26: 0x75501c0a370a - <unknown>
                27: 0x75501c127aac - <unknown>
                28: 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.87.0-nightly (fd17deacc 2025-03-04) running on x86_64-unknown-linux-gnu
                note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir
                query stack during panic:
                #0 [resolver_for_lowering_raw] getting the resolver for lowering
                end of query stack
                

                @rustbot label +F-lazy_type_alias

                Metadata

                Metadata

                Assignees

                Labels

                C-bugCategory: This is a bug.F-where_clause_attrs`#![feature(where_clause_attrs)]`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.

                Type

                No type

                Projects

                No projects

                  Milestone

                  No milestone

                  Relationships

                  None yet

                  Development

                  No branches or pull requests

                  Issue actions