Skip to content

Internal compiler error during build #121839

Open
@mateuszadamiec-a4bee

Description

@mateuszadamiec-a4bee

Code

use crate::monday::{query::monday_stats_query};

struct TrainingComing {
    pub name: String,
    pub start: String,
}

trait Replace<T> {
    fn replace(&mut self, at: usize, with: T) -> T;
}

impl<T> Replace<T> for Vec<T> {
    fn replace(&mut self, at: usize, with: T) -> T {
        std::mem::replace(&mut self[at], with)
    }
}

type TrainingsComing = Vec<Option<monday_stats_query::MondayStatsQueryTrainingsComing>>;
type TrainingItem = monday_stats_query::MondayStatsQueryTrainingsComingItemsPageItems;
type TrainingItemCV = monday_stats_query::MondayStatsQueryTrainingsComingItemsPageItemsColumnValues;

impl TryFrom<TrainingItem> for TrainingComing {
    type Error = anyhow::Error;

    fn try_from(mut item: TrainingItem) -> Result<Self, Self::Error> {
        if let TrainingItemCV::DateValue(values) =
            item.column_values.replace(0, TrainingItemCV::CheckboxValue)
        {
            Ok(TrainingComing {
                name: item.name,
                start: values
                    .date
                    .ok_or_else(|| anyhow::anyhow!("No date value"))?,
            })
        } else {
            Err(anyhow::anyhow!(
                "no date value in column values of {}",
                item.name
            ))
        }
    }
}
macro_rules! extract {
    ($name:ident, $from:ty, $to:ty, $resulting:ty) => {
        pub fn $name(items: Option<$from>) -> Option<$resulting> {
            Some(
                items?
                    .replace(0, None)?
                    .items_page
                    .items
                    .into_iter()
                    .flat_map(TryInto::<$to>::try_into)
                    .collect(),
            )
        }
    };
    ($name:ident, $from:ty, $to:ty) => {
        extract!($name, $from, $to, Vec<$to>);
    };
}
extract!(trainings, TrainingsComing, TrainingComing);

monday_stats_query is generated from a GraphQL query by graphgl-client from the query to monday API.

query TrainingsQuery {
  trainings_coming: boards(ids: "board_id") {
    items_page {
      items {
        name
        column_values(ids: "date4") {
          __typename
          ... on DateValue {
            date
          }
        }
      }
    }
  }
}

Meta

rustc --version --verbose:

rustc 1.78.0-nightly (397937d81 2024-02-22)
binary: rustc
commit-hash: 397937d812852f9bbeb671005cb399dbcb357cde
commit-date: 2024-02-22
host: x86_64-pc-windows-msvc
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

error.txt
backtrace.txt

Backtrace
Compiling welcome-page v0.1.0 
warning: unused variable: `person`                                          
  --> src\monday\query.rs:82:24
   |
82 | pub async fn get_stats(person: &str) -> Result<MondayStats> {
   |                        ^^^^^^ help: if this is intentional, prefix it with an underscore: `_person`
   |
   = note: `#[warn(unused_variables)]` on by default

error: internal compiler error: encountered incremental compilation error with evaluate_obligation(412363a4bb2c0275-36fc7cb585905e0e)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p welcome_page` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https://github.com/rust-lang/rust/issues/84970> for more information

thread 'rustc' panicked at /rustc/397937d812852f9bbeb671005cb399dbcb357cde\compiler\rustc_query_system\src\query\plumbing.rs:727:9:
Found unstable fingerprints for evaluate_obligation(412363a4bb2c0275-36fc7cb585905e0e): Ok(EvaluatedToOk)
stack backtrace:
   0:     0x7ffd215a3302 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h68c935e82fa66028
   1:     0x7ffd215d5efb - core::fmt::write::h71ab9e017864ebe3
   2:     0x7ffd215997e1 - <std::io::IoSlice as core::fmt::Debug>::fmt::h86544be1d80f660b
   3:     0x7ffd215a312a - std::sys_common::backtrace::lock::h019e7eb8b79466df
   4:     0x7ffd215a63ff - std::panicking::default_hook::h791d3407a133288b  
   5:     0x7ffd215a60ab - std::panicking::default_hook::h791d3407a133288b  
   6:     0x7ffc90a376b5 - rustc_driver_impl[bb5c5aff8572b7d1]::pretty::print
   7:     0x7ffd215a6a13 - std::panicking::rust_panic_with_hook::hc127690efc49ee75
   8:     0x7ffd215a68b9 - <std::panicking::begin_panic_handler::StaticStrPayload as core::panic::PanicPayload>::take_box::h94f57593cd6fd692
   9:     0x7ffd215a3bf9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h68c935e82fa66028
  10:     0x7ffd215a6576 - rust_begin_unwind
  11:     0x7ffd215fc2a7 - core::panicking::panic_fmt::hb3201b1e0e578609    
  12:     0x7ffc916ccfb9 - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::depth_limit_error
  13:     0x7ffc8f5cb516 - <windows[a6f37cc5cd77c93a]::Win32::Globalization::FONTSIGNATURE as core[26804fd20586e328]::cmp::PartialEq>::eq
  14:     0x7ffc9034f6ac - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::load_side_effects
  15:     0x7ffc902b6ba8 - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::load_side_effects
  16:     0x7ffc90523320 - <rustc_trait_selection[6955d21b57f1d567]::traits::fulfill::FulfillProcessor as rustc_data_structures[a1d5cfcdc23f36d2]::obligation_forest::ObligationProcessor>::process_obligation
  17:     0x7ffc9041100c - rustc_trait_selection[6955d21b57f1d567]::traits::specialize::specializes
  18:     0x7ffc90520bf4 - <rustc_trait_selection[6955d21b57f1d567]::traits::fulfill::FulfillmentContext as rustc_infer[bafd73bf425b0dd2]::traits::engine::TraitEngine>::select_where_possible
  19:     0x7ffc8fa54da6 - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::demand_eqtype_diag
  20:     0x7ffc8fa3d81a - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::check_call
  21:     0x7ffc8fa52dfb - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::demand_eqtype_diag
  22:     0x7ffc8fa8ef3a - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::check_struct_path
  23:     0x7ffc8fa52ffe - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::demand_eqtype_diag
  24:     0x7ffc8fa6f718 - <rustc_hir_typeck[df052fe20314c3ff]::fn_ctxt::FnCtxt>::demand_eqtype_diag
  25:     0x7ffc8fafde6d - <rustc_hir_typeck[df052fe20314c3ff]::method::probe::Pick>::maybe_emit_unstable_name_collision_hint
  26:     0x7ffc8fa2df3a - rustc_hir_typeck[df052fe20314c3ff]::typeck       
  27:     0x7ffc9029d71f - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::load_side_effects
  28:     0x7ffc90292f8f - rustc_query_impl[f0cb7c4251fa97af]::query_callbacks
  29:     0x7ffc90396b18 - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::load_side_effects
  30:     0x7ffc902f6761 - <rustc_query_impl[f0cb7c4251fa97af]::plumbing::QueryCtxt as rustc_query_system[1a4d4d887a6e03e1]::query::QueryContext>::load_side_effects
  31:     0x7ffc8fb43434 - rustc_hir_analysis[fdccec0b45416f7]::check_crate 
  32:     0x7ffc8f9590ca - rustc_interface[45fc42b296a3c56c]::passes::analysis
  33:     0x7ffc8f4e920d - rustc_query_impl[f0cb7c4251fa97af]::profiling_support::alloc_self_profile_query_strings
  34:     0x7ffc8f4ef999 - rustc_query_impl[f0cb7c4251fa97af]::profiling_support::alloc_self_profile_query_strings
  35:     0x7ffc8f4fc8b8 - rustc_query_impl[f0cb7c4251fa97af]::profiling_support::alloc_self_profile_query_strings
  36:     0x7ffc8f5535bc - <windows[a6f37cc5cd77c93a]::Win32::Globalization::FONTSIGNATURE as core[26804fd20586e328]::cmp::PartialEq>::eq
  37:     0x7ffc8f4ce497 - rustc_query_impl[f0cb7c4251fa97af]::profiling_support::alloc_self_profile_query_strings
  38:     0x7ffc8c85f37d - rustc_driver_impl[bb5c5aff8572b7d1]::args::arg_expand_all
  39:     0x7ffc8c86dcce - <rustc_middle[a5f6cb6b7a7c86bb]::ty::SymbolName as core[26804fd20586e328]::fmt::Debug>::fmt
  40:     0x7ffc8c85b23a - rustc_driver_impl[bb5c5aff8572b7d1]::args::arg_expand_all
  41:     0x7ffc8c85cd3a - rustc_driver_impl[bb5c5aff8572b7d1]::args::arg_expand_all
  42:     0x7ffc8c86b72f - rustc_driver_impl[bb5c5aff8572b7d1]::args::arg_expand_all
  43:     0x7ffc8c86d5a7 - <rustc_middle[a5f6cb6b7a7c86bb]::ty::SymbolName as core[26804fd20586e328]::fmt::Debug>::fmt
  44:     0x7ffd215b71ac - std::sys::pal::windows::thread::Thread::new::h114b2994e46e8fe6
  45:     0x7ffd6db7257d - BaseThreadInitThunk
  46:     0x7ffd6ea8aa58 - RtlUserThreadStart

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

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

note: please attach the file at `C:\Users\mateusz.adamiec\Documents\Git\internal--welcome-page\rustc-ice-2024-03-01T09_18_23-21116.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `<monday::query::monday_stats_query::MondayStatsQueryTrainingsComingItemsPageItems as core::convert::TryInto<monday::data::training_coming::TrainingComing>>::try_into: core::ops::function::FnMut<(monday::query::monday_stats_query::MondayStatsQueryTrainingsComingItemsPageItems,)>`  |  = note: this failure-note originates in the macro `extract` (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [typeck] type-checking `monday::query_result_extractors::trainings`      
#2 [analysis] running analysis passes on this crate
end of query stack
warning: `welcome-page` (lib) generated 1 warning
error: could not compile `welcome-page` (lib) due to 1 previous error; 1 warning emitted

Activity

added
C-bugCategory: This is a bug.
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Mar 1, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 1, 2024
added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Mar 1, 2024
added
A-incr-compArea: Incremental compilation
S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @fmease@jieyouxu@rustbot@mateuszadamiec-a4bee

        Issue actions

          Internal compiler error during build · Issue #121839 · rust-lang/rust