Skip to content

ICE: Cannot transmute to non-Sized type #110151

@stevefan1999-personal

Description

@stevefan1999-personal

Error

facebook/buck2#136

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (23ee2af2f 2023-04-07)
binary: rustc
commit-hash: 23ee2af2f7669d521ad39ef8a506a4fa3d37ea5a
commit-date: 2023-04-07
host: x86_64-pc-windows-msvc
release: 1.70.0-nightly
LLVM version: 16.0.2

Notice

Should be able to consistently trigger on Windows platform

Backtrace
warning: error finalizing incremental compilation session directory `\\?\C:\Users\steve\AppData\Local\Temp\cargo-installeWlLuT\release\incremental\buck2_build_api-3bpejjqwe8ssu\s-gjx1f497xi-18v2t4g-working`: The system cannot find the file specified. (os error 2)

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:7299 ~ buck2_build_api[daa8]::artifact_groups::calculation::_assert_ensure_artifact_group_future_size::{closure#0}), const_param_did: None }) (after phase change to runtime-optimized) at bb2[1]:
                                Cannot transmute to non-`Sized` type impl futures::Future<Output = std::result::Result<artifact_groups::calculation::EnsureArtifactGroupReady, anyhow::Error>> + '_
   --> app\buck2_build_api\src\artifact_groups\calculation.rs:238:5
    |
238 |     static_assertions::assert_eq_size_ptr!(&v, &e);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at    0: std::backtrace::Backtrace::disabled
               1: std::backtrace::Backtrace::force_capture
               2: <rustc_errors::HandlerInner>::emit_diagnostic
               3: <rustc_const_eval::transform::check_consts::qualifs::CustomEq as rustc_const_eval::transform::check_consts::qualifs::Qualif>::in_qualifs
               4: rustc_const_eval::transform::promote_consts::is_const_fn_in_array_repeat_expression
               5: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
               6: <rustc_mir_transform::large_enums::EnumSizeOpt as rustc_middle::mir::MirPass>::is_enabled
               7: <rustc_mir_transform::remove_noop_landing_pads::RemoveNoopLandingPads as rustc_middle::mir::MirPass>::run_pass
               8: <&rustc_index::vec::IndexVec<rustc_middle::mir::Promoted, rustc_middle::mir::Body> as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
               9: <rustc_span::def_id::DefId as rustc_serialize::serialize::Encodable<rustc_query_impl::on_disk_cache::CacheEncoder>>::encode
              10: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::as_any
              11: <rustc_metadata::creader::CStore>::from_tcx
              12: rustc_metadata::rmeta::encoder::encode_metadata
              13: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern
              14: rustc_metadata::rmeta::encoder::encode_metadata
              15: rustc_metadata::fs::encode_and_write_metadata
              16: rustc_interface::passes::start_codegen
              17: rustc_interface::proc_macro_decls::provide
              18: <rustc_interface::queries::Queries>::ongoing_codegen
              19: <rustc_middle::ty::SymbolName as core::fmt::Display>::fmt
              20: rustc_driver_impl::args::arg_expand_all
              21: rustc_driver_impl::main
              22: rustc_driver_impl::args::arg_expand_all
              23: rustc_driver_impl::args::arg_expand_all
              24: std::sys::windows::thread::Thread::new
              25: BaseThreadInitThunk
              26: RtlUserThreadStart

    = note: this error: internal compiler error originates in the macro `static_assertions::assert_eq_size_ptr` (in Nightly builds, run with -Z macro-backtrace for more info)

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.70.0-nightly (23ee2af2f 2023-04-07) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C panic=abort -C embed-bitcode=no -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
warning: `buck2_build_api` (lib) generated 1 warning
error: could not compile `buck2_build_api` (lib); 1 warning emitted
error: failed to compile `buck2 v0.1.0 (https://github.com/facebook/buck2.git#9178ac50)`, intermediate artifacts can be f

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 Apr 10, 2023
changed the title [-]static_assertions::assert_eq_size_ptr ICE[/-] [+]ICE: Cannot transmute to non-`Sized` type[/+] on Apr 10, 2023
Noratrieb

Noratrieb commented on Apr 10, 2023

@Noratrieb
Member

I attempted to create a minimial reproduction based on the code I saw and was not able to get an ICE on the latest nightly (2023-04-09).

async fn empty() {}

async fn meow(a: [u8; 100]) {
	empty().await;
	dbg!(a);
}

fn main() {
	let v = meow([0; 100]);
	let e = [0u8; 202];
	let _ = || unsafe {
		use std::{mem, ptr};
		let mut copy = ptr::read(&v);
		ptr::write(&mut copy, mem::transmute(ptr::read(&e)));
		mem::forget(copy);
	};
}

Could you try updating to the latest nightly and see whether that fixed it? There have been a few issues with transmute that got fixed in the last few days.

added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Apr 10, 2023
JakobDegen

JakobDegen commented on Apr 11, 2023

@JakobDegen
Contributor

This is fixed by #109959

added a commit that references this issue on Apr 11, 2023
f4d5289
added a commit that references this issue on Apr 12, 2023
fd40f51
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.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-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

      Participants

      @stevefan1999-personal@Noratrieb@JakobDegen

      Issue actions

        ICE: Cannot transmute to non-`Sized` type · Issue #110151 · rust-lang/rust