Closed
Description
When compiling the following program:
#![feature(asm)]
fn main() {
unsafe { asm!("callq $0" : : "0"(foo)) };
}
extern "C" {
fn foo(a: usize);
}
I get the following failure:
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::continue_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::panicking::panic
10: rustc_codegen_llvm::llvm::diagnostic::Diagnostic::unpack
11: rustc_codegen_llvm::back::write::diagnostic_handler
12: _ZN4llvm17DiagnosticHandler17handleDiagnosticsERKNS_14DiagnosticInfoE
13: _ZN4llvm11LLVMContext8diagnoseERKNS_14DiagnosticInfoE
14: _ZN4llvm11LLVMContext9emitErrorEjRKNS_5TwineE
15: _ZNK4llvm10AsmPrinter13EmitInlineAsmEPKNS_12MachineInstrE
16: _ZN4llvm10AsmPrinter16EmitFunctionBodyEv
17: _ZN4llvm13X86AsmPrinter20runOnMachineFunctionERNS_15MachineFunctionE
18: _ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE
19: _ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE
20: _ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE
21: _ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE
22: LLVMRustWriteOutputFile
23: rustc_codegen_llvm::back::write::write_output_file
24: rustc_codegen_llvm::back::write::codegen::{{closure}}
25: rustc::util::common::time_ext
26: rustc_codegen_llvm::back::write::codegen
27: rustc_codegen_llvm::back::write::execute_work_item
query stack during panic:
end of query stack
error: aborting due to worker thread failure
error: aborting due to previous error
$ rustc --version
rustc 1.30.0-nightly (90d36fb59 2018-09-13)