diff options
| author | nxya <nathacutlan@gmail.com> | 2023-08-14 14:07:28 -0400 |
|---|---|---|
| committer | nxya <nathacutlan@gmail.com> | 2023-08-14 14:07:46 -0400 |
| commit | cac7c127a270f90cc2ab3cb8179bf6bb2745a783 (patch) | |
| tree | b76974ee296a691bba4f0fa95c70f0b2507c1707 | |
| parent | b08dd92552d663e3c877c8e5ce859e212205a09f (diff) | |
| download | rust-cac7c127a270f90cc2ab3cb8179bf6bb2745a783.tar.gz rust-cac7c127a270f90cc2ab3cb8179bf6bb2745a783.zip | |
fixed *const [type error] does not implement the Copy trait
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/intrinsicck.rs | 2 | ||||
| -rw-r--r-- | tests/ui/asm/issue-113788.rs | 7 | ||||
| -rw-r--r-- | tests/ui/asm/issue-113788.stderr | 9 |
3 files changed, 17 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs index b0dd5e5787d..945953edd5a 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs @@ -68,7 +68,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { let asm_ty = match *ty.kind() { // `!` is allowed for input but not for output (issue #87802) ty::Never if is_input => return None, - ty::Error(_) => return None, + _ if ty.references_error() => return None, ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::I8), ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Some(InlineAsmType::I16), ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Some(InlineAsmType::I32), diff --git a/tests/ui/asm/issue-113788.rs b/tests/ui/asm/issue-113788.rs new file mode 100644 index 00000000000..903b444767f --- /dev/null +++ b/tests/ui/asm/issue-113788.rs @@ -0,0 +1,7 @@ +// test that "error: arguments for inline assembly must be copyable" doesn't show up in this code +// needs-asm-support +// only-x86_64 +fn main() { + let peb: *const PEB; //~ ERROR cannot find type `PEB` in this scope [E0412] + unsafe { std::arch::asm!("mov {0}, fs:[0x30]", out(reg) peb); } +} diff --git a/tests/ui/asm/issue-113788.stderr b/tests/ui/asm/issue-113788.stderr new file mode 100644 index 00000000000..f8e65b6f538 --- /dev/null +++ b/tests/ui/asm/issue-113788.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `PEB` in this scope + --> $DIR/issue-113788.rs:5:21 + | +LL | let peb: *const PEB; + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. |
