Closed
Description
After upgrading to the new compiler, I can no longer build my project that is part of a cargo workspace. Building outside of a workspace works. I get the following error:
rustc: /home/rahix/.../rust/src/llvm/lib/IR/Constants.cpp:1512: static llvm::Constant* llvm::ConstantExpr::getCast(unsigned int, llvm::Constant*, llvm::Type*, bool): Assertion `CastInst::castIsValid(opc, C, Ty) && "Invalid constantexpr cast!"' failed.
I get this error even with a completely stripped down file like:
#![no_std]
#![no_main]
#![feature(lang_items, panic_handler)]
#[no_mangle]
pub extern fn main() {
loop { }
}
pub mod std {
#[lang = "eh_personality"]
pub unsafe extern "C" fn rust_eh_personality(
_state: (),
_exception_object: *mut (),
_context: *mut (),
) -> () {
}
#[panic_handler]
fn panic(_info: &::core::panic::PanicInfo) -> ! {
loop { }
}
}
The only other observation I was able to make is that is does not happen when I remove lto = true
from the root Cargo.toml
. For reference:
[package]
name = "..."
version = "0.0.0"
authors = ["..."]
[workspace]
members = ["...", "example"]
[profile]
[profile.release]
codegen-units = 1
debug = false
lto = true # Commenting out this line allows building
opt-level = "s"