Skip to content

bug #97902

Closed
Closed
bug#97902
@kulicuu

Description

@kulicuu

Code

// A routine for testing multi-threaded rendering.


#![feature(drain_filter)]

use super::precursors::*;
use super::pipeline_101::*;
use super::pipeline_102::*;

use erupt::{
    cstr,
    utils::{self, surface},
    vk, DeviceLoader, EntryLoader, InstanceLoader,
    vk::{Device, MemoryMapFlags},
};
use cgmath::{Deg, Rad, Matrix4, Point3, Vector3, Vector4};
use nalgebra_glm as glm;
use std::{
    ffi::{c_void, CStr, CString},
    fs,
    fs::{write, OpenOptions},
    io::prelude::*,
    mem::*,
    os::raw::c_char,
    ptr,
    result::Result,
    result::Result::*,
    string::String,
    sync::{Arc, Mutex, mpsc, mpsc::channel, Condvar},
    thread,
    time,
};
// use std::sync::mpsc;
use std::time::{Duration, Instant};
use std::thread::sleep;
use smallvec::SmallVec;
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
use memoffset::offset_of;
use simple_logger::SimpleLogger;
use winit::{
    dpi::PhysicalSize,
    event::{
        Event, KeyboardInput, WindowEvent,
        ElementState, StartCause, VirtualKeyCode,
        DeviceEvent,
    },
    event_loop::{ControlFlow, EventLoop},
    window::WindowBuilder,
    window::Window
};


use closure::closure;


use structopt::StructOpt;
const TITLE: &str = "vulkan-routine-6400";
const FRAMES_IN_FLIGHT: usize = 2;
const LAYER_KHRONOS_VALIDATION: *const c_char = cstr!("VK_LAYER_KHRONOS_validation");
const SHADER_VERT: &[u8] = include_bytes!("../spv/s_400_.vert.spv");
const SHADER_FRAG: &[u8] = include_bytes!("../spv/s1.frag.spv");


// static mut log_300: Vec<String> = vec!();
unsafe extern "system" fn debug_callback(
    _message_severity: vk::DebugUtilsMessageSeverityFlagBitsEXT,
    _message_types: vk::DebugUtilsMessageTypeFlagsEXT,
    p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT,
    _p_user_data: *mut c_void,
) -> vk::Bool32 {
    let str_99 = String::from(CStr::from_ptr((*p_callback_data).p_message).to_string_lossy());
    // log_300.push(str_99 );
    eprintln!(
        "{}",
        CStr::from_ptr((*p_callback_data).p_message).to_string_lossy()
    );
    vk::FALSE
}


#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct VertexV3 {
    pos: [f32; 4],
    color: [f32; 4],
}

#[repr(C)]
#[derive(Clone, Debug, Copy)]
struct PushConstants {
    view: glm::Mat4,
}

#[repr(C)]
#[derive(Clone, Debug, Copy)]
struct UniformBufferObject {
    model: Matrix4<f32>,
    view: Matrix4<f32>,
    proj: Matrix4<f32>,
}

#[derive(Debug, StructOpt)]
struct Opt {
    #[structopt(short, long)]
    validation_layers: bool,
}

#[repr(C)]
#[derive(Debug, Clone, Copy)]
struct ControlInput {
    roll: i32,
    pitch: i32,
    yaw: i32,
    skew: i32,
}


// There is a plan that envisions three threads. One for state management, 
// consuming messages carrying async input updates, for example keypresses.
// Typically this first thread is doing maths, and as the program gets more complex,
// these responsibilities would spawn more thread architecture.
// Two is just for recording command buffers.
// Zero is the main, thread, organizing the program.





pub unsafe fn vulkan_routine_6400
()
{
    println!("\n6400\n");


    println!("\n6300\n");
    let opt = Opt { validation_layers: true };
    let event_loop = EventLoop::new();
    let window = WindowBuilder::new()
        .with_title(TITLE)
        .with_resizable(false)
        .with_maximized(true)
        
        .build(&event_loop)
        .unwrap();
    let entry = Arc::new(EntryLoader::new().unwrap());
    let application_name = CString::new("Vulkan-Routine-6300").unwrap();

    let (tx, rx) = channel();

    let (tx2, rx2) = channel();

    let pair = Arc::new((Mutex::new(false), Condvar::new()));

    thread::spawn(closure!(clone pair, || {

    }));

    assert_eq!(rx.recv().unwrap(), 10);

    tx2.send(15);
    tx2.send(167);

}




Meta

rustc --version --verbose:


note: rustc 1.63.0-nightly (5435ed691 2022-06-07) running on x86_64-pc-windows-msvc

Error output

error: internal compiler error: compiler\rustc_infer\src\infer\error_reporting\need_type_info.rs:856:33: unexpected path: def=smallvec::alloc::ffi::CString substs=[] path=Path { span: src\vulkan_6400.rs:146:28: 146:35 (#0), res: Def(TyAlias, DefId(1:2774 ~ std[2cf3]::ffi::CString)), segments: [PathSegment { ident: CString#0, hir_id: Some(HirId { owner: DefId(0:194 ~ vulkan__march__22[69e8]::vulkan_6400::vulkan_routine_64
00), local_id: 102 }), res: Some(Err), args: None, infer_args: true }] }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/5435ed6916a59e8d5acba2149316a841c3905cbd\compiler\rustc_errors\src\lib.rs:1334:9
stack backtrace:
   0:     0x7ffa4da29d1f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h69fba5d91df01e94
   1:     0x7ffa4da64d1a - core::fmt::write::h7055ff38dc941964
   2:     0x7ffa4da1c1c9 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h459f2587ce39c9e6
   3:     0x7ffa4da2d60b - std::panicking::default_hook::h3cc09d237d0ad77f
   4:     0x7ffa4da2d28b - std::panicking::default_hook::h3cc09d237d0ad77f
   5:     0x7ff9c8a899b6 - rustc_driver[d0366cf51f2715ae]::pretty::print_after_hir_lowering
   6:     0x7ffa4da2ddb2 - std::panicking::rust_panic_with_hook::h637899a72547023d
   7:     0x7ff9cd0a8865 - <rustc_middle[b3f937ff58444bef]::traits::query::OutlivesBound as rustc_middle[b3f937ff58444bef]::ty::context::Lift>::lift_to_tcx
   8:     0x7ff9cd0a6d79 - <rustc_middle[b3f937ff58444bef]::traits::query::OutlivesBound as rustc_middle[b3f937ff58444bef]::ty::context::Lift>::lift_to_tcx
   9:     0x7ff9cd595f69 - rustc_middle[b3f937ff58444bef]::util::bug::bug_fmt
  10:     0x7ff9cd044e79 - <rustc_middle[b3f937ff58444bef]::ty::sty::TypeAndMut as rustc_middle[b3f937ff58444bef]::ty::context::Lift>::lift_to_tcx
  11:     0x7ff9cd02b443 - <rustc_middle[b3f937ff58444bef]::ty::sty::TypeAndMut as rustc_middle[b3f937ff58444bef]::ty::context::Lift>::lift_to_tcx
  12:     0x7ff9cd029172 - <rustc_middle[b3f937ff58444bef]::ty::sty::TypeAndMut as rustc_middle[b3f937ff58444bef]::ty::context::Lift>::lift_to_tcx
  13:     0x7ff9cd0b4869 - <rustc_middle[b3f937ff58444bef]::ty::consts::int::ScalarInt as core[170f819330dac449]::fmt::Display>::fmt
  14:     0x7ff9cd0b48ec - <rustc_middle[b3f937ff58444bef]::ty::consts::int::ScalarInt as core[170f819330dac449]::fmt::Display>::fmt
  15:     0x7ff9cd595f18 - rustc_middle[b3f937ff58444bef]::util::bug::bug_fmt
  16:     0x7ff9ccee6889 - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::TypeAnnotationNeeded as core[170f819330dac449]::convert::Into<rustc_errors[708e462a94012513]::diagnostic::DiagnosticId>>::into
  17:     0x7ff9ccee6fda - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[c96766f741e94543]::intravisit::Visitor>::visit_expr
  18:     0x7ff9ccee6d90 - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[c96766f741e94543]::intravisit::Visitor>::visit_expr
  19:     0x7ff9ccf0e08f - <rustc_middle[b3f937ff58444bef]::ty::sty::ProjectionTy as rustc_infer[c89643690b59faa6]::infer::at::ToTrace>::to_trace
  20:     0x7ff9ccee6da4 - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[c96766f741e94543]::intravisit::Visitor>::visit_expr
  21:     0x7ff9ccee6907 - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[c96766f741e94543]::intravisit::Visitor>::visit_local
  22:     0x7ff9ccf0e2a6 - <rustc_middle[b3f937ff58444bef]::ty::sty::ProjectionTy as rustc_infer[c89643690b59faa6]::infer::at::ToTrace>::to_trace
  23:     0x7ff9ccee6da4 - <rustc_infer[c89643690b59faa6]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[c96766f741e94543]::intravisit::Visitor>::visit_expr
  24:     0x7ff9cce32541 - <rustc_infer[c89643690b59faa6]::infer::InferCtxt>::emit_inference_failure_err
  25:     0x7ff9ccde8ee5 - <rustc_infer[c89643690b59faa6]::infer::InferCtxt as rustc_trait_selection[5f9f278b9158f9e9]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  26:     0x7ff9ccdd5515 - <rustc_infer[c89643690b59faa6]::infer::InferCtxt as rustc_trait_selection[5f9f278b9158f9e9]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  27:     0x7ff9cb406df4 - <rustc_typeck[7a298000ef5f119f]::check::fn_ctxt::FnCtxt>::apply_adjustments
  28:     0x7ff9cb4892cb - <rustc_typeck[7a298000ef5f119f]::check::PlaceOp as core[170f819330dac449]::fmt::Debug>::fmt
  29:     0x7ff9cb46f502 - rustc_typeck[7a298000ef5f119f]::check::provide
  30:     0x7ff9cc009c68 - <rustc_query_impl[8090768474079d2c]::queries::generator_diagnostic_data as rustc_query_system[8c5261d944ed704a]::query::config::QueryDescription<rustc_query_impl[8090768474079d2c]::plumbing::QueryCtxt>>::describe
  31:     0x7ff9cc3311c2 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  32:     0x7ff9cc1a4ef7 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  33:     0x7ff9cc10d653 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  34:     0x7ff9cc0aa719 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  35:     0x7ff9ccf83b83 - <rustc_middle[b3f937ff58444bef]::ty::context::TyCtxt as rustc_query_system[8c5261d944ed704a]::dep_graph::DepContext>::try_force_from_dep_node
  36:     0x7ff9cc31c2cf - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  37:     0x7ff9cc11439a - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  38:     0x7ff9cc2ee963 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  39:     0x7ff9cb2f07c1 - <rustc_typeck[7a298000ef5f119f]::check::upvar::InferBorrowKind as rustc_typeck[7a298000ef5f119f]::expr_use_visitor::Delegate>::mutate
  40:     0x7ff9cb4759a3 - <rustc_typeck[7a298000ef5f119f]::check::MaybeInProgressTables>::borrow_mut
  41:     0x7ff9cc00ba5e - <rustc_query_impl[8090768474079d2c]::queries::generator_diagnostic_data as rustc_query_system[8c5261d944ed704a]::query::config::QueryDescription<rustc_query_impl[8090768474079d2c]::plumbing::QueryCtxt>>::describe
  42:     0x7ff9cc35962f - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  43:     0x7ff9cc2409e9 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  44:     0x7ff9cc2b9169 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  45:     0x7ff9cb30e22f - <rustc_typeck[7a298000ef5f119f]::expr_use_visitor::ExprUseVisitor>::consume_body
  46:     0x7ff9cb2eb146 - rustc_typeck[7a298000ef5f119f]::check_crate
  47:     0x7ff9c8b78cef - rustc_interface[ec95ea5c7cf11f5c]::passes::analysis
  48:     0x7ff9cc00b54e - <rustc_query_impl[8090768474079d2c]::queries::generator_diagnostic_data as rustc_query_system[8c5261d944ed704a]::query::config::QueryDescription<rustc_query_impl[8090768474079d2c]::plumbing::QueryCtxt>>::describe
  49:     0x7ff9cc34ffdf - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  50:     0x7ff9cc22a8eb - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  51:     0x7ff9cc2eede6 - <&[rustc_span[b8e7ecb8e53baf7f]::def_id::LocalDefId] as rustc_serialize[bd9d6815ae800de1]::serialize::Decodable<rustc_query_impl[8090768474079d2c]::on_disk_cache::CacheDecoder>>::decode
  52:     0x7ff9c8a3f29f - <rustc_driver[d0366cf51f2715ae]::args::Error as core[170f819330dac449]::fmt::Debug>::fmt
  53:     0x7ff9c8a17200 - <rustc_lint[7108b6e48795f800]::BuiltinCombinedPreExpansionLintPass as rustc_lint[7108b6e48795f800]::passes::EarlyLintPass>::check_impl_item
  54:     0x7ff9c8a98155 - <rustc_driver[d0366cf51f2715ae]::Compilation as core[170f819330dac449]::fmt::Debug>::fmt
  55:     0x7ff9c8a1845d - <rustc_lint[7108b6e48795f800]::BuiltinCombinedPreExpansionLintPass as rustc_lint[7108b6e48795f800]::passes::EarlyLintPass>::check_impl_item
  56:     0x7ff9c8a7eeb6 - <rustc_metadata[cf1e3891b8aa5891]::rmeta::encoder::EncodeContext as rustc_serialize[bd9d6815ae800de1]::serialize::Encoder>::emit_raw_bytes
  57:     0x7ff9c8a42388 - <rustc_driver[d0366cf51f2715ae]::args::Error as core[170f819330dac449]::fmt::Debug>::fmt
  58:     0x7ffa4da3ef5c - std::sys::windows::thread::Thread::new::hf93ccebb22bd5d63
  59:     0x7ffaad6b7034 - BaseThreadInitThunk
  60:     0x7ffaadfc2651 - RtlUserThreadStart

note: 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: rustc 1.63.0-nightly (5435ed691 2022-06-07) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck] type-checking `vulkan_6400::vulkan_routine_6400`
#1 [typeck_item_bodies] type-checking all item bodies

Backtrace

<backtrace>

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 Jun 8, 2022
Noratrieb

Noratrieb commented on Jun 9, 2022

@Noratrieb
Member

Seems to be s duplicate of #97885 (which is probably a duplicate of some other issue as well)

cjgillot

cjgillot commented on Sep 5, 2022

@cjgillot
Contributor

Closing as duplicate of closed #97698.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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

        @kulicuu@cjgillot@Noratrieb

        Issue actions

          bug · Issue #97902 · rust-lang/rust