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

Constant gets evaluated despite unsatisfied where clauses #97477

Open
RalfJung opened this issue May 28, 2022 · 6 comments
Open

Constant gets evaluated despite unsatisfied where clauses #97477

RalfJung opened this issue May 28, 2022 · 6 comments
Assignees
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-const-eval Working group: Const evaluation

Comments

@RalfJung
Copy link
Member

RalfJung commented May 28, 2022

This is the rustc side of rust-lang/project-const-generics#37.

@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label May 28, 2022
@oli-obk oli-obk self-assigned this May 28, 2022
@RalfJung RalfJung added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Aug 6, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Aug 6, 2023

An example of code that runs into this comes from this issue:

// check-fail

// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

use std::fmt::Debug;
use std::marker::PhantomData;
use std::mem::size_of;

struct Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    _phantom: PhantomData<T>,
    buf: [u8; size_of::<T>() + 1],
}

impl<T> Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    pub fn new(val: T) -> Inline<T> {
        todo!()
    }
}

fn main() {
    let dst = Inline::<dyn Debug>::new(0); //~ ERROR
    //~^ ERROR
}

So, looks like a problem with const generics? Something is trying to evaluate size_of::<T>() + 1 despite T: ?Sized. That makes me wonder which other kind of invalid MIR const generics might execute?

Given that this code is clearly wrong, wouldn't it be better to ICE instead of having this SizeOfUnsizedType error variant that should not exist? It is marked as an incomplete feature after all, so ICEs are expected. And the current "fix" is papering over the ICE, not fixing the root cause.

Cc @rust-lang/project-const-generics

@RalfJung
Copy link
Member Author

RalfJung commented Aug 6, 2023

In fact the really strange part is that the const-eval error is the only error being emitted. It looks like there's literally nothing else preventing the unsized type to flow into a generic context that assumes T: Sized. How can that be?

EDIT: Ah no, that's wrong. The sized error shows up. But it shows up later. By the time const-eval runs, no error has been emitted yet. Or is that just some error buffering thing? But that can't quite be, "no errors encountered even though delay_span_bug issued" shows up when I make it do delay_span_bug and then bug!().

@lcnr
Copy link
Contributor

lcnr commented Aug 7, 2023

This is rust-lang/project-const-generics#37 probably 🤔

we have to evaluate the constant to check where-clauses but the constant is only well-formed if the where-clauses hold. Evaluating constants when proving where-clauses causes a bunch of issues. This is one of the big generic_const_exprs issues.

@RalfJung
Copy link
Member Author

RalfJung commented Aug 7, 2023

This is rust-lang/project-const-generics#37 probably

Ah yes that sounds similar to what we are seeing.

So... any objections to turning this back into a span_bug!? The underlying issue is far from fixed by this one extra check (as your issue shows), and I think if we want to get the interpreter into a state where it can run even in the presence of violated where clauses, we need to do some solid planning. I don't even know how many invariants there are that this can break, I worry that it is a lot and we'd get a never-ending stream of ICEs until we identify most of them (and more ICEs each time the interpreter is changed and relies on a new invariant that doesn't have a matching test yet).

@lcnr
Copy link
Contributor

lcnr commented Aug 7, 2023

yes, I think switching this back to a span_bug! is good

@RalfJung RalfJung changed the title Constant gets evaluated even when it contains SizeOf on unsized type Constant gets evaluated despite unsatisfied where clauses Aug 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 8, 2023
…r=lcnr

interpret: remove incomplete protection against invalid where clauses

Cc rust-lang#97477, rust-lang/project-const-generics#37

r? `@lcnr`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 8, 2023
…r=lcnr

interpret: remove incomplete protection against invalid where clauses

Cc rust-lang#97477, rust-lang/project-const-generics#37

r? ``@lcnr``
@matthiaskrgr
Copy link
Member

Stacktrace of #97477 (comment) for findability:

error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
   --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/mem/mod.rs:313:5
    |
313 |     intrinsics::size_of::<T>()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/compiler/rustc_errors/src/lib.rs:979:33:
Box<dyn Any>
stack backtrace:
   0:     0x7f9ab631251c - std::backtrace_rs::backtrace::libunwind::trace::h2e9aca4a2e5f86d8
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9ab631251c - std::backtrace_rs::backtrace::trace_unsynchronized::hceadf256d40c4c78
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9ab631251c - std::sys_common::backtrace::_print_fmt::h60f2bef4cb0157c0
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f9ab631251c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6cea472b207925bd
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9ab6377bec - core::fmt::rt::Argument::fmt::h3d728e2a4afb49e2
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9ab6377bec - core::fmt::write::h150aa7e0125aab4c
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9ab63050ce - std::io::Write::write_fmt::hae7410621843cc88
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/io/mod.rs:1714:15
   7:     0x7f9ab6312304 - std::sys_common::backtrace::_print::h86eb33b34d1dc616
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9ab6312304 - std::sys_common::backtrace::print::hb84e0252de442567
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9ab63153fa - std::panicking::panic_hook_with_disk_dump::{{closure}}::hd11a41cc902c2e97
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/panicking.rs:278:22
  10:     0x7f9ab63150e7 - std::panicking::panic_hook_with_disk_dump::hbeb280462d2abb1f
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/panicking.rs:312:9
  11:     0x7f9ab5149a59 - rustc_driver_impl[610dbdd3eb094fb1]::install_ice_hook::{closure#0}
  12:     0x7f9ab6315ca0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h73ce24f3c392592f
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/alloc/src/boxed.rs:2021:9
  13:     0x7f9ab6315ca0 - std::panicking::rust_panic_with_hook::he76476954ff54d04
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/panicking.rs:733:13
  14:     0x7f9ab5126061 - std[84884ff0985ea275]::panicking::begin_panic::<rustc_errors[9d4dd5a6d4bf62d1]::ExplicitBug>::{closure#0}
  15:     0x7f9ab5124c56 - std[84884ff0985ea275]::sys_common::backtrace::__rust_end_short_backtrace::<std[84884ff0985ea275]::panicking::begin_panic<rustc_errors[9d4dd5a6d4bf62d1]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9ab50fd756 - std[84884ff0985ea275]::panicking::begin_panic::<rustc_errors[9d4dd5a6d4bf62d1]::ExplicitBug>
  17:     0x7f9ab50cb36e - <rustc_errors[9d4dd5a6d4bf62d1]::HandlerInner>::span_bug::<rustc_span[2109ecbc79ac056c]::span_encoding::Span, alloc[431bee5c62997671]::string::String>
  18:     0x7f9ab50cb05f - <rustc_errors[9d4dd5a6d4bf62d1]::Handler>::span_bug::<rustc_span[2109ecbc79ac056c]::span_encoding::Span, alloc[431bee5c62997671]::string::String>
  19:     0x7f9ab50d10fb - rustc_middle[317d0c99bf64221a]::util::bug::opt_span_bug_fmt::<rustc_span[2109ecbc79ac056c]::span_encoding::Span>::{closure#0}
  20:     0x7f9ab50d112a - rustc_middle[317d0c99bf64221a]::ty::context::tls::with_opt::<rustc_middle[317d0c99bf64221a]::util::bug::opt_span_bug_fmt<rustc_span[2109ecbc79ac056c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9ab50d0d78 - rustc_middle[317d0c99bf64221a]::ty::context::tls::with_context_opt::<rustc_middle[317d0c99bf64221a]::ty::context::tls::with_opt<rustc_middle[317d0c99bf64221a]::util::bug::opt_span_bug_fmt<rustc_span[2109ecbc79ac056c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9ab37af1c4 - rustc_middle[317d0c99bf64221a]::util::bug::span_bug_fmt::<rustc_span[2109ecbc79ac056c]::span_encoding::Span>
  23:     0x7f9ab3727713 - <rustc_const_eval[81b8e6d870518589]::interpret::eval_context::InterpCx<rustc_const_eval[81b8e6d870518589]::const_eval::machine::CompileTimeInterpreter>>::statement
  24:     0x7f9ab36cdc19 - rustc_const_eval[81b8e6d870518589]::const_eval::eval_queries::eval_to_allocation_raw_provider
  25:     0x7f9ab325e007 - rustc_query_impl[8362d19b71b00d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8362d19b71b00d]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7f9ab3c333c7 - rustc_query_system[46f106d5b822efb7]::query::plumbing::try_execute_query::<rustc_query_impl[8362d19b71b00d]::DynamicConfig<rustc_query_system[46f106d5b822efb7]::query::caches::DefaultCache<rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::mir::interpret::GlobalId>, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[8362d19b71b00d]::plumbing::QueryCtxt, false>
  27:     0x7f9ab3c33049 - rustc_query_impl[8362d19b71b00d]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f9ab4889909 - rustc_const_eval[81b8e6d870518589]::const_eval::eval_to_valtree
  29:     0x7f9ab48897a0 - <rustc_const_eval[81b8e6d870518589]::provide::{closure#0} as core[1b2a3d848a2ec87d]::ops::function::FnOnce<(rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt, rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::mir::interpret::GlobalId>)>>::call_once
  30:     0x7f9ab45a85e9 - rustc_query_impl[8362d19b71b00d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8362d19b71b00d]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 24usize]>>
  31:     0x7f9ab45a8598 - <rustc_query_impl[8362d19b71b00d]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[1b2a3d848a2ec87d]::ops::function::FnOnce<(rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt, rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::mir::interpret::GlobalId>)>>::call_once
  32:     0x7f9ab47327c5 - rustc_query_system[46f106d5b822efb7]::query::plumbing::try_execute_query::<rustc_query_impl[8362d19b71b00d]::DynamicConfig<rustc_query_system[46f106d5b822efb7]::query::caches::DefaultCache<rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::mir::interpret::GlobalId>, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[8362d19b71b00d]::plumbing::QueryCtxt, false>
  33:     0x7f9ab473245e - rustc_query_impl[8362d19b71b00d]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f9ab39478dc - rustc_middle[317d0c99bf64221a]::query::plumbing::query_get_at::<rustc_query_system[46f106d5b822efb7]::query::caches::DefaultCache<rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::mir::interpret::GlobalId>, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 24usize]>>>
  35:     0x7f9ab3947667 - <rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  36:     0x7f9ab3947190 - <rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  37:     0x7f9ab35ba0cd - <rustc_infer[4964aa7e7a96197b]::infer::InferCtxt>::const_eval_resolve
  38:     0x7f9ab35b7921 - rustc_trait_selection[f5378f77531ecf34]::traits::const_evaluatable::is_const_evaluatable
  39:     0x7f9ab3c2dc9b - <rustc_trait_selection[f5378f77531ecf34]::traits::select::SelectionContext>::evaluate_predicate_recursively
  40:     0x7f9ab3c298d3 - rustc_traits[3cebf70d64149202]::evaluate_obligation::evaluate_obligation
  41:     0x7f9ab31ead7f - rustc_query_impl[8362d19b71b00d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8362d19b71b00d]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 2usize]>>
  42:     0x7f9ab36c0789 - rustc_query_system[46f106d5b822efb7]::query::plumbing::try_execute_query::<rustc_query_impl[8362d19b71b00d]::DynamicConfig<rustc_query_system[46f106d5b822efb7]::query::caches::DefaultCache<rustc_middle[317d0c99bf64221a]::infer::canonical::Canonical<rustc_middle[317d0c99bf64221a]::ty::ParamEnvAnd<rustc_middle[317d0c99bf64221a]::ty::Predicate>>, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[8362d19b71b00d]::plumbing::QueryCtxt, false>
  43:     0x7f9ab36c03cf - rustc_query_impl[8362d19b71b00d]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7f9ab3ac02dc - <rustc_infer[4964aa7e7a96197b]::infer::InferCtxt as rustc_trait_selection[f5378f77531ecf34]::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
  45:     0x7f9ab3abbe6a - <rustc_infer[4964aa7e7a96197b]::infer::InferCtxt>::probe::<rustc_hir_typeck[7e00dffbed43131e]::method::probe::ProbeResult, <rustc_hir_typeck[7e00dffbed43131e]::method::probe::ProbeContext>::consider_probe::{closure#0}>
  46:     0x7f9ab34eeabb - <rustc_hir_typeck[7e00dffbed43131e]::method::probe::ProbeContext>::pick_all_method
  47:     0x7f9ab34e6ed6 - <rustc_infer[4964aa7e7a96197b]::infer::InferCtxt>::probe::<core[1b2a3d848a2ec87d]::result::Result<rustc_hir_typeck[7e00dffbed43131e]::method::probe::Pick, rustc_hir_typeck[7e00dffbed43131e]::method::MethodError>, <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck[7e00dffbed43131e]::method::probe::Pick>::{closure#4}>
  48:     0x7f9ab3513e9c - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::resolve_fully_qualified_call
  49:     0x7f9ab34fdcb6 - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_expr_path
  50:     0x7f9ab351e310 - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_call
  51:     0x7f9ab34c61d9 - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  52:     0x7f9ab35196bc - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_decl
  53:     0x7f9ab34f9a33 - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_block_with_expected
  54:     0x7f9ab34c65fb - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  55:     0x7f9ab416ef58 - <rustc_hir_typeck[7e00dffbed43131e]::fn_ctxt::FnCtxt>::check_return_expr
  56:     0x7f9ab416d798 - rustc_hir_typeck[7e00dffbed43131e]::check::check_fn
  57:     0x7f9ab415e7ed - rustc_hir_typeck[7e00dffbed43131e]::typeck
  58:     0x7f9ab321a6cc - rustc_query_impl[8362d19b71b00d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8362d19b71b00d]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 8usize]>>
  59:     0x7f9ab321a6ae - <rustc_query_impl[8362d19b71b00d]::query_impl::typeck::dynamic_query::{closure#2} as core[1b2a3d848a2ec87d]::ops::function::FnOnce<(rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt, rustc_span[2109ecbc79ac056c]::def_id::LocalDefId)>>::call_once
  60:     0x7f9ab32fb2dd - rustc_query_system[46f106d5b822efb7]::query::plumbing::try_execute_query::<rustc_query_impl[8362d19b71b00d]::DynamicConfig<rustc_query_system[46f106d5b822efb7]::query::caches::VecCache<rustc_span[2109ecbc79ac056c]::def_id::LocalDefId, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8362d19b71b00d]::plumbing::QueryCtxt, false>
  61:     0x7f9ab4abf96f - rustc_query_impl[8362d19b71b00d]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  62:     0x7f9ab462bf7b - rustc_data_structures[88ad4396f1aa1674]::sync::par_for_each_in::<&[rustc_span[2109ecbc79ac056c]::def_id::LocalDefId], <rustc_middle[317d0c99bf64221a]::hir::map::Map>::par_body_owners<rustc_hir_analysis[6e7d8e1705157800]::check_crate::{closure#7}>::{closure#0}>
  63:     0x7f9ab462b0ab - rustc_hir_analysis[6e7d8e1705157800]::check_crate
  64:     0x7f9ab462567a - rustc_interface[93d7af63a48c5455]::passes::analysis
  65:     0x7f9ab4664aba - rustc_query_impl[8362d19b71b00d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8362d19b71b00d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 1usize]>>
  66:     0x7f9ab4664aa9 - <rustc_query_impl[8362d19b71b00d]::query_impl::analysis::dynamic_query::{closure#2} as core[1b2a3d848a2ec87d]::ops::function::FnOnce<(rustc_middle[317d0c99bf64221a]::ty::context::TyCtxt, ())>>::call_once
  67:     0x7f9ab47ebcd8 - rustc_query_system[46f106d5b822efb7]::query::plumbing::try_execute_query::<rustc_query_impl[8362d19b71b00d]::DynamicConfig<rustc_query_system[46f106d5b822efb7]::query::caches::SingleCache<rustc_middle[317d0c99bf64221a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8362d19b71b00d]::plumbing::QueryCtxt, false>
  68:     0x7f9ab47eba67 - rustc_query_impl[8362d19b71b00d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  69:     0x7f9ab47b6e16 - <rustc_middle[317d0c99bf64221a]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[610dbdd3eb094fb1]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>>
  70:     0x7f9ab43e01c1 - rustc_span[2109ecbc79ac056c]::set_source_map::<core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>, rustc_interface[93d7af63a48c5455]::interface::run_compiler<core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>, rustc_driver_impl[610dbdd3eb094fb1]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  71:     0x7f9ab43da690 - std[84884ff0985ea275]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[93d7af63a48c5455]::util::run_in_thread_pool_with_globals<rustc_interface[93d7af63a48c5455]::interface::run_compiler<core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>, rustc_driver_impl[610dbdd3eb094fb1]::run_compiler::{closure#1}>::{closure#0}, core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>>
  72:     0x7f9ab49baed5 - <<std[84884ff0985ea275]::thread::Builder>::spawn_unchecked_<rustc_interface[93d7af63a48c5455]::util::run_in_thread_pool_with_globals<rustc_interface[93d7af63a48c5455]::interface::run_compiler<core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>, rustc_driver_impl[610dbdd3eb094fb1]::run_compiler::{closure#1}>::{closure#0}, core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1b2a3d848a2ec87d]::result::Result<(), rustc_span[2109ecbc79ac056c]::ErrorGuaranteed>>::{closure#1} as core[1b2a3d848a2ec87d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  73:     0x7f9ab63202d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h24d01bd9757d4365
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/alloc/src/boxed.rs:2007:9
  74:     0x7f9ab63202d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3f16bb51567a3163
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/alloc/src/boxed.rs:2007:9
  75:     0x7f9ab63202d5 - std::sys::unix::thread::Thread::new::thread_start::h5a67bb2093ddc843
                               at /rustc/d190d978649a9bee690ab7d489b59e4c3a78dee4/library/std/src/sys/unix/thread.rs:108:17
  76:     0x7f9ab1e9d44b - <unknown>
  77:     0x7f9ab1f20e40 - <unknown>
  78:                0x0 - <unknown>

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 attach the file at `/tmp/rustc-ice-2023-08-09T19:49:42.227832878Z-271128.txt` to your bug report

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at blubb.rs:16:1: 16:18>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [evaluate_obligation] evaluating trait selection obligation `the constant `size_of::<T>() + 1` can be evaluated`
#3 [typeck] type-checking `main`
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 9, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 17, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 18, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 18, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 23, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Oct 24, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang/rust#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Nov 2, 2023
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving rust-lang/rust#97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
@workingjubilee workingjubilee added the requires-incomplete-features This issue requires the use of incomplete features. label Jun 6, 2024
@jackh726 jackh726 added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Sep 14, 2024
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-const-eval Working group: Const evaluation labels Nov 21, 2024
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-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-const-eval Working group: Const evaluation
Projects
None yet
Development

No branches or pull requests

7 participants