-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 when passing ()
to a function generic over Copy
#42148
Comments
copy_from_slice
on an array literal
copy_from_slice
on an array literal()
to a function generic over Copy
The problem is use of ZST, not generics. #![feature(core_intrinsics)]
extern crate core;
use core::intrinsics;
struct Zst;
fn main() {
unsafe { intrinsics::volatile_store(1 as *mut Zst, Zst); }
} |
This can be reproduced without directly using the intrinsic as well: struct Zst;
fn main() {
unsafe { ::std::ptr::write_volatile(1 as *mut Zst, Zst) }
} |
I'd like to work on this. |
I can try to mentor this (ping me on IRC) The problem occurs when function calls are translated to LLVM - the match block here: This is a part of trans code, which turns Rust MIR (mid-level IR, defined at https://github.com/rust-lang/rust/blob/master/src/librustc/mir/mod.rs) into LLVM IR (documented at http://llvm.org/docs/LangRef.html). It translates the typed, "unified-value-representation", ABI-unaware MIR into mostly-typeless and ABI-aware LLVM IR. The problem is that in normal ABIs, zero-typed arguments are marked as As a fix, you could either refactor intrinsics not to use the |
Bug triage: The minimal ZST reproducer from TimNN now compiles without error on the current stable (1.22.1), beta, and nightly. The original reproducer (using core_intrinsics) now compiles without error on the current nightly ( |
Closes rust-lang#36792. Closes rust-lang#38091. Closes rust-lang#39687. Closes rust-lang#42148. Closes rust-lang#42956.
Add tests to fixed issues. Closes rust-lang#36792. Closes rust-lang#38091. Closes rust-lang#39687. Closes rust-lang#42148. Closes rust-lang#42956.
Add tests to fixed issues. Closes rust-lang#36792. Closes rust-lang#38091. Closes rust-lang#39687. Closes rust-lang#42148. Closes rust-lang#42956.
Add tests to fixed issues. Closes rust-lang#36792. Closes rust-lang#38091. Closes rust-lang#39687. Closes rust-lang#42148. Closes rust-lang#42956.
I was met with an internal compiler error:
error: internal compiler error: unexpected panic
I expected some kind of user-comprehensible error, instead.
Meta
Rust version:
rustc 1.19.0-nightly (01951a61a 2017-05-20)
Associated Rust Playground: https://is.gd/ZHy4Av
Backtrace:
The text was updated successfully, but these errors were encountered: