diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs index c41a5f74ae302..fcf3815a4f13c 100644 --- a/src/librustc_codegen_llvm/llvm/diagnostic.rs +++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs @@ -98,7 +98,7 @@ impl OptimizationDiagnostic<'ll> { pub struct InlineAsmDiagnostic<'ll> { pub cookie: c_uint, pub message: &'ll Twine, - pub instruction: &'ll Value, + pub instruction: Option<&'ll Value>, } impl InlineAsmDiagnostic<'ll> { @@ -117,7 +117,7 @@ impl InlineAsmDiagnostic<'ll> { InlineAsmDiagnostic { cookie, message: message.unwrap(), - instruction: instruction.unwrap(), + instruction, } } } diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs new file mode 100644 index 0000000000000..e3a78326a10fc --- /dev/null +++ b/src/test/ui/issues/issue-23458.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(asm)] + +fn main() { + unsafe { + asm!("int $3"); //~ ERROR too few operands for instruction + //~| ERROR invalid operand in inline asm + } +} diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr new file mode 100644 index 0000000000000..75b630c841cfe --- /dev/null +++ b/src/test/ui/issues/issue-23458.stderr @@ -0,0 +1,17 @@ +error: invalid operand in inline asm: 'int $3' + --> $DIR/issue-23458.rs:15:9 + | +LL | asm!("int $3"); //~ ERROR too few operands for instruction + | ^^^^^^^^^^^^^^^ + +error: :1:2: error: too few operands for instruction + int + ^ + + --> $DIR/issue-23458.rs:15:9 + | +LL | asm!("int $3"); //~ ERROR too few operands for instruction + | ^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors +