Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: "Missing value for constant, but no error reported?" with uncomputable layout due to trivial bounds #135138

Open
lukas-code opened this issue Jan 5, 2025 · 2 comments · May be fixed by #135158
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-layout Area: Memory layout of types C-bug Category: This is a bug. F-trivial_bounds `#![feature(trivial_bounds)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lukas-code
Copy link
Member

Code

playground

#![feature(trivial_bounds)]

fn return_str()
where
    str: Sized,
{
    [(); { let _a: Option<str> = None; 0 }];
}

Meta

rustc --version --verbose:

Nightly channel

Build using the Nightly version: 1.86.0-nightly

(2025-01-04 1891c28669863bf7ed3e)

Error output

error: internal compiler error: Missing value for constant, but no error reported?
 --> src/lib.rs:7:10
  |
7 |     [(); { let _a: Option<str> = None; 0 }];
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace

note: delayed at compiler/rustc_trait_selection/src/traits/const_evaluatable.rs:132:44
         0: emit_diagnostic
                   at /data/code/rust3/compiler/rustc_errors/src/lib.rs:1506:41
         1: emit_diagnostic
                   at /data/code/rust3/compiler/rustc_errors/src/lib.rs:1080:9
         2: emit_producing_error_guaranteed<rustc_span::ErrorGuaranteed>
                   at /data/code/rust3/compiler/rustc_errors/src/diagnostic.rs:1323:20
         3: span_delayed_bug<rustc_span::span_encoding::Span, &str>
                   at /data/code/rust3/compiler/rustc_errors/src/lib.rs:1310:9
         4: is_const_evaluatable
                   at /data/code/rust3/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs:132:32
         5: process_obligation
                   at /data/code/rust3/compiler/rustc_trait_selection/src/traits/fulfill.rs:595:27
         6: process_obligations<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_trait_selection::traits::fulfill::FulfillProcessor>
                   at /data/code/rust3/compiler/rustc_data_structures/src/obligation_forest/mod.rs:470:23
         7: select<rustc_trait_selection::traits::FulfillmentError>
                   at /data/code/rust3/compiler/rustc_trait_selection/src/traits/fulfill.rs:110:13
         8: select_where_possible<rustc_trait_selection::traits::FulfillmentError>
                   at /data/code/rust3/compiler/rustc_trait_selection/src/traits/fulfill.rs:163:9
         9: select_obligations_where_possible<rustc_hir_typeck::fn_ctxt::_impl::{impl#0}::resolve_vars_with_obligations::{closure#0}::{closure_env#0}>
                   at /data/code/rust3/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:676:26
        10: type_inference_fallback
                   at /data/code/rust3/compiler/rustc_hir_typeck/src/fallback.rs:46:9
        11: {closure#0}
                   at /data/code/rust3/compiler/rustc_hir_typeck/src/lib.rs:184:5
        12: typeck_with_fallback
                   at /data/code/rust3/compiler/rustc_hir_typeck/src/lib.rs:105:1
        13: {closure#0}
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:283:9
        14: __rust_begin_short_backtrace<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure_env#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:548:18
        15: {closure#2}
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:622:25
        16: call_once<rustc_query_impl::query_impl::typeck::dynamic_query::{closure_env#2}, (rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>
                   at /data/code/rust3/library/core/src/ops/function.rs:250:5
        17: {closure#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:364:64
        18: {closure#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:72:9
        19: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/library/std/src/thread/local.rs:308:12
        20: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/library/std/src/thread/local.rs:272:9
        21: enter_context<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:69:5
        22: {closure#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/dep_graph/mod.rs:33:13
        23: {closure#0}<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:36
        24: with_context_opt<rustc_middle::ty::context::tls::with_context::{closure_env#0}<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:91:18
        25: with_context<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:5
        26: with_deps<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_middle/src/dep_graph/mod.rs:30:9
        27: {closure#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:364:37
        28: with_task<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>), rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:375:14
        29: {closure#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:534:13
        30: {closure#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:72:9
        31: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/library/std/src/thread/local.rs:308:12
        32: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/library/std/src/thread/local.rs:272:9
        33: enter_context<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:69:5
        34: {closure#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:151:13
        35: {closure#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:124:9
        36: {closure#0}<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:36
        37: with_context_opt<rustc_middle::ty::context::tls::with_context::{closure_env#0}<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:91:18
        38: with_context<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:5
        39: with_related_context<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:115:5
        40: start_query<(rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:136:9
        41: execute_job_incr<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:521:9
        42: execute_job<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:400:9
        43: try_execute_query<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:353:13
        44: {closure#0}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:834:9
        45: maybe_grow<(rustc_middle::query::erase::Erased<[u8; 8]>, core::option::Option<rustc_query_system::dep_graph::graph::DepNodeIndex>), rustc_query_system::query::plumbing::get_query_incr::{closure_env#0}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /home/lukas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.17/src/lib.rs:55:9
        46: ensure_sufficient_stack<(rustc_middle::query::erase::Erased<[u8; 8]>, core::option::Option<rustc_query_system::dep_graph::graph::DepNodeIndex>), rustc_query_system::query::plumbing::get_query_incr::{closure_env#0}<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/stack.rs:21:5
        47: get_query_incr<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:833:36
        48: __rust_end_short_backtrace
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:578:21
        49: query_ensure<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>>
                   at /data/code/rust3/compiler/rustc_middle/src/query/plumbing.rs:159:9
        50: typeck<rustc_span::def_id::LocalDefId>
                   at /data/code/rust3/compiler/rustc_middle/src/query/plumbing.rs:194:9
        51: {closure#4}
                   at /data/code/rust3/compiler/rustc_hir_analysis/src/lib.rs:184:13
        52: {closure#0}<rustc_hir_analysis::check_crate::{closure_env#4}>
                   at /data/code/rust3/compiler/rustc_middle/src/hir/map/mod.rs:351:82
        53: {closure#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:136:30
        54: call_once<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>
                   at /data/code/rust3/library/core/src/panic/unwind_safe.rs:272:9
        55: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>, ()>
                   at /data/code/rust3/library/std/src/panicking.rs:584:40
        56: try<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>>
                   at /data/code/rust3/library/std/src/panicking.rs:547:19
        57: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>, ()>
                   at /data/code/rust3/library/std/src/panic.rs:358:14
        58: run<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:26:9
        59: {closure#1}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:140:17
        60: for_each<rustc_span::def_id::LocalDefId, rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure_env#1}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>
                   at /data/code/rust3/library/core/src/slice/iter/macros.rs:254:21
        61: {closure#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:139:13
        62: parallel_guard<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:42:15
        63: par_for_each_in<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#4}::par_body_owners::{closure_env#0}<rustc_hir_analysis::check_crate::{closure_env#4}>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/sync/parallel.rs:132:5
        64: par_body_owners<rustc_hir_analysis::check_crate::{closure_env#4}>
                   at /data/code/rust3/compiler/rustc_middle/src/hir/map/mod.rs:351:9
        65: check_crate
                   at /data/code/rust3/compiler/rustc_hir_analysis/src/lib.rs:181:5
        66: run_required_analyses
                   at /data/code/rust3/compiler/rustc_interface/src/passes.rs:868:5
        67: analysis
                   at /data/code/rust3/compiler/rustc_interface/src/passes.rs:931:5
        68: {closure#0}
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:283:9
        69: __rust_begin_short_backtrace<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure_env#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:548:18
        70: {closure#2}
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:622:25
        71: call_once<rustc_query_impl::query_impl::analysis::dynamic_query::{closure_env#2}, (rustc_middle::ty::context::TyCtxt, ())>
                   at /data/code/rust3/library/core/src/ops/function.rs:250:5
        72: {closure#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:364:64
        73: {closure#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:72:9
        74: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/library/std/src/thread/local.rs:308:12
        75: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/library/std/src/thread/local.rs:272:9
        76: enter_context<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:69:5
        77: {closure#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/dep_graph/mod.rs:33:13
        78: {closure#0}<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:36
        79: with_context_opt<rustc_middle::ty::context::tls::with_context::{closure_env#0}<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:91:18
        80: with_context<rustc_middle::dep_graph::{impl#0}::with_deps::{closure_env#0}<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:5
        81: with_deps<rustc_query_system::dep_graph::graph::{impl#4}::with_task::{closure#0}::{closure_env#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>, rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_middle/src/dep_graph/mod.rs:30:9
        82: {closure#0}<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:364:37
        83: with_task<rustc_middle::dep_graph::DepsType, (rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>), (), rustc_middle::query::erase::Erased<[u8; 0]>>
                   at /data/code/rust3/compiler/rustc_query_system/src/dep_graph/graph.rs:366:14
        84: {closure#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:534:13
        85: {closure#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:72:9
        86: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/library/std/src/thread/local.rs:308:12
        87: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/library/std/src/thread/local.rs:272:9
        88: enter_context<rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:69:5
        89: {closure#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:151:13
        90: {closure#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:124:9
        91: {closure#0}<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:36
        92: with_context_opt<rustc_middle::ty::context::tls::with_context::{closure_env#0}<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:91:18
        93: with_context<rustc_middle::ty::context::tls::with_related_context::{closure_env#0}<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:102:5
        94: with_related_context<rustc_query_impl::plumbing::{impl#3}::start_query::{closure_env#0}<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>, (rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:115:5
        95: start_query<(rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job_incr::{closure_env#2}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:136:9
        96: execute_job_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:521:9
        97: execute_job<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:400:9
        98: try_execute_query<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:353:13
        99: {closure#0}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:834:9
       100: maybe_grow<(rustc_middle::query::erase::Erased<[u8; 0]>, core::option::Option<rustc_query_system::dep_graph::graph::DepNodeIndex>), rustc_query_system::query::plumbing::get_query_incr::{closure_env#0}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /home/lukas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.17/src/lib.rs:55:9
       101: ensure_sufficient_stack<(rustc_middle::query::erase::Erased<[u8; 0]>, core::option::Option<rustc_query_system::dep_graph::graph::DepNodeIndex>), rustc_query_system::query::plumbing::get_query_incr::{closure_env#0}<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>>
                   at /data/code/rust3/compiler/rustc_data_structures/src/stack.rs:21:5
       102: get_query_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
                   at /data/code/rust3/compiler/rustc_query_system/src/query/plumbing.rs:833:36
       103: __rust_end_short_backtrace
                   at /data/code/rust3/compiler/rustc_query_impl/src/plumbing.rs:578:21
       104: query_ensure<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>>
                   at /data/code/rust3/compiler/rustc_middle/src/query/plumbing.rs:159:9
       105: analysis
                   at /data/code/rust3/compiler/rustc_middle/src/query/plumbing.rs:194:9
       106: {closure#2}
                   at /data/code/rust3/compiler/rustc_driver_impl/src/lib.rs:446:13
       107: {closure#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
                   at /data/code/rust3/compiler/rustc_interface/src/passes.rs:813:27
       108: {closure#3}<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context.rs:1556:37
       109: {closure#0}<rustc_middle::ty::context::{impl#23}::create_global_ctxt::{closure_env#3}<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:72:9
       110: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#23}::create_global_ctxt::{closure_env#3}<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
                   at /data/code/rust3/library/std/src/thread/local.rs:308:12
       111: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#23}::create_global_ctxt::{closure_env#3}<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
                   at /data/code/rust3/library/std/src/thread/local.rs:272:9
       112: enter_context<rustc_middle::ty::context::{impl#23}::create_global_ctxt::{closure_env#3}<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context/tls.rs:69:5
       113: create_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>
                   at /data/code/rust3/compiler/rustc_middle/src/ty/context.rs:1556:9
       114: {closure#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
                   at /data/code/rust3/compiler/rustc_interface/src/passes.rs:781:9
       115: call_once<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, (&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2})>
                   at /data/code/rust3/library/core/src/ops/function.rs:250:5
       116: call_once<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}), dyn core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}), Output=core::option::Option<rustc_interface::queries::Linker>>, alloc::alloc::Global>
                   at /data/code/rust3/library/alloc/src/boxed.rs:2013:9
       117: create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
                   at /data/code/rust3/compiler/rustc_interface/src/passes.rs:821:5
       118: {closure#0}
                   at /data/code/rust3/compiler/rustc_driver_impl/src/lib.rs:417:22
       119: {closure#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
                   at /data/code/rust3/compiler/rustc_interface/src/interface.rs:499:80
       120: call_once<(), rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>
                   at /data/code/rust3/library/core/src/panic/unwind_safe.rs:272:9
       121: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()>
                   at /data/code/rust3/library/std/src/panicking.rs:584:40
       122: try<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>>
                   at /data/code/rust3/library/std/src/panicking.rs:547:19
       123: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()>
                   at /data/code/rust3/library/std/src/panic.rs:358:14
       124: {closure#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
                   at /data/code/rust3/compiler/rustc_interface/src/interface.rs:499:23
       125: {closure#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>
                   at /data/code/rust3/compiler/rustc_interface/src/util.rs:143:13
       126: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
                   at /data/code/rust3/compiler/rustc_interface/src/util.rs:106:21
       127: set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
                   at /home/lukas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scoped-tls-1.0.1/src/lib.rs:137:9
       128: create_session_globals_then<(), rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>>
                   at /data/code/rust3/compiler/rustc_span/src/lib.rs:138:5
       129: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
                   at /data/code/rust3/compiler/rustc_interface/src/util.rs:105:17
       130: __rust_begin_short_backtrace<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
                   at /data/code/rust3/library/std/src/sys/backtrace.rs:152:18
       131: {closure#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
                   at /data/code/rust3/library/std/src/thread/mod.rs:564:17
       132: call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>
                   at /data/code/rust3/library/core/src/panic/unwind_safe.rs:272:9
       133: do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>, ()>
                   at /data/code/rust3/library/std/src/panicking.rs:584:40
       134: try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>>
                   at /data/code/rust3/library/std/src/panicking.rs:547:19
       135: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>>, ()>
                   at /data/code/rust3/library/std/src/panic.rs:358:14
       136: {closure#1}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
                   at /data/code/rust3/library/std/src/thread/mod.rs:562:30
       137: call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>, ()>
                   at /data/code/rust3/library/core/src/ops/function.rs:250:5
       138: call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>
                   at /data/code/rust3/library/alloc/src/boxed.rs:2013:9
       139: call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global>
                   at /data/code/rust3/library/alloc/src/boxed.rs:2013:9
       140: thread_start
                   at /data/code/rust3/library/std/src/sys/pal/unix/thread.rs:106:17
       141: <unknown>
       142: <unknown>

Analysis

This happens, because after #129970, computing the layout of Option<str> will return LayoutError::Unknown ...

LayoutCalculatorError::UnexpectedUnsized(field) => {
// This is sometimes not a compile error if there are trivially false where clauses.
// See `tests/ui/layout/trivial-bounds-sized.rs` for an example.
assert!(field.layout.is_unsized(), "invalid layout error {err:#?}");
if !field.ty.is_sized(cx.tcx(), cx.typing_env) {
cx.tcx().dcx().delayed_bug(format!(
"encountered unexpected unsized field in layout of {ty:?}: {field:#?}"
));
}
LayoutError::Unknown(ty)
}

... which is turned into ErrorHandled::TooGeneric ...

err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
ErrorHandled::TooGeneric(span)
}

... which is turned into EvaluateConstErr::HasGenericsOrInfers ...

Err(ErrorHandled::TooGeneric(_)) => Err(EvaluateConstErr::HasGenericsOrInfers),

... wich will cause a delayed bug, because the const doesn't actually have generics or infers:

Err(EvaluateConstErr::HasGenericsOrInfers) => {
let err = if uv.has_non_region_infer() {
NotConstEvaluatable::MentionsInfer
} else if uv.has_non_region_param() {
NotConstEvaluatable::MentionsParam
} else {
let guar = infcx.dcx().span_delayed_bug(
span,
"Missing value for constant, but no error reported?",
);
NotConstEvaluatable::Error(guar)
};
Err(err)
}

@lukas-code lukas-code added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 5, 2025
@lukas-code lukas-code added A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-layout Area: Memory layout of types F-trivial_bounds `#![feature(trivial_bounds)]` S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 5, 2025
@FedericoBruzzone
Copy link
Contributor

I was investigating this ICE.
What should be the expected behavior when the trivial_bounds feature is active?
Warning and constant evaluation to 0?

@lukas-code
Copy link
Member Author

I was investigating this ICE. What should be the expected behavior when the trivial_bounds feature is active? Warning and constant evaluation to 0?

This should probably just fail to compile, similar to how it fails to compile when the layout of a local variable in a constant cannot be computed for some other reason.

For example this

fn return_str() {
    [(); { let _a: Option<[u8; usize::MAX]> = None; 0 }];
}

fails with

error[E0080]: evaluation of constant value failed
 --> src/lib.rs:4:16
  |
4 |     [(); { let _a: Option<[u8; usize::MAX]> = None; 0 }];
  |                ^^ values of the type `[u8; usize::MAX]` are too big for the target architecture

so the code from the issue could report something like this for example

error[E0080]: evaluation of constant value failed
 --> src/lib.rs:4:16
  |
4 |     [(); { let _a: Option<str> = None; 0 }];
  |                ^^ cannot determine the layout of the type `Option<str>`

FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 12, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 12, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 13, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 14, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 14, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 14, 2025
…or, r=FedericoBruzzone,oli-obk

fix ICE with references to infinite structs in consts

fixes rust-lang#114484

Normalizing `<Type as Pointee>::Metadata` may emit a (non-fatal) error during trait selection if finding the struct tail of `Type` hits the recursion limit. When this happens, prior this PR, we would treat the projection as rigid, i.e. don't normalize it further. This PR changes it so that we normalize to `ty::Error` instead.

This is important, because to compute the layout of `&Type` we need to compute the layout of `<Type as Pointee>::Metadata`

https://github.com/rust-lang/rust/blob/2ae9916816a448fcaab3b2da461de754eda0055a/compiler/rustc_ty_utils/src/layout.rs#L247-L273

and computing the layout of a rigid alias will (correctly) fail and needs to report an error to the user. For example:

```rust
trait Project {
    type Assoc;
}

fn foo<T: Project>() {
    [(); {
        let _: Option<T::Assoc> = None;
                   // ^^^^^^^^ this projection is rigid, so we can't know it's layout
        0
    }];
}
```

```
error: constant expression depends on a generic parameter
  --> src/lib.rs:6:10
   |
6  |       [(); {
   |  __________^
7  | |         let _: Option<T::Assoc> = None;
8  | |                    // ^^^^^^^^ this projection is rigid, so we can't know it's layout
9  | |         0
10 | |     }];
   | |_____^
   |
   = note: this may fail depending on what value the parameter takes
```

For non-generic rigid projections we will currently ICE, because we incorrectly assume that `LayoutError::Unknown` means that a const must be generic (rust-lang#135138). This is being fixed and turned into a proper error in rust-lang#135158.

```rust
#![feature(trivial_bounds)]

trait Project {
    type Assoc;
}

fn foo()
where
    u8: Project,
{
    [(); {
        let _: Option<<u8 as Project>::Assoc> = None; // ICEs currently, but will be an error
        0
    }];
}
```

However, if we hit the recursion limit when normalizing `<Type as Pointee>::Metadata` we don't want to report a layout error, because we already emitted the recursion error. So by normalizing to `ty::Error` here, we get a `LayoutError::ReferencesError` instead of a `LayoutError::Unknown` and don't report the layout error to the user.
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 14, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 14, 2025
Rollup merge of rust-lang#135464 - lukas-code:project-infinite-to-error, r=FedericoBruzzone,oli-obk

fix ICE with references to infinite structs in consts

fixes rust-lang#114484

Normalizing `<Type as Pointee>::Metadata` may emit a (non-fatal) error during trait selection if finding the struct tail of `Type` hits the recursion limit. When this happens, prior this PR, we would treat the projection as rigid, i.e. don't normalize it further. This PR changes it so that we normalize to `ty::Error` instead.

This is important, because to compute the layout of `&Type` we need to compute the layout of `<Type as Pointee>::Metadata`

https://github.com/rust-lang/rust/blob/2ae9916816a448fcaab3b2da461de754eda0055a/compiler/rustc_ty_utils/src/layout.rs#L247-L273

and computing the layout of a rigid alias will (correctly) fail and needs to report an error to the user. For example:

```rust
trait Project {
    type Assoc;
}

fn foo<T: Project>() {
    [(); {
        let _: Option<T::Assoc> = None;
                   // ^^^^^^^^ this projection is rigid, so we can't know it's layout
        0
    }];
}
```

```
error: constant expression depends on a generic parameter
  --> src/lib.rs:6:10
   |
6  |       [(); {
   |  __________^
7  | |         let _: Option<T::Assoc> = None;
8  | |                    // ^^^^^^^^ this projection is rigid, so we can't know it's layout
9  | |         0
10 | |     }];
   | |_____^
   |
   = note: this may fail depending on what value the parameter takes
```

For non-generic rigid projections we will currently ICE, because we incorrectly assume that `LayoutError::Unknown` means that a const must be generic (rust-lang#135138). This is being fixed and turned into a proper error in rust-lang#135158.

```rust
#![feature(trivial_bounds)]

trait Project {
    type Assoc;
}

fn foo()
where
    u8: Project,
{
    [(); {
        let _: Option<<u8 as Project>::Assoc> = None; // ICEs currently, but will be an error
        0
    }];
}
```

However, if we hit the recursion limit when normalizing `<Type as Pointee>::Metadata` we don't want to report a layout error, because we already emitted the recursion error. So by normalizing to `ty::Error` here, we get a `LayoutError::ReferencesError` instead of a `LayoutError::Unknown` and don't report the layout error to the user.
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 14, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 15, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 15, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 15, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 15, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 16, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 17, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 17, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
FedericoBruzzone added a commit to FedericoBruzzone/rust that referenced this issue Jan 17, 2025
- `check-pass` test for a MRE of rust-lang#135020
- fail test for rust-lang#135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-layout Area: Memory layout of types C-bug Category: This is a bug. F-trivial_bounds `#![feature(trivial_bounds)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants